NextCloud on Centos 7 in a VPS

Table of Contents

NextCloud will replace both Google Photos, Google Drive, Dropbox, and OneDrive. It will sync your devices and it will backup your photos. I have a lot of documents I need to move, i want to get them from all my devices, this makes it super easy. Yes Nextcloud offers a lot more but this is what i'm going to use it for. It is secure when you follow their best practices. They I have depolyed NextCloud 16 inside of CentOS 7, MariaDB, Redis.

I am using this for my family using both android, iphone, windows, Mac, and Linux servers.

For hosting I pick contrab in germany for my hosting provider. To backup this provider I use rclone going to backblaze b2.

CentOS first install

The first step is to update your server, remember keeping it updated is a good security policy. With CentOS this is easy

yum -y update


Next we need to install the epel \(extra packagages for enterprise linux\) repo.

yum install epel-release

rpm -Uvh

Now lets get the software we need installed, these are the apache server, php 72 and addons...

yum install httpd php72w php72w-dom php72w-mbstring php72w-gd php72w-pdo php72w-json php72w-xml php72w-zip php72w-curl php72w-pear php72w-intl setroubleshoot-server bzip2


One of the most important parts of this, is our database. We are going to use MariaDB

yum install mariadb-server php72w-mysql

systemctl start mariadb

systemctl enable mariadb

This will start the secure installation of your MySQL server


NextCloud 16

It's time to get and install our NextCloud server. Up till now we are just preparing to install the actuall server, now we will install it.

cd /var/www/html

curl -o

tar xvjf nextcloud-16-latest.tar.bz2

mkdir nextcloud/data

chown -R apache:apache nextcloud

rm -f nextcloud-16-latest.tar.bz2


I keep SELINUX on you can turn it off, if you keep it on NextCloud will need the following setup.

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/data(/.*)?'

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?'

semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/.user.ini'

restorecon -Rv '/var/www/html/nextcloud/'

setsebool -P httpd_can_network_connect_db 1

Fire up Apache

Now it is time to start Apache, launch our server

systemctl start httpd

systemctl enable httpd

Open the firewall to allow our services

firewall-cmd --add-service http --permanent

firewall-cmd --add-service https --permanent

Jason L. Esman avatar
Jason L. Esman
An experienced senior managed service engineer with 20+ years of knowledge in operations and technology management. I am passionate about working to create efficient, scalable, and repeatable technology and support delivery models. I’ve been heavily involved in ITSM/ITIL providing leadership for the development and implementation of Change Management, Problem Management, and Incident Management.
comments powered by Disqus