| « HOWTO: Install and Configure ssh | HOWTO Enlarge A VMware Disk » |
I use the rather wonderful bit of software called BackupPC to backup and restore my various PCs. The documentation is really very good and you should go read that rather than this mini-howto. ![]()
This document is really for me so I can remember what I did to get it setup and working. I already have a working system that is backed up . ...
This is done with apt-get that way all the dependent Perl modules get installed too. Well almost par2 didn't ![]()
During the installation you will be asked which web server to preconfigure BackupPC to use, I use Apache2 as it is already running on my backup machine.
I then ran the configuration script to customise the installation. I have a very large disk array on the machine I'm using as my backup server. So I created a new LVM logical volume called backup. That is where the data from all the backups will live.
sudo lvcreate -L 100G -nbackup vg1
I ended up using rsync transport, as the only windows I have are in the outside wall of my house. ![]()
Edit the file /etc/backuppc/config.pl customising it for your needs. Stop the service before doing the edit and update.
As I have my backup data store on an LVM drive, /backup, I need to move the existing directory and create a symbolic link to join them back up.
sudo chown backuppc:backuppc /backup
Change the Web access password, as I always forget to write down the generated one ![]()
cd /etc/backuppc
I like to change the hostname used for localhost to be the servers real name. You do that by editing the backuppc hosts file.
Restart the backuppc service.
Now check that the CGI interface is running, http://localhost/backuppc/index.cgi
To make the backup and restore more secure. We should remove the need for the backuppc user to ssh as root to all the client machines. To do this we create a shell script, it will be used for both backing up and restoring. We also need to allow access/permissions to sudo without a password for this command and nothing else.
Create the shell script BackupPC_rsync.sh
#!/bin/bash -f
sudo chown backuppc:apache /etc/backuppc/BackupPC_rsync.sh
And now to make a few changesto the config.pl script.
$Conf{BackupFilesOnly} = {
$Conf{BackupFilesExclude} = {
You should already have a user called backuppc that was created by the installation process. Set up ssh to work from the server machine so you can ssh to all the clients you wish to backup. See my mini-HOWTO on setting up ssh.
Create a new unprivileged user called backuppc
sudo groupadd -g 119 backuppc
Create a new shell script /etc/backuppc/BackupPC_rsync.sh
and then set the permissions so it is owned by root and executable by the backuppc user
and finally allow the user backuppc to run the command /etc/backuppc/BackupPC_rsync.sh as the user root without a password.
Edit the file /etc/sudoers and add the following line to the end
Comment out the option that requires a tty, this is on by default.
From the server make sure you can ssh to the clients as the user backuppc without the need of a password.
You should now be able to backup and restore.