How to install Nextcloud 12 on Ubuntu Server

Nextcloud 12 has arrived with a host of changes and new features. Jack Wallen walks you through the process of installing the next iteration of this powerhouse cloud server on Ubuntu 16.04.

Image: Jack Wallen

The latest release of the Nextcloud cloud server has been unleashed and it offers quite a lot in the way of improvements and new features (including some major improvements to the user interface). Some of the updates include:

  • Easier sharing of the current folder
  • Ability to move files through the menu rather than drag and drop
  • Secure Drop: Unique public link shares to multiple users (each with their own settings, such as permissions, password protection, and expiration date
  • Real time communication and collaboration
  • Global Shares for users
  • Guest app (a perfect way to give a temporary and restricted access to a customer or a partner to shared data)
  • Excludedirs app (enables a specific folder pattern to be excluded from being indexed)
  • Quota Warning app
  • JSloader app (allows the administrator to include JavaScript into all Nextcloud pages)
  • Impersonate app (allows administrators to impersonate another user)

I want to walk you through the process of installing Nextcloud 12 on the Ubuntu Server 16.04 platform. I'll assume this is a fresh install of both the operating system and the cloud server. With that said, let's begin.

Installing the dependencies

Before we get to the process of installing Nextcloud we must install all of the necessary dependencies. To do this, open up a terminal window, and issue the following commands:

sudo apt-get install apache2 mariadb-server libapache2-mod-php7.0
​sudo apt-get install php7.0-gd php7.0-json php7.0-mysql php7.0-curl php7.0-mbstring
​sudo apt-get install php7.0-intl php7.0-mcrypt php-imagick php7.0-xml php7.0-zip
​sudo apt-get install unzip

If you didn't already have MySQL (or MariaDB) installed on the server, you will be prompted to add a root user password for the database server.

Create the database

Next we're going to create the necessary database to create the database (and give it the correct permissions), do the following:

  1. Open up a terminal window
  2. Connect to the database with the command mysql -u -root -p
  3. When prompted, enter the MySQL root user password
  4. Create the database with the command CREATE DATABASE nextcloud;
  5. Give the root user permissions with the command GRANT ALL ON nextcloud.* to 'root'@'localhost' IDENTIFIED BY 'PASSWORD'; Where PASSWORD is the MySQL root user password
  6. Flush the database privileges with the command FLUSH PRIVILEGES;
  7. Exit the database with the command exit;

Configure Apache

Now we must configure the Apache server. This is actually quite simple. Create the file /etc/apache2/sites-available/nextcloud.conf with the following contents:

Alias /nextcloud "/var/www/nextcloud/"

<Directory /var/www/nextcloud/>
  Options +FollowSymlinks
  AllowOverride All

 <IfModule mod_dav.c>
  Dav off

 SetEnv HOME /var/www/nextcloud
 SetEnv HTTP_HOME /var/www/nextcloud


Save and close that file. Now we need to link the /etc/apache2/sites-available/nextcloud.conf to /etc/apache2/sites-enabled/nextcloud.conf with the command:

sudo ln -s /etc/apache2/sites-available/nextcloud.conf /etc/apache2/sites-enabled/nextcloud.conf

The next stage of the Apache configuration is to enable a few modules. To do this, go back to your terminal window and issue the following commands:

a2enmod rewrite
​a2enmod headers
​2enmod env
​a2enmod dir
​a2enmod mime

NOTE: Depending upon your setup, some of the above modules will already be loaded.

Finally, let's enable SSL with the commands:

a2enmod ssl
​a2ensite default-ssl

Reload Apache with the command:

service apache2 reload

Download and extract the Nextcloud file

Now it's time to download the Nextcloud file and extract it into the proper directory. Download the Nextcloud 12.0.0 file and save it in the /var/www directory. Extract the file with the command sudo unzip

The last step here is to give the newly-created directory the proper permissions. To do this, issue the following command:

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

Fire up the installer

Now it's time to point your browser to http://SERVER_IP/nextcloud (Where SERVER_IP is the actual IP address of your Nextcloud server). You will be greeted by a window where you create an admin account and enter the necessary details for the database (Figure A).

Figure A

Figure A

The final step of the installation.


  • The database information was created earlier
  • The user will be root
  • The database name will be nextcloud
  • The password was chosen during the installation of the MySQL (or MariaDB) database

Other than that, leave the information as is. Click Install and the process will complete, landing you on your new Nextcloud instance.

Get to know the new Nextcloud

If you've used Nextcloud in the past, you'll want to take the time to familiarize yourself with the new interface (there have been a number of changes). Other than gaining a modicum of familiarity, your Nextcloud cloud server is ready to go.

Also see

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic, The New Stack, and Linux New Media. He's covered a variety of topics for over twenty years and is an avid promoter of open source. For more news about Jack Wallen, visit his website jackwallen....