In this blog post I will show you how to install and configure BackupPC using Ubuntu 14.04.1. I have installed a Ubuntu Server 14.04.1 with IP address as follows:
IP address: 10.0.0.12 Subnet Mask: 255.255.255.0 Default gateway: 10.0.0.254 DNS Server: 10.0.0.2
The server was installed with OpenSSH server option selected.
For full instructions on the installation process of Ubuntu Server 14.04.1, please refer to the following instruction: http://dalaris.com/postfix-part-1-ubuntu-linux-server-14-04-1-installation/.
First, SSH to the server using my credentials:
Once logged in, elevate the account to root by typing sudo su and enter the password for your account.
First, perform the update and install backuppc using the following commands:
sudo apt-get update sudo apt-get install backuppc
Note that an extra 67.3 MB of disk space will be used to store backuppc.
Use Local only option as we are not installing postfix server.
Choose localhost as mail system name
Press Enter to continue with the installation of BackupPC.
After installation of backupPC, we need to change the password for the user backupPC. The BackupPC server uses a system user called backuppc to perform the backup/restore tasks. Additionally, Apache uses the user backuppc to perform its own tasks. We need to change this password.
Type the following line to install apache2 utilities.
apt-get install apache2-utils
Now change the password for backuppc
htpasswd /etc/backuppc/htpasswd backuppc
Enter the password when prompted.
There are many ways in which servers and clients communicate. In this blog post I will configure SSH channel for the communication to occur. First, we need to create an SSH key pair for BackupPC user called backuppc and then transfer this key to the client computers.
sudo su – backuppc
Generate an SSH key pair:
You will be prompted for three questions. Just press Enter to accept the default values.
Now we have the key pair, we need to transfer the public key.
Transferring the SSH Public Key
On the client computer, make sure you have the following configured:
We need to enable root account for SSH access. To do that, edit the file /etc/ssh/sshd_config and comment the line:
#PermitRootLogin without password
Add the line:
Then restart SSH:
service ssh restart.
Note: you do not need the following user configured, but for my convenience, I have added a login for my own testing later. Ignore the italic text below.
useradd chuong passwd chuong mkdir /home/chuong chown chuong:chuong /home/chuong
Now copy the key to the client computer:
ssh-copy-id email@example.com (note that 10.0.0.10 is another Linux system I want to work as a client machine).
Now try to SSH to firstname.lastname@example.org, you should be able to directly SSH to the client without having to supply a password for the user root. Verify that is the case.
Now type exit to close the connection to 10.0.0.10. Type exit again to exit the user backuppc and go back to the default currently logged in user.
Launch your browser and go to this URL:
Note: If for any reasons, the web page does not show up but it asks you to download a file that contains garbage characters in it (most probably happens in Ubuntu 14.04.1), you need to perform the followings to fix it:
sudo ln /etc/backuppc/apache.conf /etc/apache2/conf-enabled/backuppc.conf
service apache2 restart
Then try again. When prompted for a credentials, use backuppc as the user name and the password you changed earlier.
Shown below is the main interface of BackupPC.
At this point /var/lib/backuppc is the default backuppc storage location and also the home directory of user backuppc.
Configure Client for Backup
We need to setup the client computer for backup. On the left hand side, click Edit Hosts.
Click Delete to remove localhost out of the equation as we are only planning to backup remote computers.
Now click Add to add the client host.
Enter the IP address of the client computer, the user name should be backuppc. Click Add when done.
Click Save at the top of the page.
Configure Transfer Method
We will use rsync to transfer. Now we will configure this setting.
Click Xfer tab. Under XferMethod, choose rsync. Under RsyncShareName, click Add to choose a directory to backup. You can leave it as “/” to backto the entire the computer if you want.
In this demonstration, I add /etc/ppp to backup. Note that if you choose to backup the entire computer (using /), you have to exclude the /proc and the /sys directories. For now, remove the / so that the entire system is not backed up. We just want to backup /etc/ppp. Click Save.
CLick Schedule to check the backup schedules. As you can see, by default, full backup happens every 6.97 days and incremental backup happens every 0.97 days. We can keep these settings as is.
Run backup Manually
Let’s run the backup manually instead of waiting for 7 days.
Click the Hosts tab and then click the Select a Host drop down list.
Click Start Full Backup
Click Start Full Backup to confirm.
The backup will happen and it
The backup should finish shortly as there are only a few files in our demonstration. The backup is stored at: /var/lib/backuppc/pc/10.0.0.10/#_of_backup.
In the Web interface, click the link to go back to the home page.
Click on the backup job to see backed up files.
As you can see, the directory /etc/ppp has been successfully backed up and the contents is stored on the backup server.
Backing up Windows Machines
I am going to allow backing up of a Windows computer using SMB. The first thing to do is to share the C: drive.
On the Windows computer, double-click Computers, In C: drive, create a folder called Share. Store some sample files in it to test.
Share this folder to everyone with full access.
Also ensure that on this PC there is a local user account called backup, with password, say Pass1234 for instance.
On the backuppc server, also make sure we have this user exist. Create a password for the web interface as follows:
htpasswd -c /etc/backuppc/htpasswd backup
Now on the backuppc server, open the file /etc/backuppc/hosts.
Add the IP address of the PC to be backed up. In my case, it is 10.0.0.132.
Create a new myhost.pl file under backuppc with the contents:
Restart backuppc service.
Now when you refresh the Web interface of backuppc again, you will see the new host show up in the host list.
Select the host and click Start Full Backup
Confirm to start the backup.
Click the link to go back to the main page.