Linux/Unix/BSD: rsync
Software: rsync (builtin) Compatibility: Setup Time: Less than 15min Current EV Setup Script: Legend: |
||
Here's how to setup rsync to backup certain directories on a Linux/Unix/BSD server, or even the entire system, to ExaVault backup servers. If you need any help, send us an email or give us a call. Info is on the Contact Page.
Remember Your Username: In the instructions below, you should replace any instance of username with the login name that you were given when you signed up for your account.
Note on Other Servers: Several people have asked us if it is possible to use these instructions to setup rsync to servers other than ExaVault. While we certainly encourage the use of our backup plans, the answer is yes; you are welcome use these instructions to backup to any server. All you need to do is make sure you have rsync running on the remote server, replace username.exavault.com below with use your own server's name, and manually add your SSH key to your authorized_keys file in the 'Activate Your Key' step, below.
Step I. Setup a Security (SSH) Key & Copy It To ExaVault
rsync, the software you will be using to backup your data to the ExaVault backup servers, comes free with Unix. In order to make a secure connection to the ExaVault backup servers, you need to create an SSH key.
You'll want to run all
of the commands here as the Unix 'super-user'
(root), so that
you have full access to all the files on your
machine. To do this, we preface each command
with 'sudo', as shown below. Unfortunately,
not all systems have sudo installed. If
yours doesn't, you should login directly as
the root user, and then use the commands as
shown, but without the 'sudo' prefix.
I.a. Create the backup directory. All
of your backup configuration files need to be
stored somewhere. We recommend /backup. Issue
the command to create the directory:
sudo mkdir /backupYou will need to enter your unix login password here, to authenticate yourself. If you get an error that you are not in the proper group, you'll need to contact your system administrator to put you in the 'root' or 'wheel' group, so you can use sudo.
I.b. Create the Key. Issue the command:
sudo ssh-keygen
-f /backup/ssh_key -t rsa -N '' (Please
note those are two single quotes)I.c. Upload the Key to ExaVault. Issue the command (all on one line):
sudo rsync -e ssh
/backup/ssh_key.pub username@username.exavault.com:ssh_keys/key1.pubThis will ask you if you want to connect to username.exavault.com, since the host can't be verified. Type 'yes'. Then it will ask you for your account password, which you should enter. If it doesn't say anything after that, the upload was a success. If it didn't work, check your username and password, and make sure you replaced the word 'username' above with your actual username.
Note: if you are planning to use this account
for multiple servers, you should rename key1.pub
to key2.pub for the second server, key3.pub
for the third, and so on.
I.d. Activate the key. Issue this command:
ssh username@username.exavault.com
addkeysAgain, you will be asked for your password. This
command copies your public keys (e.g. key1.pub)
to the 'authorized_keys' file in your backup
account. This is the last step in setting up
the secure link.
Step II. Test the Backup
Now you've got the authentication all setup. All that is left is to start the backup. We strongly recommend you do a small test backup first, to make sure everything is working.
II.a. Run a test backup. The command below will backup all the files in your /etc directory to the 'backup-test' directory on the backup server. Type this all on one line.
sudo rsync -avz -e
"ssh -i /backup/ssh_key" "/etc" username@username.exavault.com:backup-testYou should see all the files from your /etc directory being transferred to the backup server. If you don't, triple-check all your settings, and if you still don't, contact us for help.
II.b. Verify the test
backup. Using an SFTP
program, login
to your account via SFTP and navigate
into the 'backup-test' directory. You should
see the files from your desktop in that directory!
Assuming that everything looks good, you may
want to delete those files so they don't use
part of your quota.
Step III. Setup & Automate the Backup
The final step is to setup and automate the backup. You'll use a small script to do this, and we've created a sample for you to help you get started.
III.a. Decide what to backup. You'll first need to decide which files and directories you want to backup. You are welcome to backup whatever data you like; however we recommend focusing on critical customer data first and foremost.
III.b. Setup a backup script. You'll setup all the rsync commands to run via a shell script, which can be run via 'cron' on Unix each night. We've provided a sample for you to get started; after you download it, read through the comments in the file for more instructions. You should store the files in the backup directory you created earlier (e.g. /backup). Download Now »
III.c. Run your first FULL backup manually. (Optional) We recommend you run your first full backup from the command line, so that you can monitor it in case anything goes wrong. To do this, just run the backup script after you've got it setup:
sudo /backup/data-backup.shIf it doesn't work, make sure that you've double
checked all your settings in the script. Also
make sure the script is executable by the root
user (generally, typing 'chmod 755 /backup/data-backup.sh'
will fix any permission issues). If something
is still wrong, contact
us.
III.d. Setup cron to run your script. 'Cron' is a program on Unix program that is designed to run scripts, such as the backup script, on a preset schedule. We've included a cron sample file in the download; open it and read the directions to see what you need to change. To install it all you need to do is say:
sudo crontab /backup/backup_cron.txt Important: If you're already using
cron for other things, you should install the new
lines by hand rather than use the command above,
which will overwrite anything already in cron.
To check if you have any cron commands already,
use sudo
crontab -l. To
edit the file directly, use sudo crontab
-e.
You're Done!
You're now done! Your computer will backup the data you specified whenever you've asked it to, using the efficient rsync protocol. If you ever want to check the backup, simply use SFTP to go into the backup server and look at your files.
