How to install Nextcloud 11 on CentOS 7

install Nextcloud 11 on CentOS 7

Installing  Nextcloud 11 on CentOS 7 is an easy task if you follow the steps bellow. Nextcloud is an open source software for creating and using file hosting services. It has a lot of extra Calendar, Sync and Contacts features, apart from their file hosting features. It is a great free alternative to some popular services such as Google Drive, Dropbox, Box, etc. In this tutorial, we gonna show you How to install Nextcloud 11 on CentOS 7.

In order to run Nextcloud on your VPS, the following requirements have to be installed:

  • MySQL or MariaDB
  • PHP 7.0 +
  • Apache 2.4 with mod_php module

In this tutorial, we will install the latest version of Nextcloud on one of our CentOS 7 VPSes with MariaDB, PHP and Apache. If you want to use an Ubuntu VPS, check our tutorial on how to install Nextcloud on Ubuntu 16.04

Already using ownCloud? Check our tutorial on how to migrate from ownCloud to Nextcloud or get a VPS from us and we’ll do it for you, free of charge!

1. Update the system

First of all login to your CentOS 7 VPS via SSH as user root:

ssh [email protected]_Address

and make sure that it is fully up to date:

yum -y update

2. Install MariaDB server

Nextcloud requires an empty database, so we will install MariaDB server:

yum -y install mariadb mariadb-server

Once it is installed, start MariaDB and enable it to start on boot:

systemctl start mariadb
systemctl enable mariadb

and run the mysql_secure_installation post-installation script to finish the MariaDB set-up:


Enter current password for root (enter for none): ENTER
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Once MariaDB is installed, login to the database server as user root, and create database and user for Nextcloud:

mysql -u root -p

MariaDB [(none)]> CREATE DATABASE nextcloud;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextclouduser'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
MariaDB [(none)]> \q

3. Install Apache Web Server

Next, we will install Apache web server:

yum install httpd -y

start Apache and make it start on boot:

systemctl start httpd.service
systemctl enable httpd.service

4. Install PHP 7

The default PHP version on CentOS 7 is PHP 5.4. In this tutorial, we will install PHP version 7.

Install Remi and EPEL repository packages:

rpm -Uvh
rpm -Uvh

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:

yum -y install php php-mysql php-pecl-zip php-xml php-mbstring php-gd

Next, open the PHP configuration file and increase the upload file size. You can find the location of the PHP configuration file by executing the following command:

php --ini |grep Loaded
Loaded Configuration File:         /etc/php.ini

In our case, we have to make changes to the /etc/php.ini file. We will increase the default upload limit to 100 MB. You can set the values according to your needs. Run the following commands:

sed -i "s/post_max_size = 8M/post_max_size = 100M/" /etc/php.ini
sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 100M/" /etc/php.ini

and restart the web server:

systemctl restart httpd

5. Install Nextcloud

Go to Nextcloud’s official website and download the latest stable release of the application


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

unzip -d /var/www/html/

Set the Apache user to be owner of the Nextcloud files

chown -R apache:apache /var/www/html/nextcloud/

Finally, access Nextcloud at http://yourIP/nextcloud . The installation wizard will check if all requirements and if everything is OK, you will be prompted to create your admin user and select storage and database. Select MySQL/MariaDB as database and enter the details for the database we created earlier in this post:

Database user: nextclouduser
Database password: YOURPASSWORD
Database name: nextcloud
host: localhost

Of course, you don’t have to install Nextcloud 11 on CentOS 7 if you use one of our Managed Nextcloud Hosting services, in which case you can simply ask our expert Linux admins to install Nextcloud 11 on CentOS 7 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

How To Set Up Multiple SSL Certificates On a CentOS VPS With Apache Using One IP Address
How to Install NodeBB on a CentOS 7 VPS
How to Fix the Missing MySQL Extension Error in WordPress
  • Pepa


    Author Reply

    Hi, I would like to thank you for your progress. I have one problem there. When I enter yum-config-manager –enable remi-php70 so yum-config-manager tells me: command not found.
    Do not you know what I’m afraid of? Thanks in advance for your help

    • admin


      Author Reply

      Please install the ‘yum-utils’ package on your server to use ‘yum-config-manager’.

  • Papi


    Author Reply


    First let me thank you for posting this information, I followed the instructions, the only thing I changed was to download the latest stable nextcloud version 12.0.0. I’m using CentOS 64bit 7.3, I get the http ‘test webpage’ when I enter my IP, but if I include the /nextcloud, nothing shows up. Can you please guide me on how to resolve this issue.

    Thank you in advance,


    • admin


      Author Reply

      What do you mean by “nothing shows up”. Please check the web server error log file for any error messages.

      • vladifsh


        Author Reply

        Have same issue. Just blank page. Did you find a solution?

  • Runar


    Author Reply

    You need to follow this guide to every detail. Then you need to fix SELinux on your CentOs, or disable it(not recommended).
    To fix your SELinux you run this:
    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/apps(/.*)?’
    semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/.htaccess’
    semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/.user.ini’

    restorecon -Rv ‘/var/www/html/nextcloud/’

    To disable this changes you can run

    semanage fcontext -d ‘/var/www/html/nextcloud/data(/.*)?’
    semanage fcontext -d ‘/var/www/html/nextcloud/config(/.*)?’
    semanage fcontext -d ‘/var/www/html/nextcloud/apps(/.*)?’
    semanage fcontext -d ‘/var/www/html/nextcloud/.htaccess’
    semanage fcontext -d ‘/var/www/html/nextcloud/.user.ini’

    restorecon -Rv ‘/var/www/html/nextcloud/’

    This information is taken from the Nextcloud page

  • Daniel L.

    Daniel L.Daniel L.

    Author Reply

    If the browser cant reach nextcloud you have to open the firewall for this:

    # firewall-cmd –permanent –zone=public –add-service=http
    # firewall-cmd –permanent –zone=public –add-service=https
    # firewall-cmd –reload

    If you cant see the nextcloud start page you have to fix SELINUX:

    # setenforce 0

    In my case it was working after doing this.