Backup of Webserver

The backup of a webserver is not always as straightforward as the backup of your computers at home or just a single website etc. This blog states how I do it.


### set to the server address of your server:

## login as root and create the file /serverbackup.tar.gz containing /etc /var and /home but without some not-so-important dirs:
ssh root@$serveraddress 'cd /; tar cfvz serverbackup.tar.gz /etc /var /home --exclude "/var/log" --exclude "/var/cache"'
## copy the file to your local machine and name it according to the current date:
scp root@$serveraddress:/serverbackup.tar.gz ./server-backup_`date +%Y-%m-%d`.tar.gz

I don't explicitly backup my MySQL databases but I can start mysql in a chroot environment and usually can recover almost all data.