YouTube Icon

Code Playground.

How to Install and Configure Nextcloud with Apache on CentOS 7


How to Install and Configure Nextcloud with Apache on CentOS 7

Nextcloud is an open-source, self-facilitated record offer and cooperation stage, like Dropbox. It comes packaged with media player, schedule and contact the board. 

Nextcloud is extensible by means of applications and has work area and portable customers for every single significant stage. 

This instructional exercise will walk you through the way toward introducing and arranging Nextcloud with Apache on a CentOS 7 framework. 


Prior to beginning with the instructional exercise, ensure you are signed in as a client with sudo advantages . 

Step 1: Creating MySQL Database

NextCloud can utilize SQLite, PostgreSQL or MySQL information base to store all its information. 

In this instructional exercise we will utilize MySQL as the information base of decision. 

In the event that you as of now don't have MySQL or MariaDB introduced on your CentOS worker you can introduce by adhering to one of the directions beneath: 

Introduce MySQL on CentOS 7 

Introduce MariaDB on CentOS 7 

Start by logging to the MySQL shell by composing the accompanying order: 

sudo mysql

Run the accompanying SQL explanations to make an information base named nextcloud, client named nextclouduser and to allow the important advantages to the client: 

CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'change-with-strong-password';

Step 2: Installing PHP and Apache

Nextcloud is a PHP application. CentOS 7 boats with PHP 5.4 which isn't upheld by Nextcloud. 

We will introduce PHP 7.2 from the Remi storehouse. The orders underneath will empower EPEL and Remi archives: 

sudo yum install epel-release yum-utils
sudo yum install
sudo yum-config-manager --enable remi-php72

When the vaults are empowered introduce Apache PHP 7.2 and all necessary PHP augmentations with the accompanying order: 

sudo yum install httpd php php-gd php-json php-mysql php-curl php-mbstring php-intl php-mcrypt php-imagick php-xml php-zip

Step 3: Configuring firewall

On the off chance that you are running Firewall on your CentOS worker, you'll need to open HTTP (80) and HTTPS (443) ports. 

You can do that by running the accompanying orders: 

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload

Stage 4: Downloading Nextcloud 

Download the most recent rendition of Nextcloud from the Nextcloud download page with wget : 

wget -P /tmp

At the hour of composing this article, the most recent adaptation of Nextcloud is variant 15.0.0. 

Once the download is finished, extricate the file to the/var/www index: 

sudo unzip /tmp/  -d /var/www

Set the right possession so the Apache web worker can have full admittance to the Nextcloud's documents and catalogs: 

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

Step 5: Configure Apache

Open your content tool and make the accompanying Apache design document. 

owOverride All

 <IfModule mod_dav.c>
  Dav off

 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud


Enact the progressions by restarting Apache administration: 

sudo systemctl restart httpd

Step 6: Installing Nextcloud

Since Nextcloud is downloaded and all essential administrations are arranged open you program and start the Nextcloud establishment by visiting your worker's space name or IP address followed by/nextcloud : 


You will be given the Nextcloud arrangement page. 

Enter your ideal administrator username and secret phrase and the MySQL client and information base subtleties you recently made. 

Snap on the Finish arrangement button and once the establishment cycle is finished you will be diverted to the Nextcloud dashboard signed in as administrator client. 


You have figured out how to introduce and design Nextcloud on your CentOS 7 machine. On the off chance that you have a space name related with your Nextcloud worker, you can follow this guide and secure your Apache with Let's Encrypt . 

To discover more data about how to deal with your Nextcloud occurrence visit the Nextcloud documentation page. 

In the event that you have any inquiries, it would be ideal if you leave a remark underneath.