Hey, yes, you can do this, depending on how much access you have to the server, and then what resources you have to backup to. Here is a system I have just setup.
Webserver (where I have root) > readyNAS local storage (in my home)
- Install the root plugin on the readyNAS, allowing root to ssh into.
- Open firewall on home router to ONLY allow external access from Webserver IP
- Get Webserver public key text, in /root/.ssh/
- Copy this text to /root/.ssh/authorized_keys on readyNAS
Now Webserver can SSH into readyNAS without having to login, just using the public key. Next, create a shell (or PHP or whatever) script to backup all the files you want i.e
- Turn off services, like apache2, mysqld
- rsync backup the mysql folder + config files
- rsync backup the apache config folder
- rsync backup anything else of note
- Turn on services to resume normal server operation
The rsync is from my webserver, to the readyNAS. I use -a for archive mode, so its compressed, and incremental. I use a php script, run daily with CRON to define the root backup folder, using days of week. So we have a 7 day rolling incremental backup.
This is a pretty secure system i.e. ssh between to servers, with access on the target only allowed to one specific IP. Even better, the script could be designed to run repeatedly to different targets, giving you multiple backups at remote locations, if required.
In our case, we also use the same script, using rsync to backup files to another local disk on the Webserver. This time, not using days of week, but just a daily backup.
The key info to google for here i.s
- firewall, port forwarding and limit IP access
- setup ssh between servers via public .pub keys
- how to use rsync
- how to use cron
Why so paranoid? Well, we've just had two complete server failures on two different hosts. And this took us two weeks to recover from overall. So, backup like this really is a necessity....
Hope this helps