Owncloud backup server on Ubuntu 14.04

Logged into Owncloud for the first time

I've been mulling about the past several weeks trying to figure out a really good project to work on that will be a productive use of my time at home. With Maria (my better half) doing more business at home I figured it was high time that I started automating backups for her, and at the same time I've been thinking about setting up a web-based POS (Point Of Sale) to help her track sales and clients.

This post is about the first part of that project, and it's just 'part 1' in which I'm going to focus solely on the installation of Owncloud. In part 2 I'll talk about the client side configuration for Windows, Linux, iOS and Android devices. Finally, in part 3 I'll look at the physical server, it's an interesting discussion in itself.

Why Owncloud, why not Nextcloud? Quite simply I've run both and found the add-ons worked better for me in Owncloud.

With Ubuntu 14.04 server already installed on the box I followed the steps on the Owncloud server here: https://doc.owncloud.org/server/latest/admin_manual/installation/source_installation.html#ubuntu-installation-label

Sadly the steps for calculating md5sums or sha256sums don't actually work because I couldn't find any .md5 or .sha256 files on the Owncloud server. The steps listed for 14.04 mostly worked fine. Of course I got the "could not reliably determine the servers fully qualified domain name" error which was solved by typing:

echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf sudo a2enconf fqdn

That solved I next pondered the use of mariadb, having only ever used mysql. It's the same syntax to get into mariadb:

mysql -u root -p

Mariadb displays the mariadb prompt (even though we're typing mysql on the cli, I suppose it will change to mariadb at some point). I saw a note somewhere that mentioned converting to mariadb might not be backwardly compatible with mysql. No issues there with this machine at this point, and if there are in the future I'll figure it out then.

In mariadb I created a database for owncloud and set up user access, password and permissions on the database to a user other than root.

One point of concern I have with Owncloud is that they recommend setting up the folder with the user and the group as www-data. There's a line in the setup that suggests you should:

chown -R www-data:www-data /var/www/owncloud

I'm far from being a security expert, but I thought it was bad practice to have the user name as www-data. I trudged on and used their advice since this isn't a directly Internet accessible share. But I still have concerns about it.

At this point I thought I was ready to install Owncloud from the web-based installer, so I opened a browser and typed the URL only to be greeted with the message:

Argh! Updated Ubuntu 14.04 is running a release of PHP too old to work with Owncloud 10. To be fair the instructions were for Owncloud version 9.1. After a quick Google this didn't look like it was going to be much of an issue - I could just add a PPA for version 5.6.0. I found the advice on adding a 5.6.0 PPA here: https://joshtronic.com/2014/08/31/upgrade-to-php-56-on-ubuntu-1404-lts/. The only problem is when I tried to add-apt-repository Ubuntu Server 14.04 didn't understand the command.

Supposedly installing python-software-properties solved this error, but it didn't for me. It worked after I also installed software-properties-common.

sudo apt install software-properties-common

After this adding the PPA worked just fine. I ran:

sudo apt update sudo apt upgrade

I was hoping this might upgrade the old version of PHP, but it only removed libvpx1, installed libssl1.0.2 and libwebp5, and upgraded libbsd0, libedit2, libgd3, libjbig0, libpcre3, and openssl. Now my concern is that some of the packages referred to in the first set of instructions on the Owncloud site might not work as expected since I'd need other PHP5.6 files beyond just the install. So I ran an apt search on some of the files:

apt search libapache2-mod-php5

The result was:

ibapache2-mod-php5/trusty-updates,trusty-security,now 5.5.9+dfsg-1ubuntu4.21 amd64 [installed]
  server-side, HTML-embedded scripting language (Apache 2 module)

libapache2-mod-php5.6/trusty 5.6.30-10+deb.sury.org~trusty+2 amd64
  server-side, HTML-embedded scripting language (Apache 2 module)

libapache2-mod-php5filter/trusty-updates,trusty-security 5.5.9+dfsg-1ubuntu4.21 amd64
  server-side, HTML-embedded scripting language (apache 2 filter module)

php5-cgi/trusty-updates,trusty-security 5.5.9+dfsg-1ubuntu4.21 amd64
  server-side, HTML-embedded scripting language (CGI binary)

php5-fpm/trusty-updates,trusty-security 5.5.9+dfsg-1ubuntu4.21 amd64
  server-side, HTML-embedded scripting language (FPM-CGI binary)

php5.6-fpm/trusty 5.6.30-10+deb.sury.org~trusty+2 amd64
  server-side, HTML-embedded scripting language (FPM-CGI binary)

So basically anything with php5 from the Owncloud instructions could probably be replaced with the 5.6 instructions. I've done this once before on a server where I had to downgrade from PHP7 to 5.6 so the process looked a bit similar. For that particular package it was better to use Ubuntu 14.04, but Owncloud would have probably worked without issue if I had of installed Ubuntu 16.04 on this server. Continuing I tried:

sudo apt install libapache2-mod-php5.6 php5.6-gd php5.6-json php5.6-mysql php5.6-curl php5.6-intl php5.6-mcrypt

It's worth noting that I searched to make sure each of the packages was there and there was one notable absentee, no php5.6-imagick in this PPA. Fingers crossed. While this installs some of the common PHP packages for 5.6 I remembered 5.6 still wouldn't be the default.

sudo a2dismod php5 sudo a2enmod php5.6 sudo apache2 restart sudo update-alternatives --set php /usr/bin/php5.6

This got me a whole lot closer. I opened my browser and tried to open the Owncloud web-based installation only to find out that I was still missing a bunch of PHP modules, though imagick didn't seem to be listed.

Owncloud missing PHP modules

From this I basically searched and installed each necessary module:

sudo apt install php5.6-zip php5.6-mbstring sudo service apache2 restart

A little closer, but still missing a bunch of XML-related and the dom dependency. Turns out I was simply missing php5.6-xml.

sudo apt install php5.6-xml sudo service apache2 restart

Bingo, this last package did the trick for me and I was able to install Owncloud. It turns out that this one package solved the rest of the XML/dom-related dependencies.