Home » Linux » Archive by category "Xubuntu"

Duplicati – an alternative for Rackspace Cloud Files Sync

I’ve been using Rackspace Cloud Files Sync, a little piece of software I’ve written myself, for some years now. I use it to backup my photo’s and movies I’ve shot over the last decade or so. The thing I like about it is that it syncs your local folder with a Cloud Files container. When skipping content checksums it’s fairly fast to only process the changes. Aside from backing up files it can also restore them.

Whilst it still serves my need I get in trouble if or when Rackspace changes their Cloud Files API. Way back when I wrote the software I wrote it in BlitzMax with the MaxGUI module (using the excellent LogicGUI designer) and my own htbaapub.rackspacecloudfiles module. Sure, I can update my module that wraps the REST API but I no longer have an up to date BlitzMax with all the required modules set up on a PC. When I took Maximus offline the most convenient way to install BlitzMax modules and their dependencies disappeared. In short, it’ll be a big hassle to get a working setup again capable of compiling a new version of Rackspace Cloud Files Sync.

But today I found out about a software called Duplicati! Duplicati is backup software that can create and store backups to several kind of storage solutions such as Rackspace Cloud Files, Amazon S3, Windows Live SkyDrive, FTP, SSH and more. It can also encrypt your backups.

After a short test using Duplicati with Cloud Files I’ve at least found a nice alternative for when my Rackspace Cloud Files Sync stops working. The only thing I’m missing though is doing a full backup and then sync the changes like my software does, but it appears that this is already supported in the 2.0 preview release of Duplicati. So it’s likely that if or when my software stops working I can use the 2.0 release of Duplicati.

Monkey X Pro – 30% Discount

Monkey X ProA couple of days ago I received an e-mail by Blitz Research Ltd offering me a nice discount on Monkey X Pro, which I took advantage of. To show some love towards BRL and Monkey X Pro I thought I would share the offer here.

Monkey X Pro is a programming language for creating games which can be deployed to several targets including, but not limited to, Android, iOS, HTML5, Desktop, XNA, Ouya and more.

When you buy Monkey X Pro simply enter the coupon code MONKEYX30 for a 30% discount.

Now go buy it and support BRL!

Note: this offer is only available for a limited time and is available until 2nd June.

Enabling Bash auto-completion in Ubuntu

Virtual Private Servers are usually installed with the minimum required software. More often than not this means Bash auto-completion isn’t enabled, which is a tad bit annoying as it slows down navigation.

To fix this you can install the bash-completion package. Like so:

$ sudo apt-get intall bash-completion

Using rsnapshot for daily PostgreSQL backups

Having done backups for MySQL using rsnapshot before I recently had to do the same thing for PostgreSQL. Turns out PostgreSQL has similar tools to do this and it’s actually quite easy to set it up.

First, assuming rsnapshot will run under the root user you’ll need to create a .pgpass file at /root/.pgpass that will hold the credentials that are required for setting up a connection with your database. The expected format is host:port:database:user:password, so for example:

localhost:*:mydbname:myusername:mypassword

With that in place create a shell script that will use this file and run the pg_dump program. Put it some place you can remember, e.g. /usr/local/bin/postgresql-backup.sh:

#!/bin/bash
export PGPASS=/root/.pgpass
pg_dump -w -h localhost -U myusername mydbname > postgresql-dump.sql
gzip postgresql-dump.sql

Again, just as with the using rsnapshot for daily MySQL backups article you need to configure rsnapshot.

Next is setting up /etc/rsnapshot.conf which is easy as well. At the end of this file you’ll find all the instructions of which directories to backup. Enter the next line. Do note that rsnapshot.conf uses a tab to separate values.

backup_script   /usr/local/bin/postgresql-backup.sh  postgresql/

To enable daily backups uncomment the next line:

#interval       hourly  6
interval        daily   7
#interval       weekly  4
#interval       monthly 3

To make rsnapshot run every day update /etc/cron.d/rsnapshot:

# 0 */4         * * *           root    /usr/bin/rsnapshot hourly
  30 3          * * *           root    /usr/bin/rsnapshot daily
# 0  3          * * 1           root    /usr/bin/rsnapshot weekly
# 30 2          1 * *           root    /usr/bin/rsnapshot monthly

Finally, try running rsnapshot. After it has run check your backup directory, which on Ubuntu 12.04 defaults to /.snapshots/. Be sure to mount /.snapshots/ on a separate drive. Because what use is it if your data drive contains your backup and decides to commit suicide?

$ sudo rsnapshot daily

Your PostgreSQL backup file should now be located at /.snapshots/daily.0/postgresql/postgresql-dump.sql. You can restore this file with the psql commandline utility.

Private Wiki – DokuWiki on Lighttpd

I had planned on setting up a private Wiki to use as a personal clipboard collection of useful snippets for some time now but never got around to it. This week I decided it was time to get it done and so I started searching for Wiki software. I ended up trying MediaWiki but ran into installation issues due to PHP’s session.save_handler not being set. After changing it I ran into more issues and with MediaWiki unable to store session data I couldn’t proceed. I’m not sure why MediaWiki requires this setting though as I run several WordPress websites and some other PHP code as well and they’re not having this issue.

Moving on I found out about DokuWiki which is really easy to install! Simply download the package, extract it and you’re done! It doesn’t require special database software such as MySQL – it stores pages on disk. Zero hassle and easy to use as well!

Since I’m not using Apache I can’t use .htaccess files. DokuWiki has a couple of folders which should not be exposed to the outside world. For Lighttpd my configuration looks like this:

$HTTP["host"] =~ "^wiki.example.com$" {
    server.document-root = "/home/example/wiki.example.com/httpdocs"
    # deny access completely to these
    $HTTP["url"] =~ "/(\.|_)ht" { url.access-deny = ( "" ) }
    $HTTP["url"] =~ "^" + "/(bin|data|inc|conf)/"  { url.access-deny = ( "" ) }
}

And you’re all set!