11. Backup Configuration Files

Most of the configuration files and scripts that are specific for this webserver, are kept in the directory /usr/local/config/ , so that they can be accessed and backed up easily. Even the config files that are not in this directory have a symbolic link inside it for easy access and for having a clear idea of the config files that are modified after the installation. A listing of this directory looks like this:

bash$ ls /usr/local/config/
backup.sh         network-config    network-setup    reconfig
config-files.txt  network-config-1  port-forward     smb.conf
CSP.ini           network-config-2  post-install.sh  source-nat
iptables          network-config-3  README

The backup of configuration files and scripts is done by the script /usr/local/config/backup.sh :

#!/bin/bash

tar cvpfz config.tgz --files-from=/usr/local/config/config-files.txt

The script backs up all the files that are listed in the file /usr/local/config/config-files.txt :

bash# vi /usr/local/config/config-files.txt

/usr/local/config/
/etc/sysconfig/iptables
/etc/rc.d/rc.local
/var/cache/csp/CSP.ini
/etc/samba/smb.conf
/boot/grub/grub.conf

In order to perform another installation of a server like this (or a re-installation of the same server), the backup file config.tgz (and cache rpm as well) is placed in the installation server:

bash$ ssh dasho@11.22.33.44 mkdir -p /var/www/html/backup/
bash$ scp backup.tgz dasho@11.22.33.44:/var/www/html/backup/
bash$ scp cache-5.0.4-1.i386.rpm dasho@11.22.33.44:/var/www/html/backup/

Also, they can be backed up in the Rescue partition (together with other useful data), so that they can be accessed easily in case of re-installation:

bash# mkdir /mnt/hda1
bash# mount /dev/hda1 /mnt/hda1
bash# mkdir /mnt/hda1/backup
bash# cp backup.tgz /mnt/hda1/backup/
bash# cp cache-5.0.4-1.i386.rpm /mnt/hda1/backup
bash# umount /mnt/hda1