In this tutorial we’ll learn how to install NextCloud on CentOS 7. We will also install and configure its prerequisites. NextCloud is a platform for collaboratively sharing files, documents, calendars and contacts between devices and individuals. With NextCloud installed, you can replace Dropbox and Google services with those you host yourself, respecting the autonomy and privacy of your data. NextCloud works with all major operating systems and mobile platforms. NextCloud provides user friendly web interface, so you can easily access your files through web browser from public and private network or from any device.
I recommend to use a minimal Ubuntu server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.
Install Nextcloud on CentOS 7
Step 1. First, ensure your system is fully up-to-date by running the following:
yum -y update
Step 2. Installing LAMP on CentOS 7.
You should check out this LAMP stack install tutorial for CentOS 7, if you haven’t installed LAMP yet. Once it’s installed, come back here and read on. We also will install the required packages for LAMP stack and the important PHP extension that NextCloud relies on:
yum install php70w php70w-dom php70w-mbstring php70w-gd php70w-pdo php70w-json php70w-xml php70w-zip php70w-curl php70w-mcrypt php70w-pear
Step 3. Installing NextCloud.
Go to Nextcloud’s official website and download the latest stable release of the application:
cd /var/www/html curl -o nextcloud-12-latest.tar.bz2 https://download.nextcloud.com/server/releases/latest-12.tar.bz2 tar -xvjf nextcloud-12-latest.tar.bz2 mkdir nextcloud/data chown -R apache:apache nextcloud rm nextcloud-12-latest.tar.bz2
Step 4. Configure Database for NextCloud.
Next, we need to create a database for the Nextcloud installation:
mysql -uroot -p
Run the following command to create a database for NextCloud:
MariaDB [(none)]> CREATE DATABASE nextcloud; MariaDB [(none)]> GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost' IDENTIFIED BY 'strong_password'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> \q
Step 5. Configure Apache for NextCloud.
Now we need to create a new file in /etc/httpd/conf.d/nextcloud.conf:
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/nextcloud SetEnv HTTP_HOME /var/www/html/nextcloud </Directory>
Once done it’s time restart Apache in order to put your changes into effect:
systemctl start httpd systemctl enable httpd
Step 6. Configure Firewall for NextCloud.
Modify firewall rules in order to allow access for visitors:
firewall-cmd --zone=public --permanent --add-service=http firewall-cmd --zone=public --permanent --add-service=https firewall-cmd --reload
Step 7. Accessing NextCloud Web Installation.
Now you can access the Nextcloud web install wizard in your browser by entering the domain name or http://your_ip/nextcloud/ to continue your Nextcloud installation.
Congratulation’s! You have successfully configured NextCloud on your CentOS 7 server.