(Last Updated On: December 16, 2018)

Nextcloud is an open source file sharing service that is self-hosted. It is a fork of Owncloud and it gives you collaboration features similar to what you get on Dropbox. Some of the collaborative features of Nextcloud are:

  • Has Media Player for playing shared media content
  • Has contact management feature
  • File sync and sharing – With notes to shares, searching in comments, recovery of files
  • Video calls with chat and  MCU, SIP-Bridge, ext. Signaling backend integration
  • Online document editor/reader
  • Calendar Management e.t.c.

You can extend Nextcloud functionalities via add-on applications. For Desktop and Android users, applications are available to install and connect to Nextcloud server.

Install Nextcloud 14 on Ubuntu 18.04/16.04/Debian 9

Nextcloud 14 dependencies are:

  • PHP
  • Apache / Nginx web server
  • MySQL / MariaDB Database server

Here are the steps for installing  Nextcloud 14 on Ubuntu 18.04/16.04/Debian 9. Follow them to have a working Nextclud Server on Ubuntu 18.04/16.04/Debian 9.

Step 1: Install PHP

PHP is a basic requirement for Nextcloud code. Install it on Ubuntu 18.04/16.04/Debian 9 by running the following command:

sudo apt install -y php-cli php-fpm php-json php-intl php-imagick php-pdo php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath

The version of PHP installed on Ubuntu 18.04 is 7.2 and version available on Ubuntu 16.04 & Debian 9 is 7.0.

Step 2: Install MySQL / MariaDB Database Server.

NextCloud can use MySQL, MariaDB, PostgreSQL or SQLite database to store its data. In this guide, we will use MariaDB or MySQL database server. Use our guide below to install any of the two:

How to Install MariaDB 10.3 on Debian 9 / Debian 8

Install MariaDB 10.3 on Ubuntu 18.04/16.04

For MySQL Database server, use:

How to Install MySQL 8.0 on Debian 9 / Debian 8

How to Install MySQL 8.0 on Ubuntu 18.04 / 16.04

After the installation of the database server, you need to create a database and user for Nextcloud

$ mysql -uroot -p

CREATE USER 'nextcloud'@'localhost' identified by 'StrongPassword';
CREATE DATABASE nextcloud;
GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';
FLUSH PRIVILEGES;

Don’t forget to replace StrongPassword with your database user password.

Confirm if the user can connect to the database with the provided password:

$ mysql -u nextcloud -p
Enter password: <ENTER PASSWORD>
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 34
MariaDB [(none)]> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| nextcloud          |
+--------------------+
2 rows in set (0.00 sec)

MariaDB [(none)]> QUIT
Bye

Step 3: Download and Install Nextcloud 14

Nextcloud 14 is distributed as a zip file. Check for the latest release from  Nextcloud download page before pulling the archive.

As of this writing, the latest release is 14.0.4

sudo apt install -y wget unzip
export VER="14.0.4"
wget https://download.nextcloud.com/server/releases/nextcloud-${VER}.zip

Once the file is downloaded, extract it:

unzip nextcloud-${VER}.zip

Move the resulting folder to /srv

sudo mv nextcloud /srv

Change directory permissions to the www-datauser

sudo chown -R www-data:www-data /srv/nextcloud/

Step 4: Install and Configure Apache Web Server

Install Apache HTTP Server

sudo apt install -y apache2  libapache2-mod-php

Create a VirtualHost file for Nextcloud:

sudo vim /etc/apache2/conf-enabled/nextcloud.conf

Paste the following content into the file:

<VirtualHost *:80>
     ServerAdmin [email protected]
     DocumentRoot /srv/nextcloud/
     ServerName example.com
     ServerAlias www.example.com
     ErrorLog /var/log/apache2/nextcloud-error.log
     CustomLog /var/log/apache2/nextcloud-access.log combined
 
    <Directory /srv/nextcloud/>
	Options +FollowSymlinks
	AllowOverride All
        Require all granted
 	SetEnv HOME /srv/nextcloud
 	SetEnv HTTP_HOME /srv/nextcloud
 	<IfModule mod_dav.c>
  	  Dav off
        </IfModule>
    </Directory>
</VirtualHost>

Enable required Apache modules and restart the service

sudo a2enmod rewrite dir mime env headers
sudo systemctl restart apache2

Visit the pagehttp://example.com to finish the setup.

1. Create an admin user account

2.Specify data directory – The owner should be userwww-data and group.

3. Provide database connection settings as created in Step 2

Click “Finish Setup” butto to complete installation of Nextcloud 14 on Ubuntu 18.04/16.04 & Debian 9.

Thanks for using our tutorial to Install Nextcloud 14 on Ubuntu 18.04/16.04/Debian 9. I hope this was helpful.

Similar Articles:

Install and Configure Pydio File Sharing Server on Ubuntu 18.04 LTS

How to Install Seafile Server On Ubuntu 18.04 LTS