Skip to main content

s9y backu^Wrestore

Of course I do regular backups of my Serendipity installation. As all articles are stored in a MySQL database, I only have to backup that plus serendipity_config_local.inc.php and the uploads directory. But I always wanted to know if a restore would work. And it does, with a few alterations, as the system I'm restoring to is slightly different from the original:

First we restore the files and directories:

$ tar -xjf serendipity-1.5.4.tar.bz2
$ mv serendipity s9y && cd s9y
$ chmod 0775 templates_c uploads
$ sudo chown root:www-data templates_c uploads
Or, if you're using an SVN checkout:
$ svn co svn://svn.berlios.de/serendipity/trunk serendipity-svn
$ mkdir /var/www/html/s9y && cd /var/www/html/s9y
$ for i in ../serendipity-svn/* | egrep -v 'templates_c|uploads'; do ln -s "$i"; done
$ mkdir -m0775 templates_c uploads
$ sudo chown root:www-data templates_c uploads
Import our configuration and the database backup:
$ cp ~/backup/serendipity_config_local.inc.php .
$ mysql -e 'create database s9y;'
$ bzip2 -dc ~/backups/s9y.sql.bz2" | mysql -D s9y
Because my DocumentRoot on the new machine is different and is not stored in serendipity_config_local.inc.php (why?) but in the database, we have to make a small modification here:
$ cd /var/www/html/s9y/
$ ln -s serendipity.css.php serendipity.css

$ mysql -D s9y
mysql> update serendipity_config set value = '/var/www/html/s9y/' \
            where name = 'serendipityPath';
mysql> update serendipity_config set value = 'http://10.10.0.3/s9y/' \
            where name = 'baseURL';
Note that the trailing slash is important! With all that, our s9y installation is working just fine.