My own data-cloud

I’d love to share data with friends and family. But the free services from Dropbox, GoogleDrive or OneDrive do not satisfy my needs. In this post I’d like to document my steps through setup and configuration of my Owncloud.

inizialize host

I’ll use a Ubuntu Server 16.04 64Bit VM with 1GB RAM (4GB swap), 20GB storage and 2 vCPUs. During the OS installation I chose the following two services:

  1. OpenSSH
  2. LAMP

!IMPORTANT! during the LAMP installation you’ll have to set the password for MySQL user root. This password will be used in later steps.

After the installation I increased the security in the first of two hardenings.

hardening (1/2)

The Apache2 and MySQL components of my LAMP installation are the focus of the first harding, before I start with owncloud.


The only applications I want to be reachable at this VM are OpenSSH and Apache Full. The other ports shall be blocked be the firewall. With these commands I achived this goal:

  1. sudo ufw allow in "Apache Full"
  2. sudo ufw allow OpenSSH
  3. sudo ufw enable

MySQL secure installation

MySQL does provide a tool to increase the MySQL security. The tool will guide you through the process and asks specific questions you have to answer depending on your requirements. This tool dis-/enables features which could be used during an attack. You’ll reach the tool with the command:  sudo mysql_secure_installation . After you successfully signed in with the root password (you set during OS setup), you can change theses aspects of your installation:

  1. Validate Password Plugin
  2. MySQL root password
  3. anonymous user
  4. remote connections
  5. test database

installation / setup


To enable the communication between MySQL and Owncloud you need to create a database, user and access to it. I used the MySQL CLI to setup them up.

  1. log into MySQL CLI as root: (with the root password you set during OS setup)
    mysql -u root -p
  2. create owncloud database:
    CREATE DATABASE owncloud;
  3. create owncloud user and grant access to database:
    GRANT ALL ON owncloud.* to 'owncloud'@'localhost' IDENTIFIED BY 'individualPassword';
  4. update information:
  5. exit MySQL CLI:


After I setup the database and webserver it’s time to install and configure owncloud. A install guide for Owncloud on Ubuntu or other Linux operation systems can be found here. I used the following commands to install my Owncloud instance:

  1. get release information key:
    wget -nv -O Release.key
  2. add key to keychain:
    sudo apt-key add - < Release.key
  3. add repository to sources list:
    sudo sh -c "echo 'deb /' > /etc/apt/sources.list.d/owncloud.list"
  4. update source information and install Owncloud
    sudo apt-get update && sudo apt-get install owncloud -y
  5. check installation on your favourite browser:

You can adjust system path during the configuration. I just inserted my new admin credentials and database connection for MySQL.

VM snapshot

To take a snapshot of the current VM was crucial for me, because that was not the first time I tried to install owncloud. The previous attempts failed for different reasons (some I couldn’t grasp). I guess at some point I forgot a configuration step or did something wrong unintentionally. That’s why I decided to backup my working status quo.

hardening (2/2)

create SSL certificate

I needed a SSL certificate for the future use of https. I used openssl to create a certificate and with the given parameter I placed the certificates at a common place.

With this command I created a self-signed certificat with private key with a duration of 365 days. I found the next command in a online tutorial and will need the output for the next steps.

use SSL certificate with Apache2

To use my new SSL certificates I changed the virtual host configuration of my Apache2 installation. First I created a file with my desired SSL configurations.

Before I changed the default entires I made a backup of the SSL virtual host file.

The key changes and entries are listed below. The marked lines are missing the current IP or DYNDNS address of my host. All other entries match my individual setup and have to be adjusted accordingly.

!IMPORTANT! next to the given entries there are several others in the file, which I didn’t change. These entries should still be there after your changes -.-.

I checked the changes I made with this command  sudo apache2ctl configtest and activated them with these commands:

  1. sudo a2enmod ssl
  2. sudo a2enmod headers
  3. sudo a2ensite default-ssl
  4. sudo a2enconf ssl-params
  5. sudo service apache2 restart

trust your own IP!

The IP of the device you used for the setup will be registered in your config.php. This entry allows you to access owncloud from this IP. But let’s say you don’t just want to use your owncloud from one device (IP) only. In this situation you’ll have to add the domain(s) you want to use into this configuration file. You can find the config.php within your <owncloud_installation>/config/ folder.

The highlighted lines define the allowed IP addresses. After this change you will be able to access your owncloud instance from your desired domain.

next steps

Hopefully I will be able to configure my second Network Interface Controller in my ESXi server to setup a DMZ. My Owncloud will be placed into this DMZ which will lead to configuration changes I guess. Another topic which I have to address with my Owncloud will be the plugin External Storage to provide access to my Samba shares hosted by my filemanager. At the moment my Owncloud instance only got 20GB storage to buffer files. I guess as soon as I allow bigger files I have to adjust that storage or find a workaround including additional storage (NFS, SMB, second vHDD).



The documentation I refered to create this post:

I didn’t address the content of those sources in this post. But I used some information / steps of those in my own setup:

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.