OwnCloud: The good, the bad, the ugly.

posted in: linux, website stuff | 2

Motivation

Recently, I have been interested in making “my own Dropbox.”  It has been an idea that bounced in my head for quite a while before I took action.  There have also been various “holds” that have prevented me from actually taking a good effort of making my own cloud as well.

Why not Dropbox?

I have been using Dropbox in the past, and I must say that it has served me well.  If you aren’t looking to pay to store more than 8Gb (is it? feel free to correct this in the comments) of data for free, then it’s a clear winner.  The Android app is very well made (albeit large) and supports a very good camera upload feature (which I use very often).

However, it becomes necessary to use something else when transferring larger amounts of data.

I will also note that Dropbox doesn’t necessarily mean that your data is encrypted with top-secret nuclear-launch-style passwords.  Rather, Dropbox has the choice to give out your data if it should want to (say, you’re involved in a crime or something).

What “Holds”?

Router Admin Password

Much of this inaction was the result of my ignorance (and trust me, I have plenty of it) and Verizon’s router documentation.  The documentation clearly states that the router administration password might have been changed to the router’s serial number.  My ignorance followed this documentation, blind to the actual password, and this led me to an abundance of trouble.  The actual password was printed on a label attached to the bottom of the router and was much shorter than the router’s serial number.

DDNS Necessity

So now that my router troubles are sorted out, it’s time to set up DDNS and connect it to my domain name (bklu.me) through a CNAME record.  DDNS is a service that allows someone to connect to their dynamic IP addressed services (usually their house) from an easy-to-remember, static domain.  My choice for DDNS has been dyndns in the past, but the website labeling has led me to believe that their free DDNS service is no longer free.  (Correct me if I’m wrong once again.)

My choice then became no-ip.com because I saw their name in my router’s DDNS services.  Wow, what a great way to make important decisions that may impact the availability of my services to myself!  Everything related to getting a dynamic DNS was hassle-free, and they seemed to support the concept of free services (that don’t suck) through their advertising.

While I was waiting for my email to get through to my university inbox, I had the pleasure of watching no-ip’s advertisement on YouTube.  (Hey, they put the advertisement on their “Your Email Confirmation has Been Sent” page!)

Selecting a Cloud

I don’t know what to say about it except I read an article and found OwnCloud to support everything that I really need.

Basically, what I really need is just a method to host my own documents from my own server.  I don’t really mind much if the Android app isn’t free.  (There are free alternatives that I haven’t tried yet though.)

I’ll quote the article as far as OwnCloud’s features go and highlight each feature that I’ve tested so far.  (I might update this article earlier when I try the feature!)

  • Android and iPhone apps available (although they cost $0.99).
  • Desktop clients for Windows, Mac, and Linux.
  • Syncing of contacts & calendars between devices, and to the cloud.
  • Play music, and view images from within your browser.
  • Full featured text editor that allows you to create and edit a variety of text based files (think Notepad++ in the cloud).
  • Manage multiple users — set up a cloud for your whole family. You can also set up quota’s for these accounts.
  • Share files/folders publicly, or password protect them.

Setting Everything Up

Connecting bklu.me

I just added a cname record to my ddns record.

I should note that this did run into a bit of trouble with my “multi-universe” configuration of WordPress.  I have configured wordpress to register more blogs on WordPress under different domain names on bklu.me.  This was a bit shortsighted, and I simply had one virtualhost to handle all web requests.

I have now switched to a per-use basis and do not have one virtualhost to handle all requests.  This way, I can host other services under different subdomains and not have it all be WordPress.

Installing OwnCloud Server

The installation process was relatively easy.  I simply followed the procedure outlined by the download page (for Debian, of course).  And accessed the ownCloud directory from my preexisting web server  (remember, I used to host WordPress at home).

apt-get install owncloud

Apache Setup

I’m not sure where my previous configuration came from, but I needed to set up SSL as well (and I haven’t done that just yet).  This really is just for my use, so I don’t care if I have to say “yes” to my self-signed certificate.  (The apps for OwnCloud, like web browsers, always ask you if you want to accept shady certificates.)

