Cloud

How to install nextCloud 13 on Ubuntu 18.04

Jack Wallen walks you through the process of installing nextCloud 13 on the Ubuntu 18.04 server platform.

Image: Jack Wallen

We've covered nextCloud plenty of times here on TechRepublic. We've installed it on Ubuntu 16.04 via the standard means, as well as via a snap package. But since the release of the latest Long Term Support (LTS) release (18.04), some things have changed. To that end, I want to walk you through the process of installing this outstanding on-premises cloud server on the latest release of Ubuntu.

Getting nextCloud

Before we start the installation, head over to the nextCloud download page and download the necessary zip file (onto your Ubuntu server) with the command:

wget https://download.nextcloud.com/server/releases/nextcloud-13.0.4.zip

While that is downloading (it won't take much time), let's head to the dependencies.

Before you continue on, you'll want to make sure your Ubuntu 18.04 server has a static IP address. You can set this by following my recent tutorial How to configure a static IP address in Ubuntu Server 18.04.

SEE: IT project management: 10 ways to stay under budget (free PDF) (TechRepublic)

Apache

Your Ubuntu server should already include Apache, so there will be no need to install this default web server. The first thing we need to do is create an Apache configuration file. Issue the command sudo nano /etc/apache2/sites-available/nextcloud.conf and add the following contents:

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

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

 <IfModule mod_dav.c>
  Dav off
 </IfModule>

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

</Directory>

Create the necessary symlink with the command:

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

Finally, we have to enable the necessary Apache modules with the following commands:

a2enmod rewrite
a2enmod headers
a2enmod env
a2enmod dir
a2enmod mime

MariaDB

Now we must install our database server. We'll be using MariaDB, so install with the following command:

sudo apt install mariadb-server mariadb-client

Start and enable MariaDB with the commands:

sudo systemctl start mariadb
sudo systemctl enable mariadb

If you find that MariaDB is unable to install, you might have to first completely remove MySQL with the command sudo apt-get remove —purge mysql*.

Secure the MariaDB installation with the command:

sudo mysql_secure_installation

Answer the necessary questions and make sure to set a new MySQL password. Once that is done you're ready to install nextCloud.

Now we create our database. First we must access the database prompt. Issue the command sudo mariadb and you'll find yourself at the database prompt. Create the database with the command:

create user nextclouduser@localhost identified by 'PASSWORD';

Where PASSWORD is the password you want to use. Create the new database with the command:

create database nextcloud; 

Now grant the necessary permissions with the command:

grant all privileges on nextcloud.* to nextclouduser@localhost identified by 'PASSWORD';

Where PASSWORD is the password you created in the previous command. Finalize everything with the commands:

flush privileges;
exit;

Install nextCloud

Install unzip with the command sudo apt install unzip. Once that is installed, unzip the downloaded file with the command unzip nextcloud*.zip. Move that newly extracted folder with the command:

sudo mv nextcloud /var/www/html/nextcloud

Give the newly moved file the proper permissions with the command:

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

Now we need to install and enable all the necessary PHP modules. Install them with the command:

sudo apt install php7.2-gd php7.2-json php7.2-mysql php7.2-curl php7.2-mbstring php7.2-intl php-imagick php7.2-xml php7.2-zip

Restart Apache with the command:

sudo systemctl restart apache2

At that point, you should be able to point your browser to http://SERVER_IP/nextcloud (Where SERVER_IP is the IP Address of the serve) and finish up the installation (Figure A - by entering the database information you created above).

Figure A

Figure A

Finishing up our installation.


Ready to customize

Your nextCloud server is now up and running, ready for you to set about customizing it to perfectly meet your company needs. Enjoy having a powerhouse cloud server on-presence. Start adding apps to extend the feature set and you'll find nextCloud a remarkable tool.

Also see

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox