Install Nextcloud (Drop-in replacement for ownCloud) – Next generation file sharing Server on CentOS/RHEL/Fedora

Modify PHP setting as per Nextcloud recommendation. Initially find the loaded php.ini file by firing the below command. This will print the loaded php.ini configuration file location.

$ php -i | grep "Loaded Configuration File"
Loaded Configuration File => /path to/php.ini

Modify the php.ini settings to your system based on Nextcloud recommendation. Make sure, you have to take a backup of php.ini file before modification for best practice.

$ sudo cp /etc/php.ini /etc/php.ini.bak
$ sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php.ini
$ sudo sed -i "s/;date.timezone.*/date.timezone = Asia/Kolkata/" /etc/php.ini
$ sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 200M/" /etc/php.ini
$ sudo sed -i "s/post_max_size = .*/post_max_size = 200M/" /etc/php.ini

Configure MariaDB database for Nextcloud

For Production environment, Nextcloud strongly recommended to use MariaDB to get the best performance. Follow the below steps to create the MariaDB Database with required details such as (DB Name, DB User Name, DB password).

In my case DB Name : nextcloud_db, DB User : nextcloud_user & Password : 12345. I advise users to set hard and guess password.

$ sudo mysql -u root -p
Enter password: ******

MariaDB [(none)]> create database nextcloud_db;
Query OK, 1 row affected (0.01 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON nextcloud_db.* TO 'nextcloud_user'@'localhost' IDENTIFIED BY '12345';
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

Download Nextcloud archive file

Visit Nextcloud download page and grep the latest release.

$ cd /tmp
$ wget https://download.nextcloud.com/server/releases/nextcloud-10.0.0.tar.bz2
$ tar -xjvf nextcloud-10.0.0.tar.bz2
$ sudo mv nextcloud /var/www/html/
$ sudo chown -R apache:apache /var/www/html/nextcloud/

open the ports in firewall for nextcloud

Allow remote clients to access the nextcloud on RHEL 7/CentOS 7/Fedora.

$ sudo firewall-cmd --permanent --zone=public --add-service=http
$ sudo firewall-cmd --permanent --zone=public --add-service=https
$ sudo firewall-cmd --reload

Allow remote clients to access the nextcloud on RHEL 6 & CentOS 6 systems.

$ sudo iptables -I INPUT -p tcp --dport 80 -j ACCEPT
$ sudo iptables -I INPUT -p tcp --dport 443 -j ACCEPT
$ sudo service iptables save

About Magesh Maruthamuthu

Love to play with all Linux distribution

View all posts by Magesh Maruthamuthu

Leave a Reply

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