Nextcloud is one of the most powerful, flexible, and user-friendly on-premises cloud servers on the market. With this platform you gain enterprise-level file-sync and sharing, industry best practices for security, seamless collaboration, compliance-ready monitoring, track changes (for user files), workflow management, accessibility, secure online meetings, team planning, GitHub merge tracking, plenty of installable apps to extend the offered services, and so much more.

All of that can be had for free, and hosted on your own Linux server. That means a private cloud isn’t nearly as far out of reach as you might have thought it to be.

I want to walk you through the process of installing the current latest stable release of Nextcloud (version 16) on the Ubuntu Server 18.04 platform. The installation should only take you a few minutes to have a fully functioning private cloud server up and running.

What You’ll Need

Outside of a few dependencies, there’s very little you need to get Nextcloud installed. I will warn you that I am demonstrating the installation of Nextcloud to serve only on an internal LAN. To make this work via the WAN, you’ll also need a domain and (optionally) a CA certificate (in order to make use of SSL). For the sake of simplicity, we’ll install the basic Nextcloud to be used internally.

In order to make this work, you will need the following:

  • A running instance of Ubuntu Server 18.04.
  • A user account with sudo privileges.

With those requirements met, let’s install.

Update/Upgrade Ubuntu

The first thing we’re going to do is update the server. Remember, it’s possible that the kernel could be updated in the process. Should that happen, you’ll need to reboot the server. Because of this, it’s best to run the update/upgrade at a time when a reboot is possible.

To update/upgrade Ubuntu, open a terminal window and issue the following two commands:

Once the upgrade completes, reboot (if required) and continue.

Installing Dependencies

The first thing to do is to install the necessary dependencies. We’ll be installing Nextcloud with Apache and MySQL. You can install using NGINX and MariaDB, but my preference (at least in this instance) is to go with the Apache/MySQL combo. First install Apache, PHP, and a few other dependencies with the following commands:

Next, install MySQL with the command:

That’s it, the dependencies are out of the way.

Creating the Database

Next we’ll create the necessary database. Before we do that, we must secure the MySQL installation with the following command:

You will first be asked if you want to use the VALIDATE PASSWORD PLUGIN (Figure 1). This plugin only allows strong passwords to be used, so anyone demanding higher security for the MySQL installation can enable this plugin by typing “y” (no quotes) when prompted.

Figure 1

The VALIDATE PASSWORD PLUGIN OPTION.

Next you will be asked to set a root password. Make sure to use a strong and unique password for the MySQL root user, as you don’t want to leave it open for possible hacking. After that, answer “y” to the remaining questions. Once the mysql_secure_installation command completes, it’s time to create our database. Log into the MySQL with the command:

When prompted, type the password you set during the mysql_secure_installation process. At the MySQL prompt, type the following commands:

Where PASSWORD is a strong, unique password.

Download and Extract Nextcloud

Now we can download and extract the official Nextcloud file. Download the latest version with the command:

Unpack that file with the command:

This will create a new directory named nextcloud. We need to move that directory into our Apache document root with the command:

Give the directory the proper ownership with the command:

 

Configure Apache

Next, we must create a new virtual host file for Nextcloud. Create this new file with the command:

In that new file paste the following:

Save and close the new file.

Enable the new Nextcloud site (along with the necessary Apache modules) by issuing the following commands:

Finally, restart Apache with the command:

 

Complete the Installation

Now that you have the command line portion of the installation complete, it’s time to fire up a browser (one with access to your LAN) and point it to http://SERVER_IP/nextcloud (where SERVER_IP is the IP address of the server hosting Nextcloud). You should be presented with a screen requesting you input the information for the database, as well as the creation of an admin user (Figure 2).

Figure 2

The web-based portion of the Nextcloud installation.

Fill out all of the required database options with the information used using during the MySQL database creation process and click Finish Setup. When that completes, you will be automatically taken to the Nextcloud main window (logged in as the newly created admin user — Figure 3).

Figure 3

The Nextcloud main page, ready for work.

Congratulations, you now have a working Nextcloud 16 installation. Your on-premises cloud server is ready to go. At this point, you might want to click on the profile icon in the top right corner, click Apps, and start installing various applications to extend the services offered to your users and admins.