2

I'm running a new dedicated server and am looking to backup the general apache config and all other server configurations including php.ini

Does the WHM backup tool cover this or should I seek another route?

1
  • 1
    ............rsync?
    – jldupont
    Dec 12, 2009 at 2:34

4 Answers 4

4

I'd suggest installing etckeeper, which is a toolkit that puts your /etc tree (where all your settings including php.ini and httpd.conf should be located) in a local version control system. It can autocommit on package installation and removal, and has some other nifty features.

Some tutorials:

Etckeeper supports various version control systems to store your configs in. In your case I would suggest setting it to use a distributed vcs (DVCS), such as Bazaar or Git. I think Bazaar is the default but this can depend on your distribution.

Using a DVCS allows you to push the entire history from the server's vcs to a remote server regularly (via a cronjob for example), in effect creating a local versioned history, with an identical remote backup. You could use a private github, bitbucket, or whatever account, or run your own backup server.

If you and your colleagues use sudo while administering the server, the commits will even be tagged with your account name, allowing you to see who changed which setting.

It may sound a little more complex than simply copying the config files to a remote server, but I believe this is a much better solution. It gives you all the advantages of a version control system:

  • Fully versioned backups with logs and unlimited history.
  • Accountability
  • Easy rollbacks, full or partial
  • Easy diff and browsing of your settings

Etckeeper is available as a package in most Linux distributions.

P.S. Another option could be to install Jungle Disk Server Edition and use it to backup the /etc directory. This gives easy off-site secure backups and restores, with support for multiple versions and deleted files. It doesn't provide easy diffing, accountability and unlimited history, which is why I mention it last.

1
  • 1
    +1 for version control in general and etckeeper specifically. If you then also write nice commit comments you also get some extra system documentation for free.
    – andol
    Jan 12, 2010 at 9:32
1

Here's the content of the script that backs up my blog:

$ cat arc_blog.sh
#!/bin/bash

DATE=`date +%Y%m%d`
BACKUPDIR="/home/###USERNAME###/backup"

rm -fv $BACKUPDIR/$DATE.webroot.tar.gz
tar czvf $BACKUPDIR/$DATE.webroot.tar.gz /var/www
rm -f $BACKUPDIR/webroot.tar.gz
ln -s $BACKUPDIR/$DATE.webroot.tar.gz $BACKUPDIR/webroot.tar.gz

mysqldump --user=backup --password=###PASSWORD### -A > $BACKUPDIR/$DATE.allDBs.sql
rm -fv $BACKUPDIR/$DATE.allDBs.sql.gz
gzip -f $BACKUPDIR/$DATE.allDBs.sql
rm -f $BACKUPDIR/allDBs.sql.gz
ln -s $BACKUPDIR/$DATE.allDBs.sql.gz $BACKUPDIR/allDBs.sql.gz

echo $DATE > $BACKUPDIR/current

In plain english, it sets the date and the backup directory, removes any existing backup for today then creates the new backup in a gzip'd tarball, with the date specified in the name.

Being added to this script soon will be an upload method to Amazon's S3 cloud. Don't want to be in a total loss situation like Jeff and Joel were.

1

This might be a bit much for what you need, but a server management tool like Puppet or AutomateIt is really useful if you ever want to set up a completely new server based on your existing configuration, or maintain multiple servers with a standard config.

0

Gotta second the rsync suggestion. Actually id probably make a quick shell script to do historicals to a tar.gz as well as keep the current expanded - set up some keyed ssh and a cron tab and youre done.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .