How to Install NextCloud on CentOS 8

Install NextCloud on CentOS 8

In this article, we will have explained the necessary steps to install and configure NextCloud on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Nextcloud is an open-source file sharing and hosting solution. It is like a Google Drive / Dropbox that permits you to store, collaborate, and share documents, pictures, and videos within your organization. If you worry about privacy, you can switch to NextCloud, which you can install on your private home server or on a virtual private server (VPS). You can upload your files to your server via NextCloud and then sync those files to your desktop computer, laptop, or smartphone. This way, you have full control of your data.

Install NextCloud on CentOS 8

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo dnf update

Step 2. Install LAMP stack on CentOS server.

It is assumed that you have already installed the LAMP stack on CentOS 8. If not, please check out the following tutorial:

Step 3. Download and Install NextCloud on the CentOS system.

Now download the NextCloud zip archive from the official website:


After that downloaded, extract the archive with unzipping:

sudo unzip nextcloud-21.0.0 -d /var/www/html/

Set the directory permissions:

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

Step 4. Creating a MariaDB database for NextCloud.

NextCloud uses the MariaDB database to store all its data like posts, pages, users, plugins, and themes settings. Log in to your MariaDB server with the following command and enter your MariaDB root password:

mysql -u root -p

Once you’re in the MariaDB console, create a new database:

MariaDB > create database nextcloud;
MariaDB > create user [email protected] identified by 'your--strong--passwd';
MariaDB > grant all privileges on nextcloud.* to [email protected] identified by 'your-passwd';
MariaDB > flush privileges;
MariaDB > exit;

Step 5. Configure Apache.

Now configure Apache server to host Nextcloud. Create a configuration file with an Alias to Nextcloud directory:

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

Add below lines:

Alias /nextcloud"/var/www/html/nextcloud"<Directory /var/www/html/nextcloud>  Options +FollowSymlinks  AllowOverride All<IfModule mod_dav.c>  Dav off</IfModule>SetEnv HOME /var/www/html/nextcloudSetEnv HTTP_HOME /var/www/html/nextcloud</Directory>

Save the file and close it. Now, restart the Apache service to reload changes:

sudo systemctl restart httpd

Step 6. Configure Firewall.

To allow external users to access NextCloud from your server, you need to open the webserver port 80:

sudo firewall-cmd --add-port=80/tcp --zone=public --permanent
sudo firewall-cmd --reload

Step 7. Accessing Nextcloud.

Now you can access the Nextcloud web install wizard in your browser by entering the domain name for your Nextcloud installation:


That’s all you need to do to install NextCloud on CentOS 8. I hope you find this quick tip helpful. For further reading on NextCloud, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.