How to install Nextcloud 11 on CentOS 7

How to install Nextcloud 11 on CentOS 7

We’ll show you How to install Nextcloud 11 on CentOS 7.  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. Installing  Nextcloud 11 on CentOS 7 is an easy task if you carefully follow the steps bellow.

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

[ecko_alert color=”blue”]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![/ecko_alert]

1. Update the system

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

ssh root@IP_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:

mysql_secure_installation

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)]> FLUSH PRIVILEGES;
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 http://rpms.remirepo.net/enterprise/remi-release-7.rpm
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.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:

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 11

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

wget https://download.nextcloud.com/server/releases/nextcloud-11.0.2.zip

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

unzip nextcloud-11.0.2.zip -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

how to install nextcloud 11 on centos 7Of 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. You can also read our newer post on How to Install NextCloud 14 on CentOS 7.

PS. If you liked this post, on how to install Nextcloud 11 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.

17 thoughts on “How to install Nextcloud 11 on CentOS 7”

  1. 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

    Reply
  2. Guys,

    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,

    Papi

    Reply
  3. 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

    Reply
  4. 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
    SELINUX=permissive

    In my case it was working after doing this.

    Reply
  5. Can’t write into config directory!

    This can usually be fixed by giving the webserver write access to the config directory.

    What is wrong ?

    Reply
  6. hi,

    help me to figure out this error, i tried to test it but i encountered this error below. i’m trying to use nextcloud for zimbraDrive. Is there any way to solved this error

    [OK] Zimbra Drive app installation test : Zimbra Drive app is installed.

    [OK] Enabled Zimbra’s users test : Zimbra’s users are enabled.

    [OK] Enabled Zimbra’s user login : Zimbra Drive authentication is enabled.

    [OK] Is server url set test : The server url is set.

    [OK] Is server port set test : The server port is set.

    [OK] Zimbra host connection test : Zimbra Drive app can reach the host.

    [FAILED] Zimbra authentication page connection test : Impossible to connect to Zimbra ( response http code: 400; url = http://192.x.x.x.:443 )

    [FAILED] Zimbra Drive extension connection test : Impossible to connect to Zimbra Drive extension (response http code: 400 )

    Reply
  7. Hi,

    I tried to access the next cloud using the IP address but I get this error

    “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.”

    Reply
      • Hi,

        This is the log, I dont know if this is helpful

        [Wed Sep 26 15:12:43.391562 2018] [lbmethod_heartbeat:notice] [pid 991] AH02282: No slotmem from mod_heartmonitor
        [Wed Sep 26 15:12:44.887853 2018] [mpm_prefork:notice] [pid 991] AH00163: Apache/2.4.6 (CentOS) PHP/7.0.31 configured -- resuming normal operations
        [Wed Sep 26 15:12:44.887918 2018] [core:notice] [pid 991] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
        [Wed Sep 26 15:38:46.500400 2018] [mpm_prefork:notice] [pid 991] AH00170: caught SIGWINCH, shutting down gracefully
        [Wed Sep 26 15:39:47.124917 2018] [suexec:notice] [pid 977] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
        [Wed Sep 26 15:39:47.199453 2018] [auth_digest:notice] [pid 977] AH01757: generating secret for digest authentication ...
        [Wed Sep 26 15:39:47.200217 2018] [lbmethod_heartbeat:notice] [pid 977] AH02282: No slotmem from mod_heartmonitor
        [Wed Sep 26 15:39:49.111352 2018] [mpm_prefork:notice] [pid 977] AH00163: Apache/2.4.6 (CentOS) PHP/7.0.32 configured -- resuming normal operations
        [Wed Sep 26 15:39:49.111391 2018] [core:notice] [pid 977] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
        [Wed Sep 26 15:52:12.884026 2018] [:error] [pid 1319] [client 192.168.1.165:43824] PHP Fatal error: Uncaught Error: Call to undefined function OC\\Log\\json_encode() in /var/www/html/nextcloud/lib/private/Log/File.php:129\nStack trace:\n#0 /var/www/html/nextcloud/lib/private/Log.php(325): OC\\Log\\File->write('PHP', 'Error: Call to ...', 3)\n#1 /var/www/html/nextcloud/lib/private/Log.php(218): OC\\Log->writeLog('PHP', 'Error: Call to ...', 3)\n#2 /var/www/html/nextcloud/lib/private/Log.php(130): OC\\Log->log(3, 'Error: Call to ...', Array)\n#3 /var/www/html/nextcloud/lib/private/Log/ErrorHandler.php(81): OC\\Log->critical('Error: Call to ...', Array)\n#4 [internal function]: OC\\Log\\ErrorHandler::onException(Object(Error))\n#5 {main}\n thrown in /var/www/html/nextcloud/lib/private/Log/File.php on line 129
        [Wed Sep 26 15:52:12.884177 2018] [:error] [pid 1319] [client 192.168.1.165:43824] PHP Fatal error: Uncaught Error: Call to undefined function OC\\Log\\json_encode() in /var/www/html/nextcloud/lib/private/Log/File.php:129\nStack trace:\n#0 /var/www/html/nextcloud/lib/private/Log.php(325): OC\\Log\\File->write('PHP', 'Uncaught Error:...', 3)\n#1 /var/www/html/nextcloud/lib/private/Log.php(218): OC\\Log->writeLog('PHP', 'Uncaught Error:...', 3)\n#2 /var/www/html/nextcloud/lib/private/Log.php(130): OC\\Log->log(3, 'Uncaught Error:...', Array)\n#3 /var/www/html/nextcloud/lib/private/Log/ErrorHandler.php(68): OC\\Log->critical('Uncaught Error:...', Array)\n#4 [internal function]: OC\\Log\\ErrorHandler::onShutdown()\n#5 {main}\n thrown in /var/www/html/nextcloud/lib/private/Log/File.php on line 129
        [Wed Sep 26 16:16:29.806372 2018] [:error] [pid 1322] [client 192.168.1.165:44124] PHP Fatal error: Uncaught Error: Call to undefined function OC\\Log\\json_encode() in /var/www/html/nextcloud/lib/private/Log/File.php:129\nStack trace:\n#0 /var/www/html/nextcloud/lib/private/Log.php(325): OC\\Log\\File->write('PHP', 'Error: Call to ...', 3)\n#1 /var/www/html/nextcloud/lib/private/Log.php(218): OC\\Log->writeLog('PHP', 'Error: Call to ...', 3)\n#2 /var/www/html/nextcloud/lib/private/Log.php(130): OC\\Log->log(3, 'Error: Call to ...', Array)\n#3 /var/www/html/nextcloud/lib/private/Log/ErrorHandler.php(81): OC\\Log->critical('Error: Call to ...', Array)\n#4 [internal function]: OC\\Log\\ErrorHandler::onException(Object(Error))\n#5 {main}\n thrown in /var/www/html/nextcloud/lib/private/Log/File.php on line 129
        [Wed Sep 26 16:16:29.806524 2018] [:error] [pid 1322] [client 192.168.1.165:44124] PHP Fatal error: Uncaught Error: Call to undefined function OC\\Log\\json_encode() in /var/www/html/nextcloud/lib/private/Log/File.php:129\nStack trace:\n#0 /var/www/html/nextcloud/lib/private/Log.php(325): OC\\Log\\File->write('PHP', 'Uncaught Error:...', 3)\n#1 /var/www/html/nextcloud/lib/private/Log.php(218): OC\\Log->writeLog('PHP', 'Uncaught Error:...', 3)\n#2 /var/www/html/nextcloud/lib/private/Log.php(130): OC\\Log->log(3, 'Uncaught Error:...', Array)\n#3 /var/www/html/nextcloud/lib/private/Log/ErrorHandler.php(68): OC\\Log->critical('Uncaught Error:...', Array)\n#4 [internal function]: OC\\Log\\ErrorHandler::onShutdown()\n#5 {main}\n thrown in /var/www/html/nextcloud/lib/private/Log/File.php on line 129
        [Wed Sep 26 16:46:02.577191 2018] [mpm_prefork:notice] [pid 977] AH00171: Graceful restart requested, doing restart

        Reply
  8. Hi

    Please help me, these are the error on the log in the nextcloud. I can ping any website but still these are the error i already check the Zimbra side ok/

    internet_connection_check GuzzleHttp\Exception\ConnectException: cURL error 35: Peer reports incompatible or unsupported protocol version.

    /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/RequestFsm.php - line 103: GuzzleHttp\Exception\RequestException wrapException(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Ring\Exception\ConnectException))
    /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/RequestFsm.php - line 132: GuzzleHttp\RequestFsm->__invoke(Object(GuzzleHttp\Transaction))
    /var/www/html/nextcloud/3rdparty/react/promise/src/FulfilledPromise.php - line 25: GuzzleHttp\RequestFsm->GuzzleHttp\{closure}(*** sensitive parameters replaced ***)
    /var/www/html/nextcloud/3rdparty/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php - line 55: React\Promise\FulfilledPromise->then(Object(Closure), NULL, NULL)
    /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/Message/FutureResponse.php - line 43: GuzzleHttp\Ring\Future\CompletedFutureValue->then(Object(Closure), NULL, NULL)
    /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/RequestFsm.php - line 134: GuzzleHttp\Message\FutureResponse proxy(Object(GuzzleHttp\Ring\Future\CompletedFutureArray), Object(Closure))
    /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/RequestFsm.php - line 132: GuzzleHttp\RequestFsm->__invoke(Object(GuzzleHttp\Transaction))
    /var/www/html/nextcloud/3rdparty/react/promise/src/FulfilledPromise.php - line 25: GuzzleHttp\RequestFsm->GuzzleHttp\{closure}(*** sensitive parameters replaced ***)
    /var/www/html/nextcloud/3rdparty/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php - line 55: React\Promise\FulfilledPromise->then(Object(Closure), NULL, NULL)
    /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/Message/FutureResponse.php - line 43: GuzzleHttp\Ring\Future\CompletedFutureValue->then(Object(Closure), NULL, NULL)
    /var/www/html/nextcloud/3rdparty/guzzlehttp/guzzle/src/RequestFsm.php - line 134: GuzzleHttp\Message\FutureResponse proxy(Object(GuzzleHttp\Ring\Future\CompletedFutureArray), Object(Closure))

    Reply

Leave a Comment