Tutorial

How To Use BackupPC to Create a Backup Server on an Ubuntu 12.04 VPS

Published on September 24, 2013
How To Use BackupPC to Create a Backup Server on an Ubuntu 12.04 VPS

Status: Deprecated

This article covers a version of Ubuntu that is no longer supported. If you are currently operate a server running Ubuntu 12.04, we highly recommend upgrading or migrating to a supported version of Ubuntu:

Reason: Ubuntu 12.04 reached end of life (EOL) on April 28, 2017 and no longer receives security patches or updates. This guide is no longer maintained.

See Instead: This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version.

Introduction


BackupPC is a backup solution that can be configured to back up remote Linux and Windows systems. It can use a variety of different protocols and has a flexible scheduler to coordinate full and incremental backups.

In this guide, we will install BackupPC on an Ubuntu 12.04 VPS and use it to back up a second Ubuntu 12.04 VPS.

Install BackupPC


BackupPC is available in Ubuntu’s default repositories. The software “pulls” the data from client machines, so the actual program needs to be installed on the machine that will function as the backup server.

Open a terminal and enter the following commands:

sudo apt-get update
sudo apt-get install backuppc

During the installation, you will be asked what kind of mail server configuration is needed. We can select the “Local only” option, because we will not be configuring internet-aware mail:

                ???????? Postfix Configuration ?????????
                ? General type of mail configuration:  ? 
                ?                                      ? 
                ?       No configuration               ? 
                ?       Internet Site                  ? 
                ?       Internet with smarthost        ? 
                ?       Satellite system               ? 
                ?       Local only                     ? 
                ?                                      ? 
                ?                                      ? 
                ?       <Ok>           <Cancel>        ? 
                ?                                      ? 
                ???????????????????????????????????????? 

On the next page, we can leave the Sytem mail name as “localhost”:

 ??????????????????????????? Postfix Configuration ???????????????????????????
 ? The "mail name" is the domain name used to "qualify" _ALL_ mail           ? 
 ? addresses without a domain name. This includes mail to and from <root>:   ? 
 ? please do not make your machine send out mail from root@example.org       ? 
 ? unless root@example.org has told you to.                                  ? 
 ?                                                                           ? 
 ? This name will also be used by other programs. It should be the single,   ? 
 ? fully qualified domain name (FQDN).                                       ? 
 ?                                                                           ? 
 ? Thus, if a mail address on the local host is foo@example.org, the         ? 
 ? correct value for this option would be example.org.                       ? 
 ?                                                                           ? 
 ? System mail name:                                                         ? 
 ?                                                                           ? 
 ? localhost________________________________________________________________ ? 
 ?                                                                           ? 
 ?                    <Ok>                        <Cancel>                   ? 

Select “apache2” to configure Apache for use with BackupPC:

  ?????????????????????????? Configuring backuppc ???????????????????????????
  ? BackupPC supports any web server with CGI enabled, but this automatic   ? 
  ? configuration process only supports Apache.                             ? 
  ?                                                                         ? 
  ? Which web server would you like to reconfigure automatically:           ? 
  ?                                                                         ? 
  ?    [*] apache2                                                          ? 
  ?                                                                         ? 
  ?                                                                         ? 
  ?                                 <Ok>                                    ? 
  ?                                                                         ? 
  ??????????????????????????????????????????????????????????????????????????? 

On the next page, type “Enter” to continue with the installation.

Changing the Password


BackupPC uses a system user called “backuppc” to perform its tasks.

In addition, it configures an Apache user, also called “backuppc”, with a randomly generated password, which was given briefly during installation. We can change this password to something more meaningful by typing:

sudo htpasswd /etc/backuppc/htpasswd backuppc

You will be asked to give and confirm a new password.

Configure SSH Access to Client Computers


There are a few different ways that servers and clients can communicate to authenticate and transfer data. In this guide, we will be using the rsync protocol over SSH.

To make this work, we’ll need to create an SSH key pair for our system BackupPC user (called “backuppc”, as mentioned above), and then transfer the key to the client machines.

First, log into the BackupPC user with the following command:

sudo su - backuppc

You will probably be presented with only a minimal prompt, represented by the dollar sign ($).

Generate an SSH key pair by typing:

ssh-keygen

You will be asked a number of questions. Just type “Enter” through all of the prompts to accept the default values.

Transferring the SSH Public Key


You now have a private and public key on your backup server. You need to transfer the public key to the root user on each client machine you wish to access.

You can do that by typing:

<pre> ssh-copy-id root@<span class=“highlight”>client_ip_address</span> </pre>

Type “yes” to accept the new server’s identity, and then enter the root password of the remote machine. The key should then be transfered.

Check that your key was transfered correctly by typing:

<pre> ssh root@<span class=“highlight”>client_ip_address</span> </pre>

You should be able to log in without having to type a password.

Get back to the BackupPC server by typing:

exit

Back out of the “backuppc” account by typing “exit” again:

exit

Access the Web Interface


The rest of the guide will be configured through BackupPC’s web interface.

Open a browser and navigate to:

