Nextcloud Installation and Set-Up For Local Network Storage on CentOS8

DevOpsUPDATED ON October 8, 2020

Step-by-Step Tutorial To Installing NextCloud on CentOS8

Nextcloud is a popular Open Source local network storage and file sharing solution renowned for its security. It’s arguably the most mature, stable and secure open source cloud project, making it a popular alternative to more commercial options such as GoogleDrive, iCloud etc. DropBox for techies! The focus of this tutorial is step-by-step set-up instructions for Nextcloud, rather than a discussion of its security, but for those interested this blog post delves into the details.

CentOS8, meanwhile, is the most recent iteration of the Open Source (OS) Linux platform that provides a rich, stable base platform of OS communities to build on. It offers a development framework for cloud providers, the hosting community and scientific data processing, as just a number of examples. In this context it is CentOS’s compatibility with cloud provisioning that is most relevant. CentOS is another RedHat initiative, the Open Source specialists that have provided many of the most valuable OS Linux, cloud, container, and Kubernetes technologies and is now, as of 2019, a subsidiary of IBM.

But let’s get on with the matter in hand – getting Nextcloud set-up and ready to offer you a secure local network storage solution:

 

NextCloud Installation Tutorial

 

Step-by-Step NextCloud Set-Up

The system requirements needed to install Nextcloud on RHEL7 and CentOS8 are as follows:

1.Minimum of 512 MB RAM

2.Web Server: Apache (httpd) / Nginx

3.Database Server: MariaDB / MySQL / PostgreSQL

4.PHP 5.4 +

1.Setting up of Apache Web Server, PHP and other systems.

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

Launch and create service for Apache Web server’s using systemctl:

systemctl start httpd; systemctl enable httpd

2.Installation and setting up of MariaDB for Nextcloud

Execute command for MariaDB installation.

yum install -y mariadb-server mariadb

Launch and create MariaDB service.

systemctl start mariadb; systemctl enable mariadb

Execute the initial database configuration, set up a root password for MariaDB and other parameters. Delete a test database and remote root login.

mysql_secure_installation

Create a database called nextcloud_db. From the terminal, connect with the console mysql and execute commands.

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 user nxtuser and give him all the privileges for the base nextcloud_db.

MariaDB [(none)]> grant all on nextcloud_db.* to 'nxtuser'@'localhost' identified by '[email protected]#';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> exit
Bye

3.Downloading the latest version of Nextcloud

There’re two ways to download the latest version of Nextcloud.

1.To open Nextcloud official website https://download.nextcloud.com/server/releases/ and download the latest version.

2.To download Nextcloud directly to the server using wget.

wget https://download.nextcloud.com/server/releases/nextcloud-11.0.2.tar.bz2

Keep in mind: you should ensure that all the packages wget and bzip2 are installed on your server. If they aren’t set up, execute the following commands for their installation.

yum install wget bzip2 -y

Unwrap the downloaded Nextcloud repository tar.biz2 to root catalog of your webserver /var/www/html

tar -jxpvf nextcloud-9.0.53.tar.bz2 -C /var/www/html/

Install the necessary attributes for directory and files.

cd /var/www/html/
chown -R apache:apache nextcloud

4. Opening of necessary ports in firewall for Nextcloud

In the case the firewalld is used as a main firewall, execute the following commands.

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

Switch selinux into permissive mode.

setenforce 0

Сheck/change file /etc/sysconfig/selinux

SELINUX=permissive

5. Entering Nextcloud via web browser

 If Nextcloud was successfully installed, we get access via browser’s link and receive the invitation window.

https://IP/nextcloud

In our case it’s IP 192.168.16.40

Insert a user name and admin password. Choose MariaDB data base type and fill in the fields with the name of database, user name and password. After filling in the fields, push “Finish” button.

Installing Nextcloud on CentOS8

6. Changing file upload limits in Nextcloud (upload file size)

 

By default, you can upload files up to 2 MB. If you need to upload files larger than 2 MB, change parameters in the file /etc/php.ini. For example, let’s set up 30 MB size.

vi /etc/php.ini
...
post_max_size = 30M
upload_max_filesize = 30M
...

Restart web server.

systemctl restart httpd

7. Setting up security configuration

 

Check the following in the file /var/www/owncloud/data/ :

deny from all
IndexIgnore *

In the file /etc/httpd/httpd.conf (or in the file of your virtual Nextcloud host), check if the directives processing of .htaccess file is on.

AllowOverride All

8. Setting up WebDAV clients

If necessary, you can use WebDAV for connecting a network drive of your Nextcloud user.

For OS Linux

In Nautilus (the file browser), select File > Connect to … and select WebDAV. Enter the information you need, such as a host name, a directory, port and username. Check the box to create a bookmark, and you’ll find it in your Files and Folder lense and in the left pane in Nautilus.

You’ll be able to use your WebDAV share as if it were a local folder.

 

For Windows clients

Firstly, you need to amend register, make changes in data for processing authorization policy:

 

run -> regedit

HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesWebClientParameters

A key: BasicAuthLevel, set up a value 2

Restart the system and connect a network drive:

Choose the necessary drive and indicate the way in the field “Folder”:

http://192.168.16.40/nextcloud/remote.php/webdav

Unlike Linux connection, the indicated way should be a bit different.

Now you know how to add more room for your data using the possibilities of CentOS7. Give this a try and experience the benefits of Nextcloud local network storage.

 

You should now have a super-secure local network storage solution for all of your internal storage and file sharing needs. And without the costs of a secure commercial, public alternative like DropBox, for which expenses can quickly mount up if being used by a large team.
[text_on_the_background title=”K&C – Creating Beautiful Technology Solutions For 20+ Years . Can We Be Your Competitive Edge?”]Drop us a line to discuss your needs or next project.
Contact Us HERE[/text_on_the_background]

Related Service

Kubernetes Consulting, Training, Support & Management

Read more >

DevOps services – consulting and development – neashore teams

Read more >

QA Consulting and Software Testing

Read more >