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 https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
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
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.
curl -o nextcloud-16-latest.bar.bz2 https://download.nextcloud.com/server/releases/nextcloud-16.0.1.tar.bz2
tar xvjf nextcloud-16-latest.tar.bz2
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