HTPC File Server Combo Using ownCloud – Setup Guide

I decided to write a tutorial today for another Ubuntu 14.04 Server based HTPC and media server setup guide. I’ve read a forum thread where the original poster is asking if there is some way to setup an HTPC File Server Combo on his machine.

Some of the respondents answered by suggesting to setup a Samba server or NFS connection, but the post author isn’t skillful enough to setup the thing on his own. So I decided to wrtie this guide on how you would exactly do this, the easy way, using a FREE-AND-OPEN-SOURCE-SOFTWARE (FOSS) called Owncloud. I’ll share this guide later on the forum site. So with Owncloud, XBMC (KODI in next release) plus Ubuntu Server 14.04 LTS, we could put up a configuration that will serve as an HTPC, DLNA server, streaming media server, file server, that has a file sync feature like the one offered by Dropbox or Google Drive.

But what the heck is Owncloud anyway?

Stylized as ownCloud, it is generally free and OpenSource software that functions like a Dropbox (for the file Sync part). Almost all of us know that Dropbox is a free cloud-based file hosting service with file synchronization feature. It’s a free (up to 2GB) personal cloud storage service. It’s very similar with Owncloud, the difference is, you have to provide your own hardware/infrastructure where you could install Owncloud and configure it as your privately-owned cloud server or cloud storage, and file server solution. You could install and use Owncloud within your own internal network, as well as, to a cloud VPS (Virtual Private Server) like the ones offered by Amazon AWS and DigitalOcean.

Owncloud, like any other software, you need to install and configure it afterwards to match your intended mode of operation. Like Dropbox, Owncloud has a client connection software that automatically syncs your local file/folder to your private cloud folder. It also has a WebDAV feature that you could connect to, from various clients (Smartphones and Desktops) by just accessing your webdav server address. Connecting to your account using webdav is simple and easy, just take note of your user account and your webdav address.

ownCloud WebDAV address uses the following format:




Purpose of This Guide

The main purpose of this guide, is to setup an Linux-based media server, a file server, a DLNA server, a streaming media server, and at the same time an HTPC, all under one machine. This build is going to be a power-saving machine that you could power-on 24 hours a day, seven days a week. You also call this as a multi-in-one htpc media server.

Setup Requirements

For this guide, you need a machine powerful enough to serve your desired services and mode of operation. I’m not going to run through the details, but to give you an idea, you at least a 4GB RAM, Quad-core CPU, ATI Radeon HD5400 or newer/Intel GMA X4500HD or newer, large hard-drive (or RAIDED drives) and most of all, a high-quality Gigabit Ethernet Card. You also need to have XBMC (or Kodi) and Plex already installed on your system. If you have not done this yet, then you need to follow my

Linux-based media server guide on how to install XBMC and Plex.

For the Owncloud Installation Part

Since this tutorial involves Owncloud manual installation on a Linux-based machine (Ubuntu Server 14.04 LTS), it requires command-line typing using Linux terminal or Windows putty.exe. Don’t be discourage by this because I will make it very easy for you. You may copy-and-paste most of the commands and you just need to substitute the values applicable to your installation.

For this guide, we need to do the following:

  • Connect to the target machine remotely via SSH
  • Install Apache 2 Web Server
  • Install MySQL Server
  • PHP5
  • Install Owncloud dependency packages
  • Create a new VirtualHost
  • Download Owncloud manual installation package
  • Enable VirtualHost & Install Owncloud (keep in mind that Ubuntu 14.04 LTS is the Host-OS)
  • Configure Owncloud
  • Test connect a client device/machine
  • You must be comfortable with command-line

    Note: You need putty.exe if you’re on Windows.

The details and values used in this guide are:

  • Hostname => htpc
  • FQDN or Fully Qualified Domain Name => htpc.chubbable.local
  • User Account used from the HTPC => chubbable
  • VirtualHost or Domain Name for the Owncloud instance => cloud.loc
  • Database name used for Owncloud => owncloud
  • Database user-name used for Owncloud => owncloud
  • Database password used for Owncloud => owncloud
  • MySQL Root user-password => root
  • Admin user-name & user-password for Owncloud => admin/admin These are the values I’ve used in this guide. You should use your own values.


  • Step 1: Connect to your HTPC remotely via SSH.

    You could actually install Owncloud directly from your XBMC or HTPC machine, but the advantage of using SSH is that, you could easily copy and paste codes in your command-line and you don’t have to manually type in the long syntaxes for the installation. To connect to your target machine using SSH, open up putty.exe or a terminal in Linux (ctrl + t), then type in ssh chubbable@ chubbable is my user-name on my HTPC machine with a static IP address of If it’s your first time to connect, you’ll be greeted with a message The authenticity of the blah... blah..., make sure that you’re connecting to your target machine, type yes and press enter to continue. You should be now logged-in remotely to your HTPC machine.

  • Step 2: Download the latest version of ownCloud.

    To do this, head over to and click the button labeled Archive Files For Server Owners. A new mini-window should pop-up. Reference Image:

    From the pop-up window, you should see a list of available choices. In this case, you need to download the Unix package for ownCloud in an archived file. From the number one entry, right click Unix link and choose Copy link address from the context menu. Reference Image:

  • Step 3: Install Apache2 web server and other dependency packages.

    Since ownCloud is a web-based application, it needs to have a web server to run on. Just like any other web-script (ie. WordPress), it requires a web host to be installed on. So for this step, we need to install Owncloud’s dependency packages and at the same time install Apache 2 web server, MySQL Database server and PHP (plus important modules). You could just copy and paste the codes used in this step. You just have to substitute the values that are most applicable to your case. To continue with this step, copy the following code and paste it in your command-line, then press ENTER key. Input your user-password when asked.

    sudo apt-get install lamp-server^ php5-gd php5-json php5-curl php5-intl php5-mcrypt php5-imagick -y

    It’ll take around 10 minutes for this to finish. It depends on your Internet and system-drive’s speed. During the installation process, a new screen should pop up similar to the image shown below.

    Reference Image:

    Nominate a password for the MySQL Database root user account. So input your password, then hit ENTER key. You’ll be asked to enter it twice for confirmation and double-checking. Installation should continue.

    After the install process, you should be back to your command-line. chubbable@htpc:~$

    Now, you’re ready for the next step.

  • Step 4: Create the document root folder for cloud.loc. To do this, copy and paste the following code and press ENTER key:

    sudo mkdir /var/www/cloud.loc

    Create ssl folder to hold your SSL Certificate files:

    sudo mkdir /var/www/cloud.loc/ssl

    Create logs folder to store your log files:

    sudo mkdir /var/www/cloud.loc/logs

  • Step 5: Copy the owncloud folder or better yet move it to your virtualhost’s document root by typing the following command.

    sudo mv owncloud /var/www/cloud.loc/

    To confirm that you actually move the whole folder, type

    cd && ls /var/www/cloud.loc

    You should see the folders owncloud, ssl and logs.

    Reference Image:

    Did you see them? Cool! Now continue with the next step.

  • Step 6: After the above step, set permission to your ownCloud document root by copy-pasting the following command:

    sudo chown -R www-data:www-data /var/www/cloud.loc/owncloud

    sudo chmod -R 755 /var/www/cloud.loc/owncloud

    Open and edit the hosts file and insert cloud.loc:

    sudo nano /etc/hosts

    add cloud.loc beside

    Reference Images:

    Note: You may change cloud.loc to anything you want.
    Add your domain name to your client machine’s hosts file. If you’re on Linux, you could do this by typing this in your commandline: sudo nano /etc/hosts Then write a new line of text and add the IP address of your XBMC or HTPC machine and then your domain name.

    This requirement should be done on your client machine,

    not your XBMC or HTPC machine. In my case, I did it like so: cloud.loc

    Save the file by pressing

    ctrl + o -> Enter -> ctrl + x.

    To do this in windows XP/7/8, navigate to system-folder\system32\drivers\etc\ and edit the file hosts. It’s a hidden file, so you need first to enable Show hidden files option in Windows EXplorer.

  • Step 7: Create a Self-signed SSL Certificate For your ownCloud instance.

    You need a self-signed certificate to be used with your SSL virtualhost in Apache. Creating this certificate is simple, you may just copy and paste the commands below. This step should enable https connection in ownCloud.

    Create the SSL Certificate. Copy-paste the command to create the certificate:

    sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /var/www/cloud.loc/ssl/owncloud-ssl.key -out /var/www/cloud.loc/ssl/owncloud-ssl.crt

    A new screen should open and will ask for various details like Country and State. This is how I entered my data:

    • Country Name (2 letter code) [AU]: US
    • State or Province Name (full name) [Some-State]: New York
    • Locality Name (eg, city): New York City
    • Organization Name (eg, company) [Internet Widgits Pty Ltd]: Chubbable
    • Organizational Unit Name (eg, section): Tech
    • Common Name (e.g. server FQDN or YOUR name): cloud.loc
    • Email Address: admin@cloud.loc

    You can now check for the files from the ssl folder inside /var/www/cloud.loc

    cd && ls -l /var/www/cloud.loc/ssl

    Reference Image:

    You should see owncloud-ssl.crt and owncloud-ssl.key file.

    Now you might wanna ask your self, how to use SSL in ownCloud?

    The answer can be found in the next step below.

  • Step 8: Create an SSL VirtualHost.

    This is the part where you will use the SSL files you’ve generated from the previous step above. After successfully creating the certificate files, you now need to create the SSL virtual host for your domain. To do this, copy the file default-ssl.conf from /etc/apache2/sites-available/default-ssl.conf and paste it to a new file called ssl-cloud.loc.conf.

    To do that, type the following and press Enter key.

    sudo cp /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-available/ssl-cloud.loc.conf

    Add the path to your SSL certificate files, open the file by typing:

    sudo nano /etc/apache2/sites-available/ssl-cloud.loc.conf

    Edit the file to look something like this:

    <ifmodule mod_ssl.c>
      <virtualhost _default_:443>
          ServerAdmin admin@cloud.loc
          ServerName cloud.loc
          DocumentRoot /var/www/cloud.loc/owncloud
          ErrorLog /var/www/cloud.loc/error.log
          CustomLog /var/www/cloud.loc/access.log combined
          SSLEngine on
          SSLCertificateFile /var/www/cloud.loc/ssl/owncloud-ssl.crt
          SSLCertificateKeyFile /var/www/cloud.loc/ssl/owncloud-ssl.key
          <filesmatch "\.(cgi|shtml|phtml|php)$">
          SSLOptions +StdEnvVars
          <directory /usr/lib/cgi-bin>
          SSLOptions +StdEnvVars
          BrowserMatch "MSIE [2-6]" \
          nokeepalive ssl-unclean-shutdown \
          downgrade-1.0 force-response-1.0
          BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
          <directory /var/www/cloud.loc/owncloud>
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Require all granted

    Save the file, and enable the SSL virtualhost.

    To do this:

    sudo a2ensite ssl-cloud.loc.conf && sudo service apache2 restart

    Reference Image:

    If there is no error upon Apache restarts, then you’ve successfully enabled your SSL VirtualHost.

  • Step 9: Create a Virtualhost for your ownCloud instance.

    This virtual host will host your domain for your Owncloud instance. In my case, I named my domain like so, cloud.loc. For this step, you need to create a new virtualhost and set the document root to be used by Owncloud. To do this, create a new .conf file for your Owncloud virtualhost. It’s better to use a file name that reflects your domain name. In my case my local domain name is cloud.loc, so I would name my .conf file like so, cloud.loc.conf.

    To create the file, type or copy this:

    sudo nano /etc/apache2/sites-available/cloud.loc.conf

    A new black screens should pop up. Copy and paste the block of codes and the save the file by pressing

    ctrl + o -> ENTER -> ctrl + x.

    <virtualhost *:80>
      ServerName cloud.loc
      ServerAdmin webmaster@cloud.loc
      DocumentRoot /var/www/cloud.loc/owncloud
      ErrorLog /var/www/cloud.loc/logs/error.log
      CustomLog /var/www/cloud.loc/logs/access.log combined
      <directory /var/www/cloud.loc/owncloud>
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Require all granted

    Note: Substitue the correct path in your case. Save the file and exit. Then enable your newly created virtualhost by invoking the following command:

    sudo a2ensite cloud.loc.conf && sudo service apache2 restart

    Reference Images:

  • Step 10: Enable Apache Mods for ownCloud.

    sudo a2enmod rewrite ssl headers && sudo service apache2 restart

    Reference Image:

  • Step 11: Check your ownCloud domain and see if it’ll connect via HTTPS connection.

    Access your ownCloud domain using https://cloud.loc If you see a splash page saying This Connection Is Untrusted using Firefox, then that’s a good indication that you’ve configured SSL in ownCloud correctly.

    To continue, click I Understand the Risk and then Add Exception -> Confirm Security Exception.

    You should be then redirected to the Admin Web-GUI.

    Reference Images:

    In Google Chrome, you’ll see a page like this:

    Reference Image:

    You just need to click Proceed Anyway button to continue logging in.

  • Step 12: Create a new database for ownCloud installation.

    First login as root to MySQL server via commandline.

    Type-in the below code and hit ENTER key.

    mysql -u root -p

    You’ll be prompted to enter your MySQL root password (the you entered during Step 3), enter it and press enter key.

    Referecne Image:

    You should now see a new command-line starting with mysql>

    Create the new database by typing the following command and press ENTER key.

    CREATE DATABASE owncloud;

    Create new user and grant privileges to the new database.

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

    Then reload user privileges to set the privileges for the user.


    Done! Exit the prompt by typing exit + enter key.

    Switch to your browser and access your domain name. Then proceed to the next step.

    Note: owncloud and admin are for illustration purpose only. Use your own values.

  • Step 13: Install ownCloud by initiating the installation wizard.

    Browse to cloud.loc and fill up the necessary fields on that page.

    In my case, I’ve filled up the fields like so:

    • admin user-name => admin
    • admin user-password => admin
    • database user => owncloud
    • database password => owncloud
    • database name => owncloud

    After filling the necessary fields, click Finish setup button and you should be taken to the ownCloud admin page.

    If you reached the page similar to the image shown above, then you’ve successfully installed ownCloud on Ubuntu Server 14.04 LTS.

    To configure it as a file server with XBMC/HTPC, follow the post-install guide and configure ownCloud from it’s Web-GUI.

Post Install Configuration

The next task that you need to do is to enforce https connection to your ownCloud server. This settings will always redirect a user to the secure side of your server.

If a user just typed cloud.loc in the address bar, owncloud will redirect it to https://cloud.loc

So how to always enable HTTPS in ownCloud?

To enable HTTPS connection to your ownCloud-based file server, you need to login in again using the https protocol. So if you’re logged in right now, logout first and then login again using https://cloud.loc. Then navigate to main admin menu from the top-right corner of the page, then hover your mouse to Admin and click it, scroll down a little further till you see the Enforce HTTPS check-box. Tick the box and you’re done.

Reference Image:

Using The File Sync Feature

To use this feature, first create a client user account from the administration page. You may assign a group for this account and also provide disk quota. Doing this is very straight forward, thanks to ownCloud’s simple, clean but feature rich web-ui. After creating the account, install the client software which can be downloaded from

this page. You may choose and download the client software for either desktop clients or mobile devices. After downloading the client app, install and run it from your device. Installing it is fairly easy, especially on Windows and Mac.

To connect from Windows machines, run the app and fill up the Server Address in the following format:




Then click next, a new window should pop-up warning you about SSL connection, double check the certificate and tick Trust this certificate and finally click ok.

You should be then taken to the login windows. Now fill up the user-name and password field and click next.

The next dialog will let you choose your local folder, you may choose another folder or just accept the default folder path, which is profile-name\owncloud.

Click Connect then FINISH.

ownCloud should be running now already and minimized in your system tray like Dropbox does. Now you’re ready to make the sync.

Connecting from Mac or Linux is very similar, so you may just use this Windows guide as a reference.

Reference Images For Windows Client:

Connecting To WebDAV

After a successful installation, you got really excited and you wanted to test the server straight away. So you might ask, how to connect to ownCloud?

Connecting to ownCloud is fairly easy, you just need to get your WebDAV server address. In this case, my server address is https://cloud.loc/remote.php/webdav/. You could use an IP address instead of a domain name.

How to connect using Linux Mint? Connecting to ownCloud from a Linux Mint desktop is fairly easy, just open up your file explorer (ie. nemo) then go to main menu then:

Click File -> Connect To Server

A new pop-up mini-window should open. Fill up:

  • Click Type drop-down menu and select Secure WebDAV (HTTPS)
  • Fill up Server: with cloud.loc/remote.php/webdav/
  • User Name and Password

Note: Do not include the https or http when filling up the Server field, else it will throw an error saying, HTTP Error: Cannot resolve hostname (https). Finally, click connect to make the connection. Reference Image:

Connecting from Mac is fairly easy too and very similar. Just open up your explorer then go to main menu -> Go -> Connect to Server. How to connect from XBMC? To connect to ownCloud using XBMC, go to Video -> File -> Files -> Add Videos. Then click Browse -> Add Network Location.

A new mini-window should pop-up. The fill up the fields like so:

  • From the Protocol option menu, select WebDAV server (HTTPS)
  • Fill up Server address with cloud.loc or just an IP address
  • Fill up Remote path with remote.php/webdav
  • Fill up user-name and user-password
  • Finally, click OK to make the connection Then continue adding media files the usual way. Thats it! Reference Image:

Screenshot: Connecting XBMC to ownCloud WebDAV


With the power of Open Source projects, you can accomplish many things on top of ordinary. As you have witnessed in this guide, we’ve installed a web-server plus ownCloud in addition to your existing XBMC-based HTPC and Plex media server. This is made possible by our Host-OS, which is Ubuntu 14.04 LTS server. In this guide, you’ve learned how to install owncloud in Ubuntu 14.04, and also, you’ve build yourself an HTPC-File-Server combo from scratch using free downloadable software. So if you’ve completed this guide successfully, pat yourself on the back. For those who need further help or anyone who wants to improve this post, feel free to make a comment below. Thank you all for taking your time in reading this setup guide.


Hi, I'm Chubby! That's what my friends call me. I'm a tech savvy dude who is passionate in learning stuffs by himself. I post stuffs that I recently learned and also stuffs that I'm very knowledgeable of. I also post articles here to serve as my own reference and knowledge base archiving.