Skip to content

Installing Duplicity on Ubuntu

Backing up data is one of the most important responsibilities of a system administrator. Thus, it is necessary to be well versed in software that can make data backup easier. Not only the administrator should be aware of backing up data, but you as a human should be able to back up your data without any problems. One of the most famous backup tools to help you with this is Duplicity.

Duplicity is a flexible local and remote backup software that uses multiple transfer protocols and third-party storage solutions. Ideally, this is a command-line backup application that allows you to create directory backups by creating encrypted and password-protected versions of volumes in tar format that you can send to a remote or local file server.

As usual, various applications are available for backing up Ubuntu. Each with its own weaknesses and strengths. Some of them are designed for corporate environments where you need to quickly and efficiently back up a large number of computers. Others are designed for home environments and come with a simple, wizard-driven GUI. However, others need to be accessed through the command line.

Apart from the interfaces of several backup applications, these applications have different functions. For example, a particular application may back up to one or more DVDs, FTP sites, CDs, SMBs, CDs, and other media, or they may not back up to one or more of these. As diverse as these programs are, so are the needs of the users who use them.

Method 1: How to install Duplicity on Ubuntu using apt

Step 1: Update the apt-cache repository.

Before installing any application on Linux, it is recommended to update all system cache repositories. You can quickly do this by typing the following command:

sudo apt update

Note. Make sure you enter “Y/y” whenever prompted to continue with the update process. After the upgrade process, you may be presented with several packages that require an upgrade. If you get it, run this command to update the mentioned packages:

sudo apt upgrade

Step 2: Install Duplicity with apt-get

After completing the update and update process, we can proceed with the installation process. In this section, we’ll deploy an installation using the Advanced Package Tool (APT), a command-line tool for interacting with the library that allows you to search, install, manage, update, and uninstall software. To install Duplicity, copy and paste this command into your terminal:

sudo apt-get install -y duplicity

Note. The “-y” in the above command tells the system to proceed with the installation without asking you to confirm the process.

Step 3: Check your setup

To verify that our system successfully configured the application, run the following command:

apt-cache policy duplicity

The output should indicate whether the installation was successful.

Let’s consider an alternative way to do this.

Method 2: How to install Duplicity on Ubuntu using Snap

Snaps are applications packaged with all their dependencies to run on all major Linux distributions from a single build. They are automatically updated and correctly rolled back.

Snap can be found and installed from the Snap Store, an app with a huge audience of over a million people.

Enable Snap

Assume you are using any version of Ubuntu above Ubuntu 16.04 LTS (Xenial Xerus) or higher, including Ubuntu 18.04 LTS (Bionic Beaver) and Ubuntu 20.04 LTS (Focal Fossa). In this case, you don’t need to do anything because Snap is already installed.

For versions of Ubuntu between 14.04 LTS (Trusty Tahr) and 15.10 (Willy Werewolf), as well as versions of Ubuntu that do not include Snap by default, you can install the software using the following commands:

sudo apt install snapd

You can then log out and log back in or restart your computer to make sure the Snap paths are updated correctly.

Installing Duplicity

To configure Duplicity, run the following command:

sudo snap install duplicity --classic

Now that we’ve completed the installation phase, let’s look at another aspect of this app.

Generate SSH and GPG Keys

Our Duplicity configuration will use two different types of keys to achieve a good intersection between convenience and security.

We will be using SSH keys to securely authenticate to a remote system without the need for password authorization. We will also use GPG to encode the data before transferring it to the backup.

Create SSH Keys

We will create an RSA-encoded SSH key for our root user to allow passwordless login to the machine that will host the backups.

If you haven’t done so, make sure the computer you’ll be transferring data to has a root password configured. You can achieve this by logging into the machine as root (via SSH or the console access button on the droplet page if it is a VPS (virtual private server)) and running this command:


Back in the droplet with Duplicity, we will generate a key pair with the following command:

ssh-keygen -t rsa

When prompted to create an SSH key without a password with the default setting, press Enter.

You should successfully log in without having to authenticate with any other credentials.

When you’re done, return to your duplicity droplet:


Generate GPG Keys

For added security and encryption, we will be using GPG. The commands will store our keys in a hidden directory “/root/.gnupg/”:

gpg2 --full-gen-key

You will be asked several questions that will allow you to configure the key pair settings.

  • Key type.
  • Key size.
  • How long should the key be valid?
  • Passphrase.

Enter a name, email address, and optionally a comment to be associated with this key – enter “0” to confirm your details.

Next, you’ll set up a passphrase to use with GPG. Unlike SSH keys, where we didn’t use a passphrase by default to allow Duplicity to run in the background, in this step you must provide a passphrase to allow secure encryption and decryption of your data.

Your key will be generated when you generate enough random pieces of information.

If you forget to write down your public key ID, you can retrieve it again by querying the gpg keyring:

gpg --list-keys

At this point, we should have all the necessary components for a secure backup using Duplicity.

Let’s now move on to another critical stage of Duplicity.

How to use Duplicity

Take the first test

We’ll do an initial test on our duplication system by creating a folder of dummy files for backup. To do this, run the following commands from the list:

cd ~
mkdir test
touch test/file{1..100}

The above commands will create a “test” directory in the root home directory. It then adds a directory with files numbered 1-100:

These files contain backup information. Since this was just a test, you can remove them by running this command:

rm duplicity*

Exit back to the duplicity droplet using:


We can now get rid of the test directory and all of its contents using the following:

rm -r /root/test

And now you can start backing up your data with Duplicity.

Launch the backup tool

You can use the Ubuntu application interface search bar to search for the keyword “backups”. Then, in the search results, select “Backup Application” as shown below:

When the application starts, the following window will be displayed. This will allow you to see the current state of the application. Click the button [+]as shown in the following example, to add specific files and directories to be backed up.

This will open a new window. From this screen, you can navigate to the folders you want to back up. Then click the “Add” button after you’ve selected a specific folder:

You will see them appear in folders in the backup menu after adding them:

Delete folders that won’t be backed up

If you have chosen to back up the entire directory, including some folders, you are not going to back up as they contain unimportant information. You can get rid of them. On the right side of the backup tool, click on the hamburger menu and select settings:

Then select the “Folders” tab and you should see the folders to ignore:

Choose a backup location

After you have selected the data to be backed up, click on the “General” tab and the “Storage” menu and select “location” as shown below:

This will open storage options for you; you can choose the option that suits you best:

On the Overview tab, select the Back Up Now option to initialize the backup process:

An encryption window will appear. If you want to protect your files with a password, enter the password and click Next. If you select this option, a password will be required whenever you wish to recover your data.

On the other hand, if you choose “Allow recovery without a password”, you can skip the encryption section and select “Forward” and your system will start scanning the files in the backup folder and then start backing them up. :


Thus, data backup creates a copy of the data that you can find if the main data fails. Although not a common problem, primary data failures can be caused by hardware or software malfunctions, human error events such as malicious attacks, data corruption, or accidental deletion of data. Ubuntu has several programs that can help you with this.

We now believe that at this stage, you should have a fully functional and working backup solution. Also, make sure you check your backups often so you don’t fall victim to a security false alarm.

2582600cookie-check Setting up Duplicity on Ubuntu

Publication author

Comments: 0Publications: 75Registration: 22-11-2021


#Installing #Duplicity #Ubuntu

❤ XOXO ❤

Leave a Reply

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