Owncloud Updating made somewhat easy




Here’s a small process I made to make an Owncloud Server update take less time, I’m currently using Ubuntu 12.04.  Owncloud is a DropBox alternative, the OpenSource version doesn’t have SSL enabled currently by default, you’d need, to add it.  I haven’t done so yet but I believe there are tutorials and how to’s.

What you need to do:

I usually use a working directory, I first started using a directory I created way back when I started learning Linux thanks to a tutorial and it stuck.  I usually use /var/ftp.  It doesn’t exist by default so you’d need to do a:  mkdir /var/ftp if it doesn’t exist OR you can simply change the script / commands to suite your needs.

Commands:

cd /var/ftp

wget http://download.owncloud.org/releases/owncloud-4.0.7.tar.bz2

touch owncloud.update.sh

nano owncloud.update.sh

* Then paste the below into that owncloud.update.sh file

#!/bin/sh
tar jxvf owncloud-*.bz2
cp -r /var/www /var/ftp/www
rm -r /var/ftp/owncloud/config
# cp -r /var/ftp/owncloud /var/www <– This copies default /var/www/owncloud if you used the default
# install instructions, I changed it in my install to use the Apache www root folder since it’s a
# dedicated server.
# Uncomment appropriately
cp -r /var/ftp/owncloud/* /var/www
/etc/init.d/apache2 restart

Then exit nano, I thin it’s usually control + x or control + alt + x.

I’d also do a manual copy of your /var/www.  That’s usually the default Apache location.  You can run:

cp -r /var/www /var/ftp/www.bkp

That will backup the /var/www contents to /var/ftp/www.bkp folder.  After, you can confirm the /var/ftp/www.bkp contents…it might be good to do so.  Even though the commands in the shell script do backup the directory to /var/ftp/www it’s always good when you first run something to be sure you back it up manually, manually check it and confirm.  Taking this step might save headaches until you know the script works like it should.  It’s possible your Apache doesn’t use /var/www/ as it’s directory!

So finally, run the script:

sh owncloud.update.sh

It should work like a charm…if you believe in charms that is ;)

You can confirm the upgrade took place by logging into your OwnCloud instance (usually http://yourserver if it’s in www like mine OR http://yourserver/owncloud).  Then click on:  Settings > Personal > Scroll down to the bottom, it should say something like:

ownCloud 4.0.7 (up to date)

If it doesn’t, to troubleshoot you can cd /var/www and then do an “ls” command to list the contents of the directory.  See if you see any unusual folders.  When I fist installed OwnCloud I installed it into /www/ so I could just go to my Apache www root by typing in http://yourserver.com however, when I first did an update I had my copy command incorrectly typed and copied the /var/ftp/owncloud folder into /var/www so it ended up being “/var/www/owncloud”.  I essentially left my old version in /var/www and had the new version sitting in /var/www/owncloud.  What I needed to do was then remove the /var/www/owncloud folder and recopy the contents of /var/ftp/owncloud into /var/www, then restart apache and it worked!

In the script you’ll need to figure out if you use the default /var/www/owncloud or if like me, you tweaked their install instructions to just use the Apache root www folder.  If it’s a dedicated server I think it’s best to use /var/www.