Home / How To / How to install and use BackupPC Backup Software on Ubuntu 20.04 LTS

How to install and use BackupPC Backup Software on Ubuntu 20.04 LTS



BackupPC is a free, open source and web-based backup software that can be used to back up Linux, Windows and macOS and laptops. It is written in Perl and uses Rsync, Samba or tar over the ssh / rsh / nfs protocol. It provides a powerful web interface that allows you to view log files, configuration, current status and allows users to initiate and cancel backups and browse and restore files from backups. It is a high-performance and enterprise-class backup system for backing up a large number of machines to a server local disk or network storage.

In this tutorial we will show you how to install BackupPC on Ubuntu 20.04 server.

conditions

  • Two servers running Ubuntu 20.04.
  • A root password is configured on each server.

Install BackupPC

By default, BackupPC is available in the standard Ubuntu 20.04 repository. You can install it by just running the following command:

apt-get install backuppc -y

During installation, you will be asked to select the type of email configuration shown below:

Configure BackupPC

Select Local only and struck Get on. You will be asked to enter the name of the system shown below:

System mail name

Enter the desired name and date Get on. You will be prompted to select the web server you want to configure as shown below:

Select web server

Select Apache and hit Get on to start the installation. BackupPC will also create an administrative user named backuppc with a password to administer various tasks, e.g. access to BackupPC’s web dashboard. When the installation is complete, you will see the following screen:

Configure BackupPC

Now, hit Get on to complete the installation.

Change the BackupPC default password

If you want to change the password for backupc. You can change it with the following command:

htpasswd /etc/backuppc/htpasswd backuppc

Production:

New password: 
Re-type new password: 
Updating password for user backuppc

Manage BackupPC service

You can also manage the BackupPC service with systemd.

For example, you can start the BackupPC service with the following command:

systemctl start backuppc

Run the following command to check the status of the BackupPC service:

systemctl status backuppc

You should see the following output:

? backuppc.service - LSB: Launch backuppc server
     Loaded: loaded (/etc/init.d/backuppc; generated)
     Active: active (running) since Sat 2020-07-25 13:59:33 UTC; 6min ago
       Docs: man:systemd-sysv-generator(8)
      Tasks: 2 (limit: 2353)
     Memory: 22.0M
     CGroup: /system.slice/backuppc.service
             ??4463 /usr/bin/perl /usr/share/backuppc/bin/BackupPC -d
             ??4464 /usr/bin/perl /usr/share/backuppc/bin/BackupPC_trashClean

Jul 25 13:59:32 backuppcserver systemd[1]: Starting LSB: Launch backuppc server...
Jul 25 13:59:32 backuppcserver backuppc[4442]:  * Starting backuppc...
Jul 25 13:59:33 backuppcserver backuppc[4442]:    ...done.
Jul 25 13:59:33 backuppcserver systemd[1]: Started LSB: Launch backuppc server.

Run the following command to enable the BackupPC service at system startup:

systemctl enable backuppc

Configure SSH access to client computers

There are several ways for servers and clients to communicate to verify and transmit data. In this tutorial, we will use the Rsync protocol as a backup method. So you need to configure password-free SSH authentication for each client to access the password-free client system.

On the BackupPC server, switch the user to backup and generate an SSH key pair with the following command:

su - backuppc
ssh-keygen

You should see the following output:

Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/backuppc/.ssh/id_rsa): 
Created directory '/var/lib/backuppc/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /var/lib/backuppc/.ssh/id_rsa
Your public key has been saved in /var/lib/backuppc/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:kFWEjgktEgzWGFelWdY1B0w4WANvPJxM83X79FJA6GE [email protected]
The key's randomart image is:
+---[RSA 3072]----+
|.==o.o.=*OB=.=o. |
|..+.o *+B+=.E ...|
|   . =o+ O.+ . .o|
|      o.o . .  oo|
|        S     . o|
|               . |
|                 |
|                 |
|                 |
+----[SHA256]-----+

Then copy the generated SSH key to the client system with the following command:

ssh-copy-id [email protected]

You should see the following output:

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/var/lib/backuppc/.ssh/id_rsa.pub"
The authenticity of host 'backuppc-client-ip (backuppc-client-ip)' can't be established.
ECDSA key fingerprint is SHA256:UMxtsszZC/MuEiAnSgV2q5tdckXnEw7MXTVBhtJCeEE.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

Disable forwarding

Then you also need to disable ssh agent forwarding, port forwarding or even pty for backup users logging in to the client from BackupPC.advertisement

In the client system, edit the ssh-approved key file with the following command:

nano .ssh/authorized_keys

Add the following line before ssh RSA words:

from="your-server-ip",no-agent-forwarding,no-port-forwarding,no-pty

Configure Apache for BackupPC

By default, BackupPC is only available from localhost. So you need to edit the Apache configuration file to allow BackupPC from the external IP. You can do this by editing the following file on the server:

nano /etc/apache2/conf-available/backuppc.conf

Find the following line:

Require local

Replace it with the following line:

Require all granted

Save and close the file when you are done. Then restart the Apache service to apply the changes:

systemctl restart apache2

At this time, your BackupPC server is available from the external IP.

Access to BackupPC web interface

Now open your browser and enter the URL http: // backuppc-server-ip / backuppc. You should see the BackupPC login screen:

Backuppc-login form

Enter your BackupPC admin username, password and click Sign in button. You should see the BackupPC Dashboard on the following screen:

BackupPC Server status

Add client machine to BackupPC

Next, you need to add the client machine that you want to back up with BackupPC.

Click the button in the BackupPC Dashboard Edit hosts on the left panel. You should see the host configuration editor on the following screen:

Add client machine to BackupPC

You can see localhost has already been added as a client. However, we only need to back up the remote client so remove localhost by clicking delete button. Then click on add to add the remote client machine shown below:

Configure hosts

Now enter your remote client IP and click Save to save the configuration.

Next, you need to set up a data transfer method. In this tutorial we will use the Rsync protocol for data transfer. Then click on Xfer to configure the database transfer method. The following screen is displayed:

Data transfer settings

Select rsync under Xfer settings and click Save to save the changes.

Next, you need to define the directory path for the client system that you want to back up.

In the left pane, below hosts, click the drop-down menu and select a client host. The following screen is displayed:

backup Overview

Now click on Edit Config and click Xfer tab. The following screen is displayed:

configuration Editor

Under Xfer settings, select the check box under RsyncShareName and enter the path to the directory you want to back up. When you are done, click Save to apply the changes.

Then you need to configure the backup schedule.

In the left pane, below server Settings, Click Edit config and click Schedule tab. The following screen is displayed:

Schedule backup

Enter the desired security settings and click Save to apply the changes.

Now you need to run a manual backup on your client.

In the left pane, below hosts, click the drop-down menu and select a client host. The following screen is displayed:

Start full backup

During Backup overview> User actions, click Start full backup and if everything is okay. The following screen is displayed:

Start backing up your client computer

backup started

Click on the left pane LOG to check the backup logs. You should see the entire backup log on the following screen:

backup log

Click. To check the security overview host Overview link to the left, below server. The following screen is displayed:

backup Overview

Click. To see a list of all backup files host IP shown in the summary above, then click Browse Backups> Backup Number. You should see all the backup files on the following screen:

Browse backup

Conclusion

In this tutorial you learned how to configure BackupPC on Ubuntu 20.04 server. You have also learned how to add a client computer to BackupPC via a web browser and perform a backup operation. I hope this tool helps you create a centralized security system. Feel free to ask me if you have any questions.


Source link