I followed the instructions on this article, and I will summarize them below.

To make a self-signed certificate, one runs the following command (you can save yourself effort by changing mysitename to snakeoil when entering these yourself):

openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout ssl-cert-mysitename.key -out ssl-cert-mysitename.pem

It is critical to make sure that the CN field of the certificate is the name of your website and not your name. I believe it is acceptable to have a wildcard.

I moved the generated certificates to their “proper” locations.  To be honest, you could put these wherever, but it is better to put them where Apache2 expects them.

mv ssl-cert-mysitename.pem /etc/ssl/certs/
mv ssl-cert-mysitename.key /etc/ssl/private/

Make sure that the files are owned by root:root and are only writeable by root (644) (rw-r–r–).

It is then needed to enable the Apache2 virtualhost and edit it in order to get your certificates findable by Apache2.

This can be done (in the case of a Debian system) by creating a symbolic link between the sites-available and sites-enabled.  It is assumed ahead of time that the default HTML site is already enabled.

ln -s ../sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl

And the following lines should be edited in the configuration file (the changed section is bolded) (you do not need to change these if you entered snakeoil for your mysitename):

SSLCertificateFile    /etc/ssl/certs/ssl-cert-mysitename.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-mysitename.pem

And while you are editing the configuration file, it is necessary to allow overrides (from .htaccess files) in your SSL virtualhost.

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

More Packages

Although it isn’t necessary, it’s probably pretty important to install the PHP memory cacheing package.

On Debian, simply use your favorite package installer to get php-apc.  It’s more or less self-configuring from there.

Database

It isn’t necessary to create a new MySQL database (the SQLite included with OwnCloud will suffice), however, that’s not enough for me.  I already have MySQL installed and enabled on this machine, so it’s a process of creating a new user and a new database.

Creating a database is simple enough once you have the MySQL prompt up (see your documentation about this, I just use the mysql command.)

create database owncloud;

I simply followed the MySQL documentation to create a new user and granted the user permission on the owncloud database.  Since my database is running on the same computer I’m serving web pages on, I don’t need to do anything about the IP address permissions.

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES on owncloud TO 'newuser'@'localhost' WITH GRANT OPTION;

Final Leg: Web Configuration

By this time, it is acceptable to visit the OwnCloud website.

Simply enter the new username and new password and fill out the database section (it’s hidden behind a drop-down menu).

Plugins?

 I was actually expecting OwnCloud to play music in-browser out-of-the-box, but this is a (rather buggy) plugin!  I’ll go into more detail simply because it would be a bit easier for somebody to read this than go through the bug reports and Google searches that I went through.

Music Player Plugin

The music player is easily installed as other plugins in OwnCloud are installed.

Click the Add Apps Button.

OwnCloud Add Apps

You can find the music app under Multimedia.

OwnCloud Multimedia

Enable it by clicking on the enable button.  (I don’t have a picture of this.)

Troubleshooting the Music Player

The music player doesn’t seem to update when you delete music, so you have to reset the database manually.  I’ll summarize the MySQL commands below.

DELETE FROM *PREFIX*music_artists;
DELETE FROM *PREFIX*music_albums;
DELETE FROM *PREFIX*music_album_artists;
DELETE FROM *PREFIX*music_tracks;

Conclusion

Yeah, it works.

There are problems that Google can solve.  There are problems that have yet to be solved.

All in all, I would consider this worthwhile.  In fact, this article took longer to write than it took me to set up the server itself!

Now what will I eat for Lunch?

2 Responses

  1. vlad

    Hi!

    Thanks for the article!
    If you would like a more user-friendly file manager/sharing web app, check out FileRun (http://www.filerun.com). Not that you care much about it, but it does have a free Android app.

    Regards,

    Vlad

    • Brandon Lu

      Hi Vlad,

      Thanks for the response. I will take a look at filerun.

      It seems to look a lot like google docs. I will be pretty familiar with the interface.

      Thanks,
      Brandon

Leave a Reply to Brandon Lu Cancel reply

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