Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've set up two linux boxes (dedicated hosting) and I want to make a backup of the server settings on both just in case something goes wrong and I need to restore the settings.

The hosting provider and I have made changes to the following:

csf
iptables
php settings
/etc/resolv.conf
NFS configuration (NFS settings, /etc/exports, etc)
a few services currently running / enabled
  1. Is there anything else that I should be taking a backup of?
  2. What are the proper commands for backing each of these up?

Its a RHEL5 system and my application is using PHP + MYSQL. I dont know where I should pick up custom MYSQL settings from.

share|improve this question
    
Nothing special about iptables here, so I removed that flag. –  Kevin M Oct 11 '10 at 14:50

3 Answers 3

up vote 2 down vote accepted

A few notes about items you mentioned:

  • iptables keeps all its settings in /etc/sysconfig/iptables
  • The key with php is in /etc/php.ini. Yes, a .ini file on linux. I believe it also keeps some information under /etc/httpd/conf.d/php.conf, if you also have apache installed.
  • /etc/resolv.conf is the file that controls where the nameserver is that the system uses.
  • nfs config info is under /etc/exports
  • service run state is all controlled by the status of /etc/rc.d and the links under there.

So if you back up everything under /etc as sleske mentioned, you should be good.

The one exception is that stock MySQL databases are kept in /var/lib/mysql. But if you try to back up that directory, you might run into file locking issues. So what you should do is to run mysqldump --all-databases > your_backup_filename and then back up your_backup_filename. To automatically run it, put it in a cronjob.

You don't mention what program you use to make php useful, maybe it's Apache? If that's the case, then you'll also probably want to back up /var/www; all Apache's documents/logs go there.

share|improve this answer
    
+1 Thanks for checking all the packages mentioned, I was too lazy to do that :-). –  sleske Oct 11 '10 at 15:24
    
BTW: It's true that MySQL DBs are under /var/lib/mysql, but that's not really "configuration data", that's application data - the question was only about configuration data. Still, good to point it out. –  sleske Oct 11 '10 at 15:25
    
Yes thanks Kevin! And sleske - any clue about 'configuration' data related to MYSQL? –  siliconpi Oct 11 '10 at 15:28
    
Either of you guys have inputs on other settings I should be backing up as well? –  siliconpi Oct 11 '10 at 15:30
    
@matt_tm: check my new paragraph on Apache. –  Kevin M Oct 12 '10 at 3:06

By convention, under Linux all configuration settings are stored in files under /etc/ (for systemwide settings), or in dotfiles/dot-directories in the user's $HOME (for user-specific settings). Sometimes there may be stuff under /usr/local/etc, for apps installed under /usr/local.

So backing up that should be enough.

There are a few exceptions (e.g. boot manager configuration is under /boot, though e.g. Debian autogenerates the file from a file under /etc/ to maintain the convention), but I don't think any of the packages you list do this.

Of course, for an easy restore you should just back up the whole server (possible excluding some huge files you don't need). Why don't you just make a full backup?

share|improve this answer
    
umm - is there some tool that allows an easy backup / restore mechanism? Sorry, new to linux administration –  siliconpi Oct 11 '10 at 13:07
    
No, I've never heard of one. Just backup /etc/and the home dirs (using tar or similar). A hypothetical backup/restore mechanism could not do more anyway, without special support for every program installed, which seems difficult. –  sleske Oct 11 '10 at 13:16

You might want to look into etckeeper

share|improve this answer
    
A good tool, but not really meant as a backup (though that's a side benefit). For "just a backup" it might be too much hassle to set up... –  sleske Oct 11 '10 at 15:26
    
I'm surprised others havent run into similar issues on their server administration adventures... –  siliconpi Oct 11 '10 at 15:47

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.