Tag Archives: dropbox

Backing up my wordpress blog and website using Ubuntu

I’ve been noticing that my webhost server keeps going down for a few hours every day and it scares me that I’ll lose all my data. So, I started looking for automatic backup solutions and this is the best way I could come up with.

Backing up the wordpress database:

I’ve tried the following plugins

1. WordPressbackup.com
This plugin backs up my data to their server automatically. only backs up the database though. must register for a free account at wordpressbackup.com. The backups occur once every few days.

2. Bei-fen
This plugin backs up my data including images and files to a location on my server

3. DBC Backup
Does a cron backup automatically at any location on my server at any time interval I set it for. Only backs up the database.

4. WP-DB-Backup
Can schedule the database to automatically backup to your server or automatically email them.

5. SMEStorage Backup
Based on WP-DB-Backup. Must register for a free account at http://www.smetube.com/smestorage/ and you can backup your data to a cloud storage service like Amazon S3 or Box.net. You can even have the backups sent to your email.

Backing up my whole website from my webhost to my computer:

I use a tool call rsync in linux to automatically sync my public_html directory on my webserver to a backup folder on my Computer which is synced automatically with Dropbox. You can also use Ubuntu One. For this tutorial your web host must have ssh enabled. If you can’t get ssh, then backup your wordpress website over ftp with curlftpfs on Linux.

Follow these steps:

1. Sign up for an Ubuntu One account or a DropBox account and download/install the desktop client. You can get a 2GB account for free.

2. Download the necessary files
sudo apt-get rsync ssh

3. Set up autologin with ssh so you won’t have to enter your password each time.
sudo ssh-keygen -t dsa
press enter each time without changing anything. this will make a id_dsa.pub key in you .ssh folder.
copy the ssh key to your server using scp
scp /home/user/.ssh/id_dsa.pub user@yourserver.com:
login to your server using ssh
ssh user@yourserver.com
enter password and append the key to authorized_keys
cat id_dsa.pub >> .ssh/authorized_keys
remove the key from the home directory on your server
rm id_dsa.pub

4. Set up a cron job to sync the public_html folder to your dropbox folder
crontab -e (do not sudo)
open with editor like nano
enter something similar to the following line
* */5 * * * rsync -avz --rsync-path=/usr/bin/rsync -e ssh user@yourserver.com:home/useronserver/public_html /media/sdawhatever/locationof/dropbox/backup/
(this is telling cron to sync every 5 hours, for more help with cron check wiki)
press ctrl+O to save file, enter to save, ctrl + X to exit.

thats it, your done!