I'm currently in the process of installing a bunch of stuff I need and getting setup my Linode that I recently purchased. Being a Linux newbie, I'm doing pretty well - but one small mistake can screw everything up for me.

I've currently got apache2 and some other things successfully installed and setup how I want them, and DO NOT want this to be ruined by some newbie mistake. What is the easiest way to backup the actual environment itself so that I can restore the backed up environment (with apache2 and things fully working) if I mess up?

link|improve this question

If you don't mind paying linode have a backup service which has automated backups and you can do manual snapshots. – Rwky Sep 3 '11 at 0:15
Unfortunately I don't have the money to pay for this service :( – Joesavage1 Sep 3 '11 at 8:16
feedback

2 Answers

up vote 4 down vote accepted

So there's two things,

  1. back up your data and configuration files
  2. write down / record the commands you used to build the environment and why

For number 1, there are several options, one of which Alex has already mentioned. rsync is a nice approach, and I rsync everything I care about on my Linux VPS to a Linux machine here at home on a regular basis.

But for me, you can't beat #2 as well, and here's why. Just having the config file doesn't help if you can't remember why it's like that.

Sometimes I fight for ages getting Exim to do one little thing, make a change 400 lines deep into a config file, and then forget it.

Even if I don't recover the server from a backup, I might want to build another server later and do the same thing, but suddenly I can't remember how, and you can't necessarily copy config files verbatim.

So, as you build and configure your server,

  1. write down every command you run (i.e. apt-get, yum, dpkg --reconfigure exim4-config, etc.)
  2. make a note of config changes you make and why (i.e. added these 4 lines to /etc/apache2/apache2.conf because I needed X and Y)

Keep that build document up-to-date when you add packages or change configs and then if you need to build a new server from scratch, it's easy.

I run a news (Usenet) server, and I basically have a document which describes how to go from bare Debian Squeeze to fully working news server. If I lose everything, I can rebuild it in about 2 hours (obviously, no data, but full config). Same for my web server, I know what changes I've made to Apache and why, which perl and php modules are installed and why, etc.

That way you can focus on backing up your data, and config, but you won't ever have to restore the config to a fresh box (which I think can be risky due to potential software / distribution changes) and can instead follow your build sheet and then restore your data.

  • rsync for data and config
  • paperwork for config on top
link|improve this answer
1  
gnu screen or script might provide you useful alternatives to writing everything down, but you will need to be able to get basic access to the system to review your logs. For your exim config example. Almost every configuration file supports comments. I usually leave a comment like #MYNOTE in config files. Something that will help me find it in the future with a simple grep. – Zoredache Sep 2 '11 at 23:26
Number 2 sounds like an amazing idea - but I can't remember the commands I've used to get this far! Is there any way of seeing my command history for how I've managed to get to where I am? – Joesavage1 Sep 3 '11 at 8:11
The 'history' command will help but it only goes back so far, and doesn't show which files you've changed. – EightBitTony Sep 3 '11 at 9:14
Ended up just using rsync - works a treat! – Joesavage1 Sep 3 '11 at 20:12
feedback

I usually use etckeeper for backing up configuration files in /etc (actually for revisioning them), I set it to perform commit every 20 minutes and BackupPC for backing up everything else. BackupPC is probably an overkill in your situation so I suggest you to use just rsync -a to some other host.

link|improve this answer
Is the etc directory the only real important one though, or are there other things I need to backup? – Joesavage1 Sep 3 '11 at 8:10
feedback

Your Answer

 
or
required, but never shown

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