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:
1
2
|
sudo apt–get update
sudo apt–get upgrade –y
|
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:
1
2
3
|
sudo apt–get install apache2 php7.2 bzip2 unzip –y
sudo apt–get install libapache2–mod–php php–gd php–json php–mysql php–curl php–mbstring –y
sudo apt–get install php–intl php–imagick php–xml php–zip –y
|
Next, install MySQL with the command:
1
|
sudo apt–get install mysql–server –y
|
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:
1
|
sudo mysql_secure_installation
|
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
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:
1
|
sudo mysql –u root –p
|
When prompted, type the password you set during the mysql_secure_installation process. At the MySQL prompt, type the following commands:
1
2
3
4
5
|
CREATE DATABASE nextcloud;
CREATE USER ‘nextcloud’@‘localhost’ IDENTIFIED BY ‘PASSWORD’;
GRANT ALL PRIVILEGES ON nextcloud.* TO ‘nextcloud’@‘localhost’;
FLUSH PRIVILEGES;
exit
|
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:
1
|
wget https://download.nextcloud.com/server/releases/latest.zip
|
Unpack that file with the command:
1
|
unzip latest.zip
|
This will create a new directory named nextcloud. We need to move that directory into our Apache document root with the command:
1
|
sudo mv nextcloud /var/www/html/
|
Give the directory the proper ownership with the command:
1
|
sudo chown –R www–data:www–data /var/www/html/nextcloud
|
Configure Apache
Next, we must create a new virtual host file for Nextcloud. Create this new file with the command:
1
|
sudo nano /etc/apache2/sites–available/nextcloud.conf
|
In that new file paste the following:
1
2
3
4
5
6
7
8
9
10
11
|
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/html/nextcloud
SetEnv HTTP_HOME /var/www/html/nextcloud
</Directory>
|
Save and close the new file.
Enable the new Nextcloud site (along with the necessary Apache modules) by issuing the following commands:
1
2
|
sudo a2ensite nextcloud
sudo a2enmod rewrite headers env dir mime
|
Finally, restart Apache with the command:
1
|
sudo systemctl restart apache2
|
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
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
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.
Recent Comments