Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

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.

share|improve this answer

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.

share|improve this answer
    
True.. I didn't want to get into differential backups or the need to run a second system for pushing or pulling the backups. –  Tim Brigham Apr 17 '12 at 12:51

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.