Create your own Cloud service – it’s free!

I’ve been a DropBox user since they started, the same with iCloud, SugarSync, Google Drive etc., but I’ve never been a paying user. I didn’t think you got enough storage for the price. Also there is a lot of files I really don’t want spread over all kinds of servers, and you do get even more skeptical when you hear about bugs and hackers gaining access to user’s accounts.

That’s why I’ve been on the lookout for a private Cloud solution. I want my files on my network, with my own server, a way to synchronize my Mac’s without using an online server. I want to be able to synchronize hundreds of gigabytes or more, with the benefits of LAN bandwidth and cheap drives.

That’s when I found ownCloud, an open source project which gives you free server/client software, and cheap apps for your phone you can even administrate it with Active Directory. Take a look at their features to get a picture of what you can do with this software.

OwnCloud installation guide

I will focus on Linux Ubuntu Server 12.04 (current stable release) as a server, and using Mac as a client. If you are unsure of how to install and use Linux, check out my DIY TimeMachine guide where there’s an in-depth guide on how to install Linux (on a virtual machine). Remember to activate OpenSSH when installing, to make sure you can login from another computer for administration.

Log in with sudo su, so that you have administrator rights, and run the following command:

apt-get update && apt-get upgrade


This will make sure your system is up to date before installing ownCloud. Next we need to install “LAMP”, (Linux, Apache, MySQL and PHP) in order to run ownCloud. This is installed by running the following command. (PS, you have to include the “^” character to install it properly):

apt-get install lamp-server^

You will get prompted for a MySQL root password. Choose a good password, but be careful not to forget it!

This concludes the LAMP installation. You will now continue with configuring MySQL.

MySQL Installation and database creation

Type the following (still logged in with sudo) to start the MySQL installation:


It will prompt you for the newly created MySQL root password.

Now a series of question will pop up:

“Change the root password?” Answer “n” for no (you’ve already set it)

The rest of the questions should be left at default just click enter on each of them to choose “Y”.

You are done with the SQL installation, now lets create a database.

Log in with:

mysql -u root -p

Enter your MySQL root password.

Now you should be ready to write a couple of MySQL commands. We need to create our database, the following command will create the database “owncloud”. You are free to name it whatever you want:


Remember the “;” at the end, or else you will just jump to a new line in MySQL.

Next we will need to create and assign a new user with full privileges to the database. We’ll do this in the following command:

GRANT ALL ON owncloud.* TO 'owncloud'@'localhost' IDENTIFIED BY 'password';

This will grant all on the database owncloud to the user owncloud on localhost (again you are free to change the username) and last create password (type an actual password, not “password”.)

Write “exit” to quit MySQL. You are now done with the database configuration, and we’ll move over to installing ownCloud

OwnCloud installation

As this is running on Ubuntu, there are ownCloud installation packages available for you to download and install. But there are some prerequisites for ownCloud that might not get installed by Ubuntu, therefore you will have to run a manual install of some libraries. Some of these libraries might be installed automatically in future releases (or current), but it doesn’t hurt to install them separately, it might spare you for a lot of hassle later. Run this command (copy-paste if possible):

apt-get install curl libcurl3 php5-curl php5-gd php5-intl php-xml-parser smbclient

Then you are ready to download and install ownCloud. First you need to add the repository and key for ownCloud. You can get information about multiple Linux versions available from

To get it running on Ubuntu, run the following commands (one line at a time):

sh -c echo 'deb /' >> /etc/apt/sources.list.d/owncloud.list
apt-key add - < Release.key

Now you should be ready to install ownCloud. First we need to update the package list:

apt-get update

Then we’re ready to install:

apt-get install owncloud

Ubuntu should be able to find the rest of the necessary packages needed to run ownCloud, and install in a couple of minutes.

We’re not quite there yet, but getting close. At this moment, you could check if you are able to reach your host. You should be able to reach it by going into a browser and writing the server’s IP-address and “/owncloud” behind.

Your URL should look something like this: “”, (if you have a 192.168.*.* LAN).

If you get a “php-gd module not installed” error when accessing your site, don’t worry. It’s definitely installed, it’s most likely just a service which hasn’t been restarted yet. It worked after a quick reboot for me (“reboot now” command).

Now, the next step would be to install SSL and configure Apache. SSL is required to get a “https” URL, which means your username/password will be encrypted. It’s also necessary to make the computer clients connect to the server.

SSL/Apache configuration and installation

I’m going to write the Apache and SSL steps together.

We’ll jump straight in. Install openssl (if not already installed):

apt-get install openssl

Then we need to configure Apache. OwnCloud is using Apache’s .htaccess files for security. We have to enable these to be able to use them. In addition we have to enable SSL.

Write the following command to enable the SSL, rewrite and headers modules in Apache2 (a2enmod = Apache2 ENable MODule):

a2enmod ssl
a2enmod rewrite
a2enmod headers

service apache2 restart

The modules should now be enabled.
Next create a SSL-directory in the apache2 folder:

mkdir -p /etc/apache2/ssl

To be able to use SSL, we need to create a self signed ssl certificate. Run the following command, and fill in the information it asks for (not necessary to fill in everything).

openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/owncloud.pem -keyout /etc/apache2/ssl/owncloud.key

This will create a key (certificate) under the newly created SSL-folder.

Finally edit the owncloud.conf file:

nano /etc/apache2/conf.d/owncloud.conf

You should have a simple “directory /var/www/owncloud” etc. file (three lines). Remove them all.

Paste this in, and change the ServerName line to match your domain or IP-address, this is important for the SSL-handshake to work. F.ex. Also, if experiencing any problems, try replacing the ‘*’ after both VirtualHost with your IP-address instead:

<VirtualHost *:80>
RewriteEngine on
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]


<VirtualHost *:443>
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/owncloud.pem
SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
DocumentRoot /var/www/owncloud/
<Directory /var/www/owncloud/>
AllowOverride All
order allow,deny
Allow from all

This will activate SSL, reroute http to https, and set Directory to “/var/www/owncloud” which means you don’t have to use “<URL>/owncloud” anymore, you can access it directly with IP or domain-name to your server.

You might need to include “IncludeOptional conf.d/*.conf” in your “/etc/apache2/apache2.conf” (last line) if you can’t make the redirection work.

Restart the Apache2 service:

service apache2 restart

Congratulations! Your ownCloud server is ready to be configured!

Configuring ownCloud

Go to your ownCloud site through its IP-address or domain. You should be met by a page like this (after accepting the certificate you just made):


Click advanced, then “MySQL”. You should now have a page looking like this:


Fill in a username and password for the admin account, then skip down to the database user/password and name. If you followed this guide, your database user and name should be “owncloud” and the password you chose when configuring MySQL.

Leave “localhost” (database name/address) as it is, you are now already on the server’s webpage, so localhost would point to your newly locally installed MySQL. Click Finish setup.

After this, you should be met by a Welcome window, and the possibility to download a local client. You can X-out this window, then click your (admin) username in the top right corner, Users, then add a user by writing name and password at top left. (Login name/Password). You should now have a user added to your ownCloud system.


Installing ownCloud on a Mac

As I’m installing my system for use with mac’s, I click “Desktop app” and download the latest client for mac.  This is like any install where you open the dmg-file, and drag and drop the “ownCloud” app over to “Applications”. Then unmount the dmg and delete it.

Now you can open ownCloud from “Applications” on your Mac. Fill in your server name, and click next. You might have to accept the certificate, and you should be good to go.


Setting ownCloud up is pretty straight forward. After choosing server, you choose your newly created user, then where you want your ownCloud folder, or just click “connect” and you’re done. Your folder will be at “/Users/username/ownCloud” at default. You will now have an icon at the menu bar at top, where you can adjust settings, check status etc.


Please leave a comment for any questions!


17 thoughts on “Create your own Cloud service – it’s free!

    • Glad I could help! 🙂
      Please let me know if you stumble into any problems getting it up and running!
      Usually any problems will be related to Apache and permissions. Your owncloud website will normally let you know what is wrong (wrong permissions for www-data f.ex.).

  1. great guide, everything worked fine, except the redirect, can’t get it to work from the url to the url/owncloud!! any idea?

    • What does your nano /etc/apache2/conf.d/owncloud.conf look like?
      Check it carefully with the guide, and make sure your firewall is configured to accept SSL/https requests

      • thanks for replaying:

        RewriteEngine on
        ReWriteCond %{SERVER_PORT} !^443$
        RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

        SSLEngine on
        SSLCertificateFile /etc/apache2/ssl/owncloud.pem
        SSLCertificateKeyFile /etc/apache2/ssl/owncloud.key
        DocumentRoot /var/www/owncloud/

        AllowOverride All
        order allow,deny
        Allow from all

      • I noticed that the comment section here is messed up if using < and > on the sides. Under “DocumentRoot” there should be a line: Directory /var/www/owncloud/ with < before and > after. Do you have that? Or else it doesn’t work.

      • yeah is messed up, so i got it, i justo copied the file from your guide to the console, so its all the same but the ip adress

      • Hmm, that’s strange. Because essentially, what you’re doing is accessing “/var/www”, and after that the owncloud folder, in other words “”, but when you specify the directory being “/var/www/owncloud”, it shouldn’t go straight to the “www” root. Please double check uppercase/lowercase letters etc.

      • I just copied it from your guide, but just to make clear, here is a screenshot of my file

        thanks for your time

      • Hmm, strange. I can’t see why it wouldn’t work. Did the file exist before you edited it, or did you create a new one?

      • Sorry I didn’t reply back before.
        Is it still a problem? Have you tried using a domain name instead of an IP-address?

      • i fixed it changing the /etc/apache2/sites-available/default modifying the DocumentRoot value there is the error on your tutorial, you have to edit the default server apache config, not the owncloud one for the redirect to work!

        Thanks for your time!

      • Hmm, strange. I didn’t modify that file at all. I wrote down every command I did as I tested it out.
        Thanks for the tip though, and glad it worked out for you!

    • This is a very late reply, but the most likely reason is that you need “IncludeOptional conf.d/*.conf” in your /etc/apache2/apache2.conf file (last line).

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s