Share your love
Install and Configure Nextcloud on Rocky Linux 8

In this guide, we want to teach you How To Install and Configure Nextcloud on Rocky Linux 8.
Nextcloud is an open-source tool that allows you to store and share files online. In short, it is an open-source cloud solution. It allows free access and synchronization of your data between different devices (mobile or computer), or the exchange of information with several people (users or not). With this tool, you have complete control over your data, where it is stored, how it is shared, and how it is deleted.
It offers, among other things, collaborative work and communication functionalities. Various services revolve around the «Nextcloud Enterprise» solution, such as application maintenance, hosting, support requests, or specific developments. However, these are not free.
Nextcloud is a fork of the OwnCloud project, developed by many members of the original OwnCloud team. The two projects have many similarities, but differ in their respective interfaces and license agreements, especially for the Enterprise editions.
Steps To Install and Configure Nextcloud on Rocky Linux 8
To install Nextcloud on Rocky Linux 8, you need some requirements.
Requirements
First, you must log in t your server as a non-root user with sudo privileges and set up a basic firewall. To do this, you can follow the Initial Server Setup with Rocky Linux 8.
Also, you need to have LAMP Stack installed on your server. To do this, you can check How To Install LAMP Stack on Rocky Linux 8.
When you are done with these requirements, follow the steps below to complete this guide.
Disable SELinux on Rocky Linux 8
You should put SELinux in permissive mode at this point, 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
Configure PHP for Nextcloud on Rocky Linux 8
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-mcrypt 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:
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 8
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;
Installing Nextcloud on Rocky Linux 8
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 8:
wget https://download.nextcloud.com/server/releases/latest.zip
Unzip your downloaded file with the command below:
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 8:
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 Apache Virtualhost file for Nextcloud on Rocky Liux 8
At this point, you need to create an Apache configuration file for NextCloud, 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 admin@example.com 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
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 8 system.
Open your web browser and type your server’s IP address or domain name:
http://your-server-ip-address or http://your-domain.com
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.

Then, you will see your Nextcloud dashboard.

Conclusion
At this point, you learn to Install and Configure Nextcloud on Rocky Linux 8.
Hope you enjoy it.
You may be interested in these articles:
Install and Configure ClamAV in Linux