How to install NextCloud 11 on Ubuntu

NextCloud Ubuntu Logo

NextCloud is a Dropbox-like solution for self-hosted file sharing and syncing. Installing NextCloud 11 on Ubuntu is trivial. Whether you want to backup, have file-syncing or just have a Google Calendar alternative, this guide is for you.

What is NextCloud? Is it like a “cloud”?

If you stumbled here by chance and don’t know what NextCloud is, here is an article explaining its principal features and advantages/disadvantages. To tell you the truth, NextCloud is a SaaS cloud, if you want to know more about cloud types you can read this article.

In this article we will cover the installation of the server (not the client).

Step1: Install software

Important
I take absolutely NO responsibility of what you do with your machine; use this tutorial as a guide and remember you can possibly cause data loss if you touch things carelessly.

The first step in order to install NextCloud 11 is to install a web server and PHP. Although you can adapt this guide for many Ubuntu Versions I suggest you to stick with Ubuntu 16.04 or higher since PHP7 is included. PHP7 brings many improvements over the past versions and will boost NextCloud too. You will need root access during this procedure. The following procedure will install apache as webserver. Input the commands one by one to avoid errors!

Ubuntu 16.04Ubuntu 16.10Ubuntu 17.04Ubuntu 17.10

Open a terminal and input the following commands:

Open a terminal and input the following commands:

Open a terminal and input the following commands:

Open a terminal and input the following commands:

Step2: Database selection

Now that you have set up the environment, all that is left is to choose a database that will support the installation. You have three choices:

  • SQLite: is a single-file database. It is suggested only for small installations since it will slow NextCloud down sensibly.
  • MariaDB/MySQL: are popular open source databases especially amongst web developers. It is the suggested choice.
  • PostgreSQL: a popular enterprise-class database. More complicated than MySQL/MariaDB.

Now, this choice won’t really alter the functionality of NextCloud (except if you use SQLite), so pick whatever you know best. If you’re unsure pick MariaDB/MySQL.

SQLiteMySQL/MariaDBPostgreSQL

Install the software:

Install the software:

Or if you prefer MySQL:

During the installation you will be prompted to choose a root password, pick a strong one. If you’re not prompted to choose a password, the default one will be blank. (This is potentially insecure, change it!)

Now you need to enter the database (you will be asked the password you just set):

Now that you are in create a database:

Now you need to create the user that will be used to connect to the database:

The last step is to grant the privileges to the new user:

When you’re done type Ctrl-D to exit.

Install the software:

Now you need to enter the database:

Now that you are in create a database:

Now you need to create the user that will be used to connect to the database:

The last step is to grant the privileges to the new user:

When you’re done type \q and press enter to exit.

Step 3: Install NextCloud

The last step is to actually get the software, configure it and run it.

Ubuntu 16.04

With these step we download the software and extract it:

Now we need to create a new file in /etc/apache2/sites-available/nextcloud.conf . Feel free to use whatever editor you feel comfortable with and add the following lines:

Once done it’s time to enable the new site and enable apache mods that are needed by NextCloud:

Step 4: Configuring firewall

This step is essential when your firewall is enabled. If your firewall is enabled you won’t be able to access your NextCloud 11 instance; on the other hand if it isn’t enabled you shouldn’t have any problems and you can simply skip this step. 

Tip!
Keep in mind having a firewall enabled is a good security practice and you should already have one enabled.

In order for the firewall to work, it must be enabled. This guide will not include this part. When you enable a firewall many things can go wrong, e.g. you’re using SSH, you enable the firewall and your connection is cut and can’t connect otherwise, hence you should carefully review the documentation from your distribution. Also, don’t forget opening ports can be a risk if your server is not configured properly.

To open the ports needed by NextCloud 11 follow these steps:

UFWIPtables

UFW is the default firewall in Ubuntu, if you’re using one, you’re probably using UFW.

IPtables is an older firewall (still widely used), if you’re not using UFW you can use IPtables directly.

Step 5: Install

Once you’re done with selecting the database, it’s time to install everything. Head to http://YOUR_IP_ADDRESS/nextcloud/ and you will be facing the following screen:

Nextcloud Installation

Nextcloud Installation

Select an administrator username and password, then you can select the data folder, but if you don’t know what you’re doing it’s best if you leave it with the default value. Then click on “Storage & Database” to select the database you chose during step 2. Fill everything and if you’ve followed all the steps correctly you should be seeing the Files app:

Nextcloud Files

Nextcloud Files

Image courtesy of mark | marksei

The following two tabs change content below.
The IT guy with a little boredom look in his eyes, fond of computers since forever he now works as a freelancer in the IT and shares his experiences through this blog.

You may also like...