Install and Configure Nextcloud on CentOS / RHEL 7

Nextcloud is functionally very similar to the widely used Dropbox, with the primary functional difference being that Nextcloud is free and open-source, and thereby allowing anyone to install and operate it without charge on a private server. 

In contrast to proprietary services like Dropbox, the open architecture allows adding additional functionality to the server in form of so-called applications.

Nextcloud is an actively maintained fork of ownCloud.

Some of the Key features of Nextcloud are listed below:
  • File access & sharing 
  • Security & control 
  • Mobile & desktop clients  
  • External storage 
  • Calendar & Contacts  
  • Secure audio & video calls
  • Collabora Online Office
  • Videos of Nextcloud in action
Requirement to Install NextCloud on RHEL AND CENTOS

Minimum of 512 MB RAM
Web Server : Apache (httpd) / Nginx
Database Server : MariaDB / MySQL / PostgreSQL

PHP 5.4 +

Use the below yum command to install Apache Web Server (httpd), PHP packages and its other dependent packages.

In the default CentOS and RHEL repositories PHP 5.4 packages are available
yum install httpd 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
Start and startup enable apache web service using this command
systemctl start httpd ; systemctl enable httpd
MariaDB database for Nextcloud
yum install -y mariadb-server mariadb

Start and startup enable MariaDB service using this command
systemctl start mariadb; systemctl enable mariadb
For set MariaDB root password use the following command
After completed the MariaDB installation just create a database for next-cloud application for me my database name is "nextcloud_db".
[root@nextcloud ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.47-MariaDB MariaDB Server
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database nextcloud_db;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]>
Create a database user (nxtuser) and grant all the privileges to the user on the database "nextcloud_db"
MariaDB [(none)]> grant all on nextcloud_db.* to 'nxtuser'@'localhost' identified by 'Nextcloud@123#';
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
[root@nextcloud ~]#
Download the latest version of NextCloud

First Install two packges on your server using bellow command
yum install wget bzip2 -y
After that download the file from nextcloud official website - ClickHere
When your download is complete just extract the downloaded "nextcloud-9.0.53.tar.bz2" file to Web Server document root (/var/www/html) using bellow command.
tar -jxpvf nextcloud-9.0.53.tar.bz2 -C /var/www/html/
Set the required permissions on nextcloud directory and its sub directories and files
chown -R apache:apache nextcloud /var/www/html/nextcloud
Open the ports in firewall for nextcloud (or you can stop the firewall) using bellow command.
[root@nextcloud ~]# firewall-cmd --permanent --zone=public --add-service=http
[root@nextcloud ~]# firewall-cmd --permanent --zone=public --add-service=https
[root@nextcloud ~]# firewall-cmd --reload
In my Case I am putting selinux in disabled mod  using below command you can use it as permissive mod
setenforce 0
For Permanently disabled edit the following line and find this line"SELINUX=enforcing" to disabled
vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.

Now Access nextCloud portal from Web Browser

After Complete the nextcloud installation you can access it from your web browser using your system ip or server ip

In my case my server ip is -

Specify the user name as admin and password that you want to set, Select the Database type as MariaDB and mentioned the database name, database user and its credentials. Once you’re are done with settings then click on finish Setup.

Change the upload file size limit for nextcloud and restart the apache service
vi /etc/php.ini
post_max_size = 30M
upload_max_filesize = 30M
systemctl restart httpd
Now start uploading the files and share with your contacts and whatever you want

+Linux Tutorial

About Author:

I am a Linux Administrator and Security Expert with this site i can help lot's of people about linux knowladge and as per security expert i also intersted about hacking related news.TwitterFacebook

Newer Post
Older Post


Post a Comment