Ultimate Home Server Part 7 – Personal Cloud

Services like Dropbox are great, but I always recoil slightly at the use of the term “The Cloud” when really all that means is “someone else’s computer”.

Running your own cloud service is actually really easy to achieve in a home server environment, so in this guide I’ll show you how to setup your own solution using free software called Nextcloud.

As with any cloud solution, the installation will be formed of two parts; you’ll need some server software setup on your home server and client software setup on each of your devices which will allow the data on your device to sync with the server and vice versa.

Server setup

This guide assumes you’re following my multi-part guide for building a home server, in which case you’re already running a server with Ubuntu 18.04 LTS installed.

That being the case you should be able to follow the steps below to install Nextcloud:


It’s best practice to ensure your system is up to date before installing any new software, so run the following two commands to install the latest updates:

sudo apt-get update
sudo apt-get upgrade -y

Once this process is complete we can move on to installing a web server, followed by Netxtcloud:

Installing LAMP

Lamp is a web server for Linux (it stands for Linux Apache MariaDB PHP). You’ll need to install this using this command in order to install Nextcloud:

sudo apt-get install apache2 mariadb-server apt-transport-https -y

Next you’ll need to start the LAMP services, run these commands in sequence:

sudo systemctl start apache2
sudo systemctl enable apache2
sudo systemctl start mariadb
sudo systemctl enable mariadb

Next we need to upgrade the PHP versions. You’ll first need to add the repositories with these commands:

sudo wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add -
sudo echo "deb https://packages.sury.org/php/ bionic main" | tee /etc/apt/sources.list.d/ondrej.list
apt-get update

Then install the packages and dependencies with this command:

sudo apt-get install libapache2-mod-php php7.2 php7.2-xml php7.2-curl php7.2-gd php7.2 php7.2-cgi php7.2-cli php7.2-zip php7.2-mysql php7.2-mbstring wget unzip -y 

Next you’ll need to edit the PHP.ini file, open it with this command:

 sudo nano /etc/php/7.2/apache2/php.ini 

Then locate and edit the lines below to these values:

memory_limit = 512M 
upload_max_filesize = 200M 
max_execution_time = 360 
post_max_size = 200M 
date.timezone = TIME/ZONE 

TIME/ZONE needs to be your current timezone, such as UK/Birmingham.

Press Ctrl+O to save the file

Press Ctrl+X to exit Nano

Configure the Nextcloud database

Nextcloud will need a database in order to work, follow these steps to set the databse up:

sudo mysql_secure_installation

You’ll be prompted to set a password. Make sure you write this down, then answer the remaining questions.

Once back at the command prompt, enter the following command to open the SQL application:

mysql -u root -p

The database application will open, type in the following commands:

CREATE DATABASE nextclouddb;
CREATE USER 'nextcloud'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL PRIVILEGES ON nextclouddb.* TO 'nextcloud'@'localhost';

‘PASSWORD’ above needs to be a strong password – write this down too!

Configure the Apache web server

Create a configuration file by issueing the following command in the terminal:

 sudo nano /etc/apache2/sites-available/nextcloud.conf 

Paste the following text into the file:

<VirtualHost *:80>
    ServerAdmin admin@example.com
    DocumentRoot "/var/www/html/nextcloud"
    ServerName example.com 

<Directory "/var/www/html/nextcloud/">
    Options MultiViews FollowSymlinks
    AllowOverride All
    Order allow,deny
    Allow from all 

TransferLog /var/log/apache2/nextcloud_access.log ErrorLog /var/log/apache2/nextcloud_error.log

Press Ctrl+O to save the file

Press Ctrl+X to exit the file

Next disable the default Apache site and enable the Nextcloud site with the following:

sudo a2dissite 000-default
sudo a2ensite nextcloud

Restart Apache:

sudo systemctl restart apache2

Installing Nextcloud

With our database and web server created we’re now in a position to actually isntall and configure Nextcloud.

The first step is to setup the directory structure (with permissions) for Nextcloud to reside in:

sudo mkdir /var/www/html/nextcloud
sudo chown www-data:www-data /var/www/html/nextcloud
sudo chmod 750 /var/www/html/nextcloud
sudo mkdir -p /var/nextcloud/data
sudo chown www-data:www-data /var/nextcloud/data
sudo chmod 750 /var/nextcloud/data

Next download and install Nextcloud with these commands:

cd  /var/www/html/nextcloud
sudo wget https://download.nextcloud.com/server/installer/setup-nextcloud.php
sudo chown www-data:www-data setup-nextcloud.php

Once this is complete then Nextcloud is installed and all that needs to happen is for you to configure it:

Configure Nextcloud

From any device on your network, open a web browser and navigate to the following page:

http://<your server IP>/setup-nextcloud.php

You should be presented with a page like the following:

Click Next. Nextcloud will check that all dependencies are met (this can take a few minutes) and then should present you with the following:

I recommend you leave the default entry of “Nextcloud” in the box above – this means that your Nextcloud instance will be available at http://<yourIP>/Nextcloud. This is useful if you want to run other web based services on your server in the future.

Next you’ll be asked to create an admin account, select the directory for files to be stored in and provide your databse details:

Create a username and password.

I recommend you let Nextcloud specify the directory for storage, I ran into problems when I tried to force it to use a share on my RAID array.

For the databse, provide the details of the database you created earlier:

Database user: nextcloud
Database password: <password you created>
Database name: nextclouddb

Then click Finish setup.

Once complete you should be able to browse to

http://<your server IP>/nextcloud

This should open Nextcloud in your browser. From here you can create shared folders, manage users, add plugins and much, much more.

The next step is to install the client application on each device you wish to use with Nextcloud.

Client Setup

The process for installing the client application will differ depending on the platform (it’s available for Windows, Mac, Linux, iOS, Android, more).

As most users will use Windows I’ll demonstrate how to install the application on a Windows 10 PC. For other versions you can follow the instructions on the Nextcloud website.

You’ll first need to go to the Nextcloud website and download the client application.

Next install the application, once completed you’ll be presented with the following:

Click the Log In button as shown above, you’ll see the following:

Type in “http://<YOUR SERVER IP>/nextcloud! and clock Next.

A web browser will open and you’ll be prompted to connect your account:

Enter you login details and you’ll be asked to Grant access:

Click the button and you’ll be returned to the app. Here you can choose which folders on your Nextcloud to sync, and where to store them on your local device.

Select the options that work for you, then click Connect. You’ll then see a screen like below, showing you the status of your connection.

The same screen can be seen at any time by clicking on the Nextcloud logo on the task bar.

If you open a new file browser window you should now see a Nextcloud entry in the navigation pane:

And that’s this part AND the series concluded!

I hope these guides have been useful to you, if they have please let me know in the comments below!

Also let me know any other ideas you have for a home server, I’m always looking for new ideas as to what to do with mine, and I’m sure you are too!

Leave a Reply