How to Install and Configure Nextcloud on CentOS 7 / RHEL 7

Pradeep Kumar

I am a huge fan of open source and love to share How To's tutorials on Linux, Cloud and DevOps. I have been working as Linux Consultant, Cloud & DevOps Engineer since 2010

You may also like...

10 Responses

  1. Joe Bill Schirtzinger says:

    These instructions worked well. If you have another server like nginx running, be sure to go into apache.config and change the port to something else for the apache webserver to run along with making a rule for the firewall for apache.

  2. jl says:

    Setting up a Server to permissive mode is a bad idea. Refer to the SELINUX section of NextCloud Admin guide for proper apps, data and config folder permissions.

    • Hello Jl ,

      Thanks for the Comments, In Case SELINUX is enabled on your Linux box, One should run the beneath commands as root .

      [root@nextcloud ~]# semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/data’
      [root@nextcloud ~]# restorecon ‘/var/www/html/nextcloud/data’
      [root@nextcloud ~]# semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/config’
      [root@nextcloud ~]# restorecon ‘/var/www/html/nextcloud/config’
      [root@nextcloud ~]# semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/html/nextcloud/apps’
      [root@nextcloud ~]# restorecon ‘/var/www/html/nextcloud/apps’

  3. Vinit says:

    I have configure the same steps but when i access webpage from other pc it shows me some php scripts instead of that blue page of login…please guide

    • Ben says:

      Try the following via command line:

      php -v

      If nothing pulls through sounds like PHP isn’t installed or installed correctly. Try the following:

      yum install php php-mysql sqlite php-dom php-mbstring php-gd php-pdo php-json php-xml php-zip php-gd curl php-curl php-mcrypt php-pear -y

      if that doesn’t work try the following:

      yum install epel-release -y

      yum install php php-mysql sqlite php-dom php-mbstring php-gd php-pdo php-json php-xml php-zip php-gd curl php-curl php-mcrypt php-pear -y

  4. Mario says:

    Hello. Just for your information when use version 10 of nextcloud (i dont know if those errors in version 9 exist).

    When you do:
    Create a database user (nxtuser) and grant all the privileges to the user on the database ‘nextcloud_db‘

    Then you will get in log file this:
    Database creation failed: An exception occurred while executing ‘GRANT ALL PRIVILEGES ON `nextcloud_db` . * TO ‘nxtuser”: SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user ‘nxtuser’@’localhost’ to database ‘nextcloud_db’

    You dont have to create a DB User. Just for the first time you start the installation wizzard, use the DB root user and password.
    Then all is fine 🙂

    It will generate a database user and random password. You can find it then in nexcloud installation folder /var/www/html/nextcloud/config/config.php (or where you installed it)

    i.e. you choose the admin user in the wizzard with username “admin” then the database user “oc_admin” been create with the random password.

    No errors then in log so far.

    People who want to use php5.5 can use Red Hat Software Collections (SCL) repository.
    ‘https://docs.nextcloud.com/server/10/admin_manual/installation/php_55_installation.html’

  5. Yoel Gutierrez says:

    Hello I have a weird problem, I set up everything and is working good. I install the NextCloud in a VM locally in my home. Setup HTTPS redirection and it is working perfectly when I am outside my home and everything seems to be working perfectly. But, the thing is if I access my cloud thru my domain, (cloud.mydomain.com) out of my local network, work perfectly. the problem is when I get home I cant do it that way. if I open the browser and type ‘https://cloud.mydomain.com’ it never get to the nextcloud. but If I type my local ip address in the address bar of the NextCloud Server it opens perfectly. witch it like anoying everytime I get home remove the domain name and login with my local ip address.

    Please HELP I am frustrated

    • Hello Yoel ,

      Problem seems to be DNS server, Please check the DNS server ip of your machine at your home. Work around is that you can update the hosts file of your system set the below entries :

      ‘ip -Address-of-nextcloud’ cloud.mydomain.com

  6. Ben says:

    Great tutorial! Much appreciated.
    Will definitely be looking to enable SELinux without any interference though.

  7. Oppa says:

    If you want to use UTF8 4-byte characters such as Emojis on your server, the database needs to be created with character set utf8mb4 and collate utf8mb4_general_ci, e.g.:

    CREATE DATABASE nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

    copied from it’s official page (system requirements).

Leave a Reply

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