How to Install NextCloud 14 on CentOS 7

Nextcloud is one of the most popular free and open source self-hosted file sync and sharing application. You can use it to store your personal files, contacts, pictures, music and much more and it allows you to access them or share them with your friends at any time. It is a popular alternative to another widely used file hosting application called ownCloud. In this tutorial, we will show you how to install the latest version 14 of Nextcloud on CentOS.

Prerequisite

CentOS 7

SSH access with root privileges

PHP 7 or above

Step 1: Log in to your server via SSH:

# ssh root@IP_Address -p Port_number

Before starting, enter the command below to check whether you have the proper version of CentOS installed on your machine:

# cat /etc/redhat-release

which should give you the underneath output:

CentOS Linux release 7.5.1804 (Core)

Step 2: Update the system

Make sure your server is fully up to date:

# yum update

If your system has not been updated for a while, it will take a few minutes to completed.

# yum install -y epel-release

Step 3: Install Web Server

In this step, you can choose whether you want to install Apache or nginx.

Install Nginx web server

# yum install nginx

Enable nginx to start on boot and start the service using:

# systemctl enable nginx
# systemctl start nginx

Install Apache web server

If you would like to choose Apache instead of nginx, you can skip nginx installation above then install Apache.

# yum install httpd

Enable Apache to start on boot and start the service using:

# systemctl enable httpd
# systemctl start httpd

Step 4: Install PHP 7

The default PHP version on CentOS 7 is PHP 5.4 and Nextcloud 14 requires PHP 7 or above, in this step we will install PHP version 7.

Install Remi and EPEL repository packages:

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

Enable Remi PHP 7 repo:

# yum-config-manager –enable remi-php70

and install PHP 7 and several PHP modules required by Nextcloud by executing the following command:

At this point, MariaDB is running and we are now going to create a password for the root user. Run the following command to create a root password, remove the test database, remove the anonymous user then reload the privileges.

# mysql_secure_installation

Once created, you can test the password by invoking this command, you will be asked for the password:

unpack the downloaded zip archive to the document root directory on your server

# unzip nextcloud-14.0.0.zip -d /var/www/
# mkdir /var/www/nextcloud/data
# chown -R nginx: /var/www/nextcloud
If you chose Apache, then you need to set the permission for Apache user
# chown -R apache: /var/www/nextcloud
You can now proceed with Nextcloud 14 installation via web installer at http://yourdomain.com, fill the blank as required, then click on the “Finish setup” button to finish it.

It is recommended to run the Nextcloud 14 in https mode. We will need to install an SSL certificate for this. In this step, we will show you how to install an SSL certificate from Letsencrypt.

# yum install certbot-nginx certbot-apache

# certbot

You will be asked for your email address then you need to agree with the ToS to proceed with the certificate installation.

If there is no issue when requesting the certificate, Certbot will automatically edit your existing nginx server block to install the certificate.

At this point, you can access your Nextcloud 14 installation on https://yourdomain.com

And that’s it, with the last step of this tutorial we have successfully installed Nextcloud 14 on your CentOs 7 and you can log in with the login credentials of your admin user. For more information, you can visit the official documentation of Nextcloud 14.

RoseHosting has been listed as a recommended Nextcloud hosting provider on the Nextcloud.com. If you want to try our fully managed Nextcloud VPS hosting, use the coupon code: 50FIRST to get 50% off your first-month invoice. We have 7 days money-back guarantee. If you are one of our clients, you don’t have to install Nextcloud 14 on CentOS 7, you can simply ask our system administrators to install and configure your Nextcloud instance on CentOS or any other Linux OS. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post, on How To Install Nextcloud 14 on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Please make sure that there are straight double quotes on line 9 in the nginx configuration file. It should look like this:add_header X-XSS-Protection “1; mode=block”;
instead of this:add_header X-XSS-Protection ^ ^ 1; mode=block ^ ^ ;

When you copy paste his config you get wrong quoto .
It littary says so in the error,
So go to line 9 remove quota and manualy add them again.
Then repeat, you will have to change like 3-4 time.
If using nano add -c to get row count or use “go plz kill it ” -> vim

Awesome write up! I had been running mine in a FreeBSD jail for sometime but wanted to move it to a BHYVE VM using CentOS. This write up was exactly what I needed. One note you might want to add to your write up. On a fresh install of CentOS 7 you will need to disable SELINUX otherwise you will go crazy trying to figure out why you keep getting PHP permissions denied on your Nextcloud install directory. Spent several hours on this before I realized this.

Thanks for this post. I’ve followed your instructions But I get this when I’m trying to reach the web install wizard :

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the webserver log.