I would like to setup a cron job for to backup all my web server files to a compressed file and also my MYSQL db. I have full acces to my server as it is a VPS. I am a noob at linux and could really use the help. I am also running centos 5. I would appreciate any help I can get. Also what is the fatsest method to do this.

3 Answers
3

Depending on the size of your site one if the easiest ways would be to do a database dump, create a tar.gz archive of your site directory and dump file and email it to an external location.

Look for example scripts on using tar and MySQL database dumps. The hardest part for new admins in this kind of setup is getting the email working. If you don't already have an email server set up it is probably easiest to use gmail or equivalent.

I have a couple clients that use almost this exact method. If you want more detail just ask.

I used to do exactly what Tim Brigham described but these days I no longer compress the dump files. Instead I use rsync to transfer the files. Because most databases only change relatively little between backups and rsync only transfers the changes the data is transferred much faster. This can be of particular benefit with largish dump files.

I agree with John Gardeniers, rsync is great. Not too difficult to configure, can be automated and very powerful. You may also check with your host to see if they offer a backup solution. Some of the more reputable providers offer full server backups at VERY reasonable rates.