<pre> <span class=“highlight”>backuppc_server_ip_address</span>/backuppc </pre>

You will be prompted for a username and password. The username is “backuppc” and the password is what you set with the htpasswd command earlier.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/main_page.png” alt =“BackupPC main page” />

Set Up Client Configuration


On the left-hand side, click on the “Edit Hosts” link.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/edit_hosts.png” alt =“BackupPC edit hosts” />

Click the “Delete” button next to “localhost”, since we are only backing up remote machines.

Next, click “Add”. Fill in the client machine’s IP address. For user, add “backuppc”, since we have given that user SSH access to the host.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/remote_host.png” alt =“BackupPC remote host” />

Click “Save” at the top of the page.

Configure Transfer Settings


Click on the “Xfer” tab on the top of the page. Under “XferMethod”, select “rsync”. Under “RsyncShareName”, select the path you would like to back up.

You can leave it at “/” to back up the entire computer. You can also click “Add” to add additional areas to back up if you choose not to target the entire computer.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/rsync_settings.png” alt =“BackupPC rsync settings” />

If you are backing up the entire computer, you’ll need to add an “excludes” rule.

In the “BackupFilesExclude” segment, type “*” to match all shares. Then insert the values “/proc” and “/sys” to exclude these directories from back up.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/rsync_excludes.png” alt =“BackupPC rsync excludes” />

Note: Failure to set up the appropriate exclude rule for the “proc” and “sys” folders can result in a backup that does not finish.

Again, click “Save” at the top of the page to enable your configuration changes.

Configure Backup Schedule


The default backup schedule is:

  • Full backup

    • Every 7 days
    • Keep only newest copy
  • Incremental backup

    • Every day
    • Keep the six most recent backups

If you would like to change the interval, click on the “Schedule” tab on the top bar.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/backup_schedule.png” alt =“BackupPC backup schedule” />

Note: You will notice that full backups have a value of “6.97” in “FullPeriod”, and likewise, incremental backups have a value of “0.97” in the “IncrPeriod” field. These are values corresponding to 7 and 1 day respectively, since it accounts for the time to complete the backup as well.

You can modify the number of backups that the system maintains. You can also specify times when no backup should be performed by setting up “blackouts” where no backup can begin.

In this guide, we will stick with the default values.

Remember to click “Save” if you make any changes.

Run a Manual Backup


To run your first full backup manually, select you client from the “Hosts” drop-down menu in the upper-left corner.

You will be taken to a client summary page. Click “Start Full Backup” under the “User Actions” section.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/full_backup_button.png” alt =“BackupPC start full backup button” />

You will confirm the action on the next page.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/backup_confirmation.png” alt =“BackupPC backup confirmation” />

Your backup should complete shortly, depending on the size of the droplets.

The files will be stored at:

<pre> /var/lib/backuppc/pc/<span class=“highlight”>ip_address_of_client</span>/<span class=“highlight”>#_of_backup</span> </pre>

This value will be printed in the “Backup Summary” portion of the Host summary.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/backup_summary.png” alt =“BackupPC backup summary” />

If you click on the “Browse backups” button in the upper-left corner, you can get an overview of the filesystem, as backed up by BackupPC.

<img style=“border:2px solid black; display:block;margin-left:auto;margin-right:auto” src=“https://assets.digitalocean.com/articles/backuppc/browse_backups.png” alt =“BackupPC browse backups” />

Using this tool, you can browse the filesystem and select the files you’d like to restore.

Conclusion


BackupPC is a powerful, user-friendly way to automatically backup files from several servers to a central location. Backups are essential for any kind of production environment. Just as important is making sure that file restoration operations function correctly.

There are many backup tools available for Linux and Unix-like operating systems. Choose the solution that fits your needs the best. BackupPC is a great tool that should work well in many developers’ environments.

<div class=“author”>By Justin Ellingwood</div>

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Nice tutorial. Quick question, though the answer may not be so easy.

How do you configure the BackupPC server when a host is using a different port than 22 for SSH?

Thanks in advance.

interesting, installed things and then I get to:

“Open a browser and navigate to: backuppc_server_ip_address/backuppc” but I just get a 404 not found from Apache. Tried 3 times, same thing each time. Ubuntu 13.10, Apache v2.4.6

update (I’d edit my comment if I could) – I had to manually start the BackupPC service post installation -->

service backuppc start

yeah, I still get a 404, not sure what else to do. this is a clean ubuntu 12.04 install.

Hi,

We at unimax SYSTEMS have done many installation of Backuppc on Centos and Ubuntu and working successfully using both tar and rsync methods.

Anyone interested to know more about the installation , they can email me at unimax.systems@gmail.com and one of our support staff will be glad to help you.

Put PingMaxMsec 200ms on Backup Settings for time out errors.

Hi,

Anyway to restore the backup to a different machine?

Andrew SB
DigitalOcean Employee
DigitalOcean Employee badge
May 6, 2014

@mohit: There isn’t a way to do that directly, but you can download an archive of the files which you can then upload to another host. See:

http://backuppc.sourceforge.net/BackupPCRestoreOptions.html

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.