Nextcloud is a free (Open Source) Dropbox-like software, a fork of the ownCloud project. Nextcloud is written inphp and javascript, it supports many database systems such as, mysql/MariaDB, PostgreSQL, Oracle Database and SQLite. In order to keep your files synchronized between Desktop and your own server, Nextcloud provides applications for windows, linux and Mac desktops and a mobile app for android and iOS. Nextcloud is not just a dropbox clone, it provides additional features like Calendar, Contacts, Schedule tasks, and streaming media with Ampache.

In this tutorial, I will show you how to install and configure the latest Nextcloud 10 release on a CentOS 7 server. I will run Nextcloud with a Nginx web server and PHP7-FPM and use MariaDB as the database system.

The MariaDB root password has been set, now we can login to the mysql shell to create a new database and a new user for Nextcloud. I will create a new database named ' nextcloud_db ' and a user ' nextclouduser ' with password ' [email protected] '. Choose a secure password for your installation!

mysql -u root -p

Type Password

Type in the mysql query below to create a new database and a new user.

grant all privileges on nextcloud_db.* to[emailprotected] identified by '[email protected]';

flush privileges;

The nextcloud_db database with user 'nextclouduser' has been created.

Step 4 - Generate a Self-signed SSL Certificate for Nextcloud

In this tutorial, I will run nextcloud with a https connection for the client. You can use free SSL such as let's encrypt or create
self signed
SSL certificate.I will create my own self-signed SSL certificate file with the OpenSSL command.

Create a new directory for the SSL file.

mkdir -p /etc/nginx/cert/

And generate a new SSL certificate file with the theopenssl command below.

Extract the nextcloud zip file and move it's content to the '/usr/share/nginx/html/' directory.

unzip nextcloud-10.0.2.zip

mv nextcloud/ /usr/share/nginx/html/

Next, go to the Nginx web root directory and create a new 'data' directory for Nextcloud.

cd /usr/share/nginx/html/

mkdir -p nextcloud/data/

Change the owner of the 'nextcloud' directory to the 'nginx' user and group.

chown nginx:nginx -R nextcloud/

Step 6 - Configure Nextcloud Virtual Host in Nginx

In step 5 we've downloaded the Nextcloud source code and configured it to run under the Nginx web server. But we still need to configure a virtual host for Nextcloud. Create a new virtual host configuration file 'nextcloud.conf' in the Nginx 'conf.d' directory.