Install NextCloud 10.X on CentOS 7 Minimal


  • Service Provider

    As with my guide for installing ownCloud on CentOS 7, here is a guide for installing NextCloud 10 on CentOS 7.

    This is not a migration guide. I will be writing one though when I migrate my production systems.

    #Update centos
    yum -y update
    
    #install firewall (assuming r1511 minimal) and helper packages
    yum install -y wget nano firewalld
    
    #install EPEL
    yum install -y epel-release
    
    #start the firewall and enable it on reboot
    systemctl start firewalld
    systemctl enable firewalld
    
    #Install all required and optional packages
    yum -y install httpd mariadb mariadb-server php php-gd php-pdo php-pear php-mbstring php-xml php-pear-Net-Curl php-mcrypt php-intl php-ldap php-smbclient php-imap php-mysql php-pear-MDB2 php-pear-MDB2-Driver-mysqli bzip2
    
    #Create directory
    mkdir -p /var/www/html/nextcloud
    
    #Get NextCloud
    wget https://download.nextcloud.com/server/releases/nextcloud-10.0.1.tar.bz2
    
    #Extract NextCloud
    tar xvf nextcloud-10.0.1.tar.bz2 -C /var/www/html
    
    #Create directories not created by extract
    mkdir -p /var/www/html/nextcloud/data
    mkdir -p /var/www/html/nextcloud/etc
    mkdir -p /var/www/html/nextcloud/assets
    
    #get the nextcloud apache config file
    wget -O /etc/httpd/conf.d/nextcloud.conf https://raw.githubusercontent.com/nextcloud/server-packages/master/centos/nextcloud.conf
    
    #default everything to root:apache
    chown -R root:apache /var/www/html/nextcloud/.
    
    #set default directory and file permissions
    find /var/www/html/nextcloud -type d -exec chmod 0750 {} \;
    find /var/www/html/nextcloud -type f -exec chmod 0640 {} \;
    
    #change ownership of folders and files
    chmod 0755 /var/www/html/nextcloud
    chmod 0755 /var/www/html/nextcloud/occ
    chown apache:apache /var/www/html/nextcloud/occ
    chmod 0644 /var/www/html/nextcloud/.htaccess
    chown apache:apache /var/www/html/nextcloud/.htaccess
    find /var/www/html/nextcloud/apps -exec chmod 0750 {} \;
    chown -R apache:apache /var/www/html/nextcloud/apps
    find /var/www/html/nextcloud/assets -exec chmod 0750 {} \;
    chown -R apache:apache /var/www/html/nextcloud/assets
    find /var/www/html/nextcloud/updater -exec chmod 0750 {} \;
    chown -R apache:apache /var/www/html/nextcloud/updater
    find /var/www/html/nextcloud/data -exec chmod 0755 {} \;
    chown -R apache:apache /var/www/html/nextcloud/data
    find /var/www/html/nextcloud/config -exec chmod 0755 {} \;
    chown -R apache:apache /var/www/html/nextcloud/config
    
    #open the firewall for http/https
    firewall-cmd --zone=public --add-port=http/tcp --permanent
    firewall-cmd --zone=public --add-port=https/tcp --permanent
    firewall-cmd --reload
    
    #start the mariadb and set to start on boot
    systemctl start mariadb
    systemctl enable mariadb
    
    #setup mariadb
    mysql_secure_installation
    
    #Create db and db user
    mysql -uroot -p
    create database nextcloud;
    create user 'ncuser'@'localhost' identified by 'ncuserpassword';
    grant all on nextcloud.* to 'ncuser'@'localhost';
    flush privileges;
    exit
    
    #Disable SELinux for now
    setenforce 0
    
    #Restart Apache and enable for reboot.
    systemctl restart httpd
    systemctl enable httpd
    

    Now point your browser to the IP or DNS name of your NextCloud instance and fill things out appropriately. I'll do screenshots later.


  • Service Provider

    Post to be updated with SELinux instructions.


  • Service Provider

    Post to be updated with setting up SSL.


  • Service Provider

    And ready to log in.
    0_1475465705539_upload-16865fd1-fb00-462b-940f-9969f19b3580



  • Thanks for the guide, works perfect.

    Any solution to avoid enter setenforce 0 after restart the server?



  • Check /etc/selinux/conf

    change the line that says:

    selinux = enforcing

    to

    selinux = permissive


  • Service Provider

    @dafyre said in Install NextCloud 10.X on CentOS 7 Minimal:

    Check /etc/selinux/conf

    change the line that says:

    selinux = enforcing

    to

    selinux = permissive

    Never.


  • Service Provider

    @iroal said in Install NextCloud 10.X on CentOS 7 Minimal:

    Thanks for the guide, works perfect.

    Any solution to avoid enter setenforce 0 after restart the server?

    Look at my ownCloud Guide. I expect it to be basically the same. But I have not had time to test it yet.
    https://mangolassi.it/topic/6938/install-owncloud-8-x-on-centos-7



  • @JaredBusch said in Install NextCloud 10.X on CentOS 7 Minimal:

    Post to be updated with setting up SSL.

    sudo yum install python-certbot-apache
    sudo certbot --apache
    

    Accept defaults in certbot, and I forget the update options off the top of my head.


  • Service Provider

    Worked like a charm. NextCloud 10 on CentOS 7 is up and running.


  • Service Provider

    @travisdh1 said in Install NextCloud 10.X on CentOS 7 Minimal:

    @JaredBusch said in Install NextCloud 10.X on CentOS 7 Minimal:

    Post to be updated with setting up SSL.

    sudo yum install python-certbot-apache
    sudo certbot --apache
    

    Accept defaults in certbot, and I forget the update options off the top of my head.

    Just FYI for anyone finding this thread. The above does not work because there is not a vhost file.

    Call certbot like this.

    certbot --apache --email [email protected] --domain nexcloud.domain.com --agree-tos --non-interactive


Looks like your connection to MangoLassi was lost, please wait while we try to reconnect.