Complete Nextcloud 12 installation on CentOS 7.4

nextcloudOK, so here’s the deal. I had ownCloud up and running and was rather happy with it. I’d chosen ownCloud because I knew it from a few years back when I was looking for a Dropbox alternative for a customer. Never heard about Nextcloud before…

A few days after this installation, a few sync problems occurred on a regular basis. Files couldn’t be deleted and the uploads kept growing and growing, as did the logs. All in all not that production ready in my opinion.

That’s when I started looking for alternatives and discovered the ownCloud core development team moved to Nextcloud. So let’s install that instead!

In comes this other Dropbox alternative. Instead of troubleshooting the ownCloud problems, I decided to give this software a shot because of the positive reviews. Because it is originally a fork of ownCloud, installation is very similar. Of course I removed ownCloud first. Simply reverse the installation procedure and you’ll be solid for the most part. Don’t forget the database and database user!

Well in any case, this is not about removing ownCloud. Let us start.

Install Apache and MariaDB

# yum install mariadb-server mariadb httpd

# systemctl start httpd

# systemctl enable httpd

And the same for mariadb.

# systemctl start mariadb

# systemctl enable mariadb

# mysql_secure_installation

# firewall-cmd --permanent --zone=public --add-service=http

# firewall-cmd --permanent --zone=public --add-service=https

Restart your firewall.

# firewall-cmd --reload

Install PHP 7.1

# yum install yum-utils epel-release

# rpm -Uvh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

# yum update

# yum-config-manager --enable remi-php71

# yum install php php-opcache php-gd php-ldap php-dom php-pdo php-json php-mysql php-intl php-odbc php-pear php-xml php-xmlrpc php-mbstring php-soap php-zip php-mcrypt php-curl

That’s again a lot of PHP stuff, just like the ownCloud installation. I find it a pity that I can’t find a consensus on what modules to install and what modules are not needed. I don’t want software I don’t need. In any case, this cloud software does work with the above plugins, that’s for sure.

Create a database for Nextcloud

# mysql -u root -p

> CREATE DATABASE clouddb;

> CREATE USER clouduser@localhost IDENTIFIED BY 'password'; (put your own password in)

> GRANT ALL PRIVILEGES ON clouddb.* TO clouduser@localhost IDENTIFIED BY 'password'; (again, your own password)

> FLUSH PRIVILEGES;

> exit

Install Nextcloud

# yum install bzip2

# 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

# mv nextcloud /var/www/cloud.yourdomain.com

# chown -R apache:apache cloud.yourdomain.com

SELinux edits

# setsebool -P httpd_can_network_connect on

# setsebool -P httpd_can_sendmail on

# semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/cloud.yourdomain.com(/.*)?'

# restorecon -RF /var/www/cloud.yourdomain.com/

# systemctl restart httpd

When you are running a multiserver/site setup, you’ll have to make a couple of httpd edits (originally a WordPress link, but it’s all the same). When you want to enforce SSL, also take a look here (the original ownCloud installation, take a look at the bottom).

That’s it, now finish your configuration at http://cloud.yourdomain.com

UPDATE: I was on a roll. Be very sure to check out this followup.

4 comments Add yours
  1. best tutorial I could find on the net (other simply didn’t work for me due to incompatibility of original PHP and PHP 7.x)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.