How To Install Nextcloud on Rocky Linux 9

This tutorial intends to teach you How To Install and Configure Nextcloud on Rocky Linux 9.

Nextcloud is a file-sharing and collaboration platform. Using Nextcloud, you can set up a virtual private server for your company or organization to share files internally. Alternatively, you can use it to store your files on your own computer privately. Nextcloud is an open-source software platform you can install on your own server. This means you control the hardware, operating system, and all software involved in running it.

Steps To Install and Configure Nextcloud on Rocky Linux 9

To complete this guide, you must log in to your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow our guide on Initial Server Setup with Rocky Linux 9.

Also, you need to have the LAMP stack installed on your server. To do this, you can check How To Install LAMP Stack on Rocky Linux 9.

Disable SELinux on Rocky Linux 9

At this point, you should put SELinux in permissive mode, which means disabling it temporarily until the next reboot. This will make sure there will be no unwanted restrictions in installing NextCloud. To do this, run the following command:

# sudo setenforce 0
# sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

Check the SELinux status by running the following command:

sestatus
Output
SELinux status:                 disabled

Install Additional PHP Extensions for Nextcloud

At this point, you need to install some additional PHP extensions for Nextcloud on your server. To do this, run the command below:

sudo dnf -y install php-cli php-mysqlnd php-zip php-devel php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-json php-pdo php-pecl-apcu php-pecl-apcu-devel php-ldap

Then, you need to make a configuration change to the php.ini file. Open the file with your favorite text editor, here we use vi editor:

sudo vi /etc/php.ini

At the file, find memory_limit and set the value to 512M:

memory_limit = 512M

When you are done, save and close the file.

Create a Nextcloud Database on Rocky Linux 9

At this point, you need to create a user and database for Nextcloud. First, log in to your MariaDB shell with the following command:

sudo mysql -u root -p

Then, from your MariaDB shell run the command below to create your user, here we named it nextcloud-user, remember to choose a strong password for it:

MariaDB [(none)]> CREATE USER 'nextcloud-user'@'localhost' IDENTIFIED BY "password";

Next, use the command below to create your database, here we named it nextclouddb:

MariaDB [(none)]> CREATE DATABASE nextclouddb;

Now you need to grant all the privileges to your Nextcloud DB with the command below:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nextclouddb.* TO 'nextcloud-user'@'localhost';

Flush the privileges and exit from your MariaDB shell with the commands below:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;

Set up Nextcloud on Rocky Linux 9

At this point, you need to visit the Nextcloud official page and download it. Right-click on the Download for server from the Archive file and copy the link address.

Then, use the wget command to download Nextcloud on Rocky Linux 9:

sudo wget https://download.nextcloud.com/server/releases/latest.zip

Unzip your downloaded file with the command below:

sudo unzip latest.zip

Next, move your extracted file to the /var/www/html/ directory:

sudo mv nextcloud/ /var/www/html/

Now you need to create a data folder to store uploaded data in Nextcloud on Rocky Linux 9:

sudo mkdir /var/www/html/nextcloud/data

Set the correct ownership for your Nextcloud directory:

sudo chown apache:apache -R /var/www/html/nextcloud

Create an Apache Virtualhost file for Nextcloud

At this point, you need to create an Apache configuration file for NextCloud on Rocky Linux 9, to serve the file in case you are using the domain name or multiple websites are running on the same server.

Create and open your file with your favorite text editor, here we use vi:

sudo vi /etc/httpd/conf.d/nextcloud.conf

Add the following content to your file:

<VirtualHost *:80>
ServerName example.com
ServerAdmin [email protected]
DocumentRoot /var/www/html/nextcloud
<directory /var/www/html/nextcloud>
Require all granted
AllowOverride All
Options FollowSymLinks MultiViews
SetEnv HOME /var/www/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</directory>
</VirtualHost>

When you are done, save and close the file.

Restart Apache, to apply the changes:

sudo systemctl restart httpd

Configure Firewall for Nextcloud

Now allow traffic on HTTP and HTTPs with the command below:

# sudo firewall-cmd --add-service={http,https} --permanent
# sudo firewall-cmd --reload

Access Nextcloud Web Interface

When all the above steps are completed you are ready to access the web interface for setting up NextCloud further on your Rocky Linux 9 system.

Open your web browser and type your server’s IP address or domain name:

http://your-server-ip-address/nextcloud
or
http://your-domain.com/nextcloud

You will see the following screen. You need to create an Admin user and password and then, you need to select MySQL/MariaDB as Database. Then enter the details of the Database you have created. In the end, click Install.

Nextcloud login screen
Nextcloud Admin Account

Then, you will see your Nextcloud dashboard.

Nextcloud dashboard
Nextcloud dashboard

That’s it, you are done.

Nextcloud is a powerful application that you can use to store your files and data privately. You can also share this data with other users and collaborate on documents. For example, if you have a remote team or colleagues working from home that you regularly share files with, Nextcloud can be a great solution. Nextcloud also comes with a ton of great features so that you can fully customize and control your data.

Conclusion

At this point, you have learned to Install and Configure Nextcloud on Rocky Linux 9.

Hope you enjoy it.

You may be like these articles:

Migrate From Rocky Linux 8 To Rocky Linux 9

Install Netdata on Rocky Linux 9

How To Install XRDP on Rocky Linux 9

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!