Updated on 25.5.2023

How to get started with BackupPC on Ubuntu

BackupPC setting up file level backups for any computer

BackupPC is a highly efficient backup system that requires no installations on the hosts to be backed up making it very easy to orchestrate. It features global deduplication, which allows you to store enormous amounts of backups in a small space. Deduplication is used during transfer, making it very good for backups over the internet. It also features compression, further minimizing storage usage.

This tutorial describes how to install and orchestrate BackupPC 4 on an UpCloud cloud server using Ubuntu or Debian operating system.

Deploying BackupPC cloud server

BackupPC will run on all available server plans, so you can start with a small one and simply upgrade to accommodate more clients to back up as your needs increase.

As a rule of thumb, 1 core per concurrent backup is plenty. A single full client backup takes anything between a few seconds and a few hours to complete.

For memory, just go with the fixed plans according to your CPU needs.

For storage, this tutorial will optimize cost and performance by splitting the data on the instance and HDD storage. This approach will place the ‘pc’ folder (somewhat equivalent to a database) on the instance root and the ‘cpool’ folder (akin to object storage) on separate storage. If the instance storage is sufficient as is, you can simply ignore adding it, the script below will adapt automatically.

Then for the operating system, choose Ubuntu 18.04 LTS or Debian GNU/Linux 10.

Storage setup for BackupPC cloud server

Once all set, click the Deploy button at the bottom of the page.

The deployment will only take a moment, after which you’ll receive the root password via your chosen delivery method, email by default. With the server deployed and the password at hand, you can continue with the BackupPC installation.

Installing BackupPC

The installation is based on this BackupPC Wiki page. It is completely automated and will make use of additional storage is available on the instance.

Once the server is has been created, connect to your cloud server using SSH. Include the following additional parameter to bind the localhost:80 on the BackupPC cloud server to your local 8888 port:

ssh -L 8888:localhost:80 root@<your-server-ip>

When logged in, first, set up the storage with this handy script below:

echo "if [[ -e /dev/vdb ]]; then mkfs.ext4 /dev/vdb; mkdir -p /srv/backuppc/cpool; echo '/dev/vdb /srv/backuppc/cpool ext4 defaults 0 0' >> /etc/fstab; mount -a; fi" | bash

Then, download and run the installation script with the following command:

wget -q -O - https://gitlab.molnix.com/molnix-open-source/backuppc-ubuntu-installer/-/raw/master/backuppc-ubuntu-installer | bash

The installation process might take a little while but once done, you should see an output like below.

Ok, it looks like we are finished.  There are several more things you
will need to do:

  - Browse through the config file, /etc/BackupPC/config.pl,
    and make sure all the settings are correct.  In particular,
    you will need to set $Conf{CgiAdminUsers} so you have
    administration privileges in the CGI interface.

  - Edit the list of hosts to backup in /etc/BackupPC/hosts.

  - Read the documentation in /usr/local/BackupPC/doc/BackupPC.html.
    Please pay special attention to the security section.

  - Verify that the CGI script BackupPC_Admin runs correctly.  You might
    need to change the permissions or group ownership of BackupPC_Admin.
    If this is an upgrade and you are using mod_perl, you will need
    to restart Apache.  Otherwise it will have stale code.

  - BackupPC should be ready to start.  Don't forget to run it
    as user backuppc!  The installation also contains
    a systemd/backuppc.service script that can be installed so
    that BackupPC can auto-start on boot.  This will also enable
    administrative users to start the server from the CGI interface.
    See systemd/README.


With the BackupPC installed, you can get started setting up backups. To enable this, you’ll need the two following keys.

The password for backuppc username:

cat password

The public key needed to grant the BackupPC server access to the clients:

cat /var/lib/backuppc/.ssh/id_rsa.pub

With the required credentials available, continue in the next section on how to configure BackupPC.

Configuring BackupPC

BackupPC provides a convenient admin panel for easier backup management but it is configured to only grant access locally. The easiest way to connect to it is over an SSH tunnel. By using the SSH command as instructed in the previous section, you get to access the localhost of your cloud server from your web browser.

Open the BackupPC Web admin by going to http://localhost:8888/BackupPC_Admin

Log in using backuppc username and the password output by the cat password command above.

BackupPC admin panel

Then configure your BackupPC as needed.

At a minimum, you should enable rsync over SSH to back up clients efficiently. Go to the Xfer configuration in the Edit Config menu.

Edit Config -> Xfer – XferMethod: rsync.

Enable rsync by selecting it from the first drop-down menu.

Then click the Save button at the top to confirm the changes.

Enabling rsync config in BackupPC

That’s all! Your BackupPC server is now ready to start making backups. Continue below with how to add clients for backing up.

Adding clients

By using rsync to facilitate the backup, adding a client is as simple as adding them to the /etc/BackupPC/hosts list and including the BackupPC public SSH key. For each new client, you only need to do the following:

1) Copy the public SSH key to /root/.ssh/authorized_keys on the client:

ssh-copy-id -i /var/lib/backuppc/.ssh/id_rsa.pub root@<client-hostname>

2) Add the client hostname on BackupPC server using the web UI or on the command line:

echo "<client-hostname> 0 backuppc" >> /etc/BackupPC/hosts

For example, to back up the server itself, run the following two commands:

ssh-copy-id -i /var/lib/backuppc/.ssh/id_rsa.pub root@localhost
echo "localhost 0 backuppc" >> /etc/BackupPC/hosts

In this case, both are executed on the server.

Taking and restoring backups

Once added, you’ll see the localhost appear on the list of hosts for backing up.

Taking backup with BackupPC

BackupPC will then manage the backups in the background without the need for user interaction.

If the first backup process doesn’t start automatically, try reloading the system configuration in Admin Options.

Once the first full backup has been completed, you can check the files in the backup by clicking the hostname and going to the Browse backups view.

Browsing backup files on BackupPC

Then if ever needed, you can selectively restore files as you want!

What next?

Since the instance only serves over SSH, you can set up a firewall to only allow access on port 22.

If you want to access the UI directly over the web, you should set up TLS, for example, using Let’s Encrypt on a reverse proxy or on the local Apache configuration.

For further support resources on BackupPC itself, check out the BackupPC wiki, BackupPC docs, as well as mailing lists. For example, a good practice is to set up the backup using a non-root account that has sudo rights. This is described in the docs.

Johan Ehnberg

  1. Why or when should I use this instead of standard backup feature?

  2. Janne Ruostemaa

    Hi Lauri, thanks for the question. BackupPC is great for creating file-level backups even of your own computer, while the UpCloud Backup feature is used to take snapshots of the whole system. BackupPC is not a replacement for the UpCloud Backup feature but rather works well as an addition for fine-grain control of your backups.

  3. Hi Johan Ehnberg,
    I will and I have to thank you a very lot. Perhaps more than 10 years I work with BackupPC and I love it. With your help, and your BackupPC4 install script I can do my work on small offices and non profit organizations. If I can spend you or the people behind BackupPC for example a beer crate tell me whereto ;-)
    you make a great job for the community!
    Thank you, and have nice and healthy days

  4. Janne Ruostemaa

    Hi there, thanks for the comment. While we are not directly affiliated with BackupPC, still glad to hear you’ve found BackupPC useful.

  5. Abdul Nasser Thundiyil

    Can BackupPC be used for backing up Red Hat Linux version of servers?

  6. Janne Ruostemaa

    Hi Abdul, thanks for the question. BackupPC should work on Red Hat Linux as well when installed from source. Have a look at the BackupPC’s instructions on their GitHub page on how to accomplish it.

  7. Anyone know what this error is?

    rsync_bpc exited with fatal status 255 (65280) (rsync error: unexplained error (code 255) at io.c(226) [Receiver=])
    Xfer PIDs are now
    Got fatal error during xfer (rsync error: unexplained error (code 255) at io.c(226) [Receiver=])

  8. Janne Ruostemaa

    Hi Mitch, thanks for the question. The error could be caused by rsync doing a password prompt which then prevents the transfer. If you are seeing the error repeatedly, you could try removing the client configuration and adding it again to make sure the SSH keys are set correctly.

  9. July 16, 2021
    Thank you so much for the script — it worked first time, beautifully. That sort of thing *never* happens with commands people post on the ‘net.
    One important command, however, seems erroneous: “cat password”
    Perhaps I missed the tip somewhere in the output or posting, but I don’t see how to get the password of the user “backuppc” that the script creates. Of course, I can change it myself, but…

  10. Janne Ruostemaa

    Hi Mel, thanks for the comment. The install script generates the password and saves it in the working directory into a file called password. The cat password simply reads out the contents of that file which is your default password.

  11. Aug 7, 2021
    Hello Janne,
    Thanks for your reply, but you’ll have to forgive my inexperience here: I haven’t figured out what the “working directory” is. I see no “password” file in /var/lib/backuppc, nor do I see one in /usr/local/BackupPC, nor do I find on in my own home directory. User “backuppc” doesn’t have a home, so I don’t know where to look. I’ve changed the password myself for “backuppc” and added myself as a user for the Web interface, but I’d still like to know where that auto-generated password file is.
    Thanks again.
    ==Mel Strom

  12. Janne Ruostemaa

    On Linux, the work directory refers to the current directory you are in on any terminal program. In this case, the password file is simply saved into the directory you executed the install script in. For example, if you downloaded the install script into your home directory, the password file should then be at $HOME/password

  13. | In this case, the password file is simply saved into the directory
    | you executed the install script in.

    Yes, that is what I expected. Sadly, I don’t know which directory that was now. Running a “find” from various places turns up no “password” file, so I suppose I’ll be content with the passwd I changed it to.
    Thanks again.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top