Nextcloud

-Install CentOS7

-Disable SELinux

$ sudo vi /etc/selinux/config
#SELINUX=enforcing
SELINUX=permissive

-Install Remi's repo

$ sudo yum install http://rpms.famillecollet.com/enterprise/remi-release-7.rpm -y

http://rpms.famillecollet.com/

-Update CentOS7

$ sudo yum upgrade -y
$ sudo reboot

-Install prerequisites

$ sudo yum install php71 php71-php php71-php-fpm php71-php-gd php71-php-mbstring php71-php-mysqlnd php71-php-json php71-php-xml php71-php-pecl-zip php71-php-mcrypt php71-php-pdo php71-php-intl php71-php-pecl-crypto php71-php-ldap php71-php-gmp php71-php-pecl-imagick mariadb mariadb-server httpd mod_ssl bzip2 vim

-Start MariaDB

$ sudo systemctl start mariadb
$ sudo systemctl status mariadb
$ sudo systemctl enable mariadb
$ sudo mysql_secure_installation

-Create database and user

$ mysql -u root -p
> create database nextcloud_db;
> grant all on nextcloud_db.* to 'nextcloud_user'@'127.0.0.1' identified by 'nextcloud-pass';
> flush privileges;
> exit
$ 

-Start Apache

$ sudo systemctl start httpd
$ sudo systemctl status httpd
$ sudo systemctl enable httpd

-Configure firewalld

$ sudo firewall-cmd --get-active-zones
$ sudo firewall-cmd --zone=public --list-all
$ sudo firewall-cmd --zone=public --add-service=http --permanent
$ sudo firewall-cmd --reload
$ sudo firewall-cmd --zone=public --list-all

The option “–add-port=0/tcp” could be used instead of “–add-service=http”.

-Download Nextcloud

$ curl -O https://download.nextcloud.com/server/releases/nextcloud-11.0.1.tar.bz2

-Extract and move Nextcloud

$ sudo mkdir /var/www/nextcloud
$ sudo mkdir /var/www/nextcloud/data
$ echo "create and mount data drive"
$ sudo chown -R apache:apache /var/www/nextcloud
$ cd /var/www
$ sudo tar jxvf ~/nextcloud-11.0.1.tar.bz2
$ sudo chown -R apache:apache /var/www/nextcloud/

A separate device, such as /dev/sdb1, could be mounted to /var/www/nextcloud/data and be used as a separate “data drive”. Don't forget to update /etc/fstab so the data drive is mounted on reboot.

-Create Nextcloud http configuration

sudo vi /etc/httpd/conf.d/nextcloud.conf
Alias /nextcloud "/var/www/nextcloud/"

<Directory /var/www/nextcloud/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off
 </IfModule>

 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud

</Directory>
$ sudo systemctl restart httpd

-Start web install http://SYSTEMIP/nextcloud/

Create an admin account
USERNAME
PASSWORD
Storage & database
/var/www/nextcloud/data
Configure the database
MySQL/MariaDB
nextcloud_user
nextcloud-user
nextcloud_db
127.0.0.1

-Modify the trusted domains array if needed

 'trusted_domains' =>
  array (
    0 => '172.16.25.178',
    1 => 'nextcloud.domain.com',
  ),

-PHP post_max_size and upload_max_filesize may need to be adjusted in /etc/php.ini if large uploads are not working.

https://docs.nextcloud.com/server/11/admin_manual/installation/deployment_recommendations.html
https://docs.nextcloud.com/server/11/admin_manual/installation/selinux_configuration.html