{"id":4197,"date":"2019-09-21T12:30:13","date_gmt":"2019-09-21T09:30:13","guid":{"rendered":"https:\/\/kifarunix.com\/?p=4197"},"modified":"2024-03-12T22:01:19","modified_gmt":"2024-03-12T19:01:19","slug":"install-and-configure-backuppc-on-debian-10","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-configure-backuppc-on-debian-10\/","title":{"rendered":"Install and Configure BackupPC on Debian 10"},"content":{"rendered":"\n
In this guide, we will learn how to install and configure BackupPC on Debian 10. BackupPC<\/a> is a free, high-performance enterprise-grade backup software suite with a web-based frontend that can be used for backing up Linux, Windows and mac OSXs PCs and laptops to a server\u2019s disk.<\/p>\n\n\n\n Update and upgrade your system packages.<\/p>\n\n\n\n Once the system update is done, proceed to install BackupPC. BackupPC is usually available on the default APT repositories and can be installed using the package, NOTE<\/strong>: This commands installs BackupPC v3.2. You can install the latest version of BackupPC by building your own packages<\/a>.<\/p>\n\n\n\n During installation you will be prompted to configure samba settings. If you are not using DHCP server, select no to proceed installation.<\/p>\n\n\n\n Next, choose the web server to be used by BackupPC. Apache web server is used in this guide.<\/p>\n\n\n\n A default BackupPC administrative user, You can choose to copy the password provided or you can proceed and reset the password later by executing the command below;<\/p>\n\n\n\n BackupPC uses different protocols to get backup data from devices being backed up:<\/p>\n\n\n\n In this tutorial we are going to configure BackupPC to use the rsync protocol as a backup method. <\/p>\n\n\n\n Also, by default, BackupPC is using root user run backup tasks. However, in this guide, we are going to use a If you happen to change the backup user, edit BackupPC configuration file, BackupPC uses htpasswd user files to restrict access to web interface. As such, you require a valid user in order to authenticate. Therefore, edit the BackupPC configuration file, Save the configuration file and quit.<\/p>\n\n\n\n The Web authentication user and its hashed credential password is stored under the Next, restart both backuppc and Apache service to apply the changes made above.<\/p>\n\n\n\n If UFW is running, allow external access to Apache.<\/p>\n\n\n\n For rsync to work, BackupPC requires passwordless SSH login for backuppc<\/strong> user to every client it will be getting backup data from. This also means that you should create a dedicated backuppc user on the hosts you need to backup for backup purposes.<\/p>\n\n\n\n As a result, switch to backuppc user on BackupPC server and generate passwordless ssh keys and copy them to every host you want to backup.<\/p>\n\n\n\n This will opens up the sh shell. You can run bash command to launch bash shell.<\/p>\n\n\n\n Generate SSH key pair by running the following command;<\/p>\n\n\n\n Next, login to the system servers you want to backup and create an account on the client dedicated for backup purposes for example, create a backuppc user account on remote client and copy the public key to that user.<\/p>\n\n\n\n Now logout from client host and copy the SSH public key for backuppc user on BackupPC server to backuppc user on the client. Copy the keys while logged as backuppc user.<\/p>\n\n\n\n Where 192.168.43.214 is my client IP address. Once you copy the key, you should be able to login without being prompted for a password.<\/p>\n\n\n\n Now, test the login to client with the backup user to ensure user can successfully login to client. You can use root user if you didn’t make the changes above.<\/p>\n\n\n\n or<\/p>\n\n\n\n If you changed you backup user to non-root user, Login to the client host as an administrative user and allow the non-user to run the rsync command without being prompted for password by adding the user to sudoers list. You can run the command below to find the absolute path of rsync.<\/p>\n\n\n\n If rsync command is not installed, run the following commands to install it.<\/p>\n\n\n\n You may also want to disable ssh agent-forwarding, port-forwarding or even the pty for backuppc user logging in to the client from BackupPC.<\/p>\n\n\n\n To do this, login to client, edit the ssh authorized key file and add the line below before the Replace the Next, you can also configure ssh logins to backuppc user accounts on clients hosts from the BackupPC server only. This can be done by editing Add the line below to SSHd configuration to allow login to the client as backuppc from the BackupPC server only.<\/p>\n\n\n\n Reload SSH configurations<\/p>\n\n\n\n Once the configuration is done, login to BackupPC via browser using the address, You are prompted to authenticate before accessing the dashboard. Use the backuppc credentials set above.<\/p>\n\n\n\n When you login, you will land on BackupPC dashboard.<\/p>\n\n\n\n Once you are logged in, you can now add the clients to backup. To add a client host, click on Edit Hosts<\/strong> on the left panel. This opens up a hosts configuration editor. Localhost is already added as the client. You can choose to leave it or delete it.<\/p>\n\n\n\n Click add<\/strong> to add your new client hosts. For user, enter backuppc.<\/strong><\/p>\n\n\n\n When done adding hosts, click the save button to apply the changes.<\/p>\n\n\n\n The backuppc hosts are kept under the Once the changes are saved, Configure backup data transfer settings, ie the protocol for backup method, In this case, we are using rsync. So still on the configuration editor, Click Xfer<\/strong> tab. Under Xfer Settings<\/strong> > XferMethod<\/strong>, click the dropdown and select rsync<\/strong>.<\/p>\n\n\n\n Click Save to apply the changes.<\/p>\n\n\n\n The main configuration file for BackupPC server is, Next, we need to configure the paths to backup for the clients. On the left pane, under Hosts<\/strong>, click on the dropdown button and select a client host.<\/p>\n\n\n\n Under the hosts settings, click on Edit Config<\/strong> and navigate Xfer<\/strong> settings on the configuration editor.<\/p>\n\n\n\n Under Xfer Settings<\/strong>, check the override box under RsyncShareName<\/strong> and add specific path to backup on client. For instance, the home directory of a user.<\/p>\n\n\n\n To exclude some directories or paths from backup, check the box under under BackupFilesExclude<\/strong> on Include\/Exclude<\/strong> settings and add the parent directory then sub-directories to exclude. See the screenshot below.<\/p>\n\n\n\n Once done with settings, click save to apply changes.<\/p>\n\n\n\n All the host configuration settings are saved under the To save some time of having to manually set the host backup files and directories, add the host and login to BackupPC console as backuppc user or any administrative user.<\/p>\n\n\n\n Next, simply copy the data transfer configuration file of one of the hosts you have configured manually. Be sure to preserve the permissions the file ownership.<\/p>\n\n\n\n For example, to copy the configuration file for host, 192.168.43.214 to be used for host 192.168.43.110, simply run the command below.<\/p>\n\n\n\n Next, modify copied host configuration, preserving the permissions, to make the per host changes as per the format of the configuration.<\/p>\n\n\n\n Once you have made the changes, reload the BackupPC service<\/p>\n\n\n\n If you can go back to the web interface, under the host data transfer settings, you should see the backup directories populated.<\/p>\n\n\n\n Once you have set the backup directories and files, configure backup schedule.<\/p>\n\n\n\n There are two types of backing up data;<\/p>\n\n\n\n Incremental backup is done daily and only 6 most recent backups are kept while full backup happens every 7 days and only newest copy of data is backed up.<\/p>\n\n\n\n On the left pane, under Server<\/strong> settings, click Edit Config<\/strong> and navigate to Schedule<\/strong> tab.<\/p>\n\n\n\n You can make any changes as you see fit.<\/p>\n\n\n\n Once you are done with the configuration, you can now run a manual backup on the two clients.<\/p>\n\n\n\n Under Hosts<\/strong> on the top left panel, select the hosts one by one. For each , under Backup Summary<\/strong> > User Actions<\/strong>, click Start Full Backup<\/strong>.<\/p>\n\n\n\n If everything is okay, you should see Reply from was server ok<\/strong>.<\/p>\n\n\n\n To check the backup logs, click the host LOG files<\/strong> or LOG file<\/strong> on the left panel. You can also check under following path on the server:<\/p>\n\n\n\n To check the backup summary, click the Host Summary<\/strong> under Server<\/strong> section on the left panel.<\/p>\n\n\n\n To have an overview of what is backed up, click the host IP\/hostname as shown in the summary above, then click Browse Backups<\/strong> > Backup number you wish to view.<\/p>\n\n\n\n You can now add more hosts to backup.<\/p>\n\n\n\n That is basically it on our on installing and configuring BackupPC on Debian 10 Buster.<\/p>\n\n\n\n Backup Windows System via SMB Using BackupPC<\/a><\/p>\n\n\n\nInstalling BackupPC on Debian 10<\/h2>\n\n\n\n
apt update
apt upgrade<\/code><\/pre>\n\n\n\nbackuppc<\/code>.<\/p>\n\n\n\n
apt install -y backuppc<\/code><\/pre>\n\n\n\n
backuppc<\/code>, and its password is also created during the installation. This user is used to administer various tasks such as access to BackupPC web dashboard, carry out backups etc.<\/p>\n\n\n\n
htpasswd \/etc\/backuppc\/htpasswd backuppc<\/code><\/pre>\n\n\n\n
Configuring BackupPC Server on Debian 10<\/h2>\n\n\n\n
Define BackupPC Backup User and Backup Protocol<\/h3>\n\n\n\n
\n
backuppc<\/code> user to execute backup tasks.<\/p>\n\n\n\n
\/etc\/backuppc\/config.pl<\/code> and replace the root<\/strong> user with a user you are using for backup under the Rsync\/Rsyncd Configuration.<\/strong><\/p>\n\n\n\n
vim \/etc\/backuppc\/config.pl<\/code><\/pre>\n\n\n\n
###########################################################################\n# Rsync\/Rsyncd Configuration\n# (can be overwritten in the per-PC log file)\n###########################################################################\n...\n# This setting only matters if $Conf{XferMethod} = 'rsync'.\n# Comment this line and add the same line with root user changed to backuppc<\/em><\/strong>\n#$Conf{RsyncClientCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';<\/strong>\n$Conf{RsyncClientCmd} = '$sshPath -q -x -l backuppc<\/strong> $host $rsyncPath $argList+';\n...\n...\n...\n# Comment out this line and add the same line with root user changed to backuppc<\/em><\/strong>\n#$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l root $host $rsyncPath $argList+';<\/strong>\n$Conf{RsyncClientRestoreCmd} = '$sshPath -q -x -l backuppc<\/strong> $host $rsyncPath $argList+';\n ...<\/code><\/pre>\n\n\n\n
Configure BackupPC Apache Authentication<\/h3>\n\n\n\n
\/etc\/backuppc\/apache.conf<\/code> and add the line,
require valid-user<\/code> under authentication section as shown below;<\/p>\n\n\n\n
vim \/etc\/backuppc\/apache.conf<\/code><\/pre>\n\n\n\n
...\n...\n AuthUserFile \/etc\/backuppc\/htpasswd\n AuthType basic\n AuthName \"BackupPC admin\"\n require valid-user<\/strong>\n...\n...<\/code><\/pre>\n\n\n\n
\/etc\/backuppc\/htpasswd<\/code>. You can reset the password by running;<\/p>\n\n\n\n
htpasswd \/etc\/backuppc\/htpasswd backuppc<\/code><\/pre>\n\n\n\n
systemctl restart backuppc apache2<\/code><\/pre>\n\n\n\n
ufw allow WWW<\/code><\/pre>\n\n\n\n
Generate Backup User SSH Keys<\/h3>\n\n\n\n
su - backuppc<\/code><\/pre>\n\n\n\n
ssh-keygen<\/strong> \nGenerating public\/private rsa key pair.\nEnter file in which to save the key (\/var\/lib\/backuppc\/.ssh\/id_rsa): ENTER<\/strong> \nCreated directory '\/var\/lib\/backuppc\/.ssh'.\nEnter passphrase (empty for no passphrase): ENTER<\/strong>\nEnter same passphrase again: ENTER<\/strong>\nYour identification has been saved in \/var\/lib\/backuppc\/.ssh\/id_rsa.\nYour public key has been saved in \/var\/lib\/backuppc\/.ssh\/id_rsa.pub.\nThe key fingerprint is:\nSHA256:qZUR\/Aohas\/rqkqp2ME1RHOA7D7vMiBvqXgGxr2RMoc backuppc@storagesrv01.example.com\nThe key's randomart image is:\n+---[RSA 2048]----+\n| . .+.... |\n| o..o. .. |\n| . ... ... |\n| +. . +. |\n|.ooo+ .S. |\n|+E+*o. o. |\n|o**+o.. |\n|=.Ooo |\n|O*o*o |\n+----[SHA256]-----+<\/code><\/pre>\n\n\n\n
Create Backup User Account On Clients<\/h3>\n\n\n\n
useradd -m backuppc\npasswd backuppc<\/code><\/pre>\n\n\n\n
Copy BackupPC Server SSH Keys<\/h3>\n\n\n\n
ssh-copy-id backuppc@192.168.43.214<\/code><\/pre>\n\n\n\n
su - backuppc\nssh -l backuppc client_IP whoami\nbackuppc<\/code><\/pre>\n\n\n\n
ssh -l root client_IP whoami\nroot<\/code><\/pre>\n\n\n\n
backuppc<\/code> user is used in this case.<\/p>\n\n\n\n
ssh admin@client_IP<\/code><\/pre>\n\n\n\n
echo \"backuppc ALL=NOPASSWD: \/usr\/bin\/rsync\" | sudo tee \/etc\/sudoers.d\/backuppc<\/code><\/pre>\n\n\n\n
which rsync<\/code><\/pre>\n\n\n\n
apt install rsync -y\nyum install rsync -y<\/code><\/pre>\n\n\n\n
ssh-rsa<\/code> <\/strong>keyword.<\/p>\n\n\n\n
from=\u201dbackuppc_server_ip\u201d,no-agent-forwarding,no-port-forwarding,no-pty<\/code><\/pre>\n\n\n\n
backuppc_server_ip<\/code> with the IP address of the backuppc server.<\/p>\n\n\n\n
vim \/home\/backuppc\/.ssh\/authorized_keys<\/code><\/pre>\n\n\n\n
from=\"192.168.43.154\",no-agent-forwarding,no-port-forwarding,no-pty<\/strong> ssh-rsa AAAAB3NzaC1SSSc2EAAAADAQABAAABAQDYuDSNIPxQL6hNh6FeW4wj3hYJ+p42SD9BGVg5Rn6HuzIAi1zrU2pRceQ5VDRj5nXxSjs+oJJ4lXZ\/HTaUQDBFysVyIe9Sc4Z9Z5nmmmGWIJnKWfuvzSYbV2JbSJjcTfUPjH32DOvU+4PMdil\/4GjKW7pr8fyywl4XuhZMU6RfVw0LgzYuqzUQX5D6Q4MsgIN4HGqBsnVIBvSz2TcPc0hovtfKQMmUBQvp7L9Ob3AKuG01ZZznQ8Q6+eGL7EJHnS30h\/FLM8rKBxsvI6El8xog2E0\/ALnNGKWsg2NTEqWqQ3xpUDEnA6exgHEm+2xCuKAy1sAuSJHJHScUMLZIUE36t2+nB0Vn backuppc@backuppc.kifarunix-demo.com<\/code><\/pre>\n\n\n\n
sshd_config<\/code> file on the client and configuring as shown below;<\/p>\n\n\n\n
sudo vim \/etc\/ssh\/sshd_config<\/code><\/pre>\n\n\n\n
Match Host 192.168.43.154\n AllowUsers backuppc<\/code><\/pre>\n\n\n\n
systemctl reload ssh<\/code><\/pre>\n\n\n\n
Accessing BackupPC Web User Interface<\/h2>\n\n\n\n
http:\/\/backuppc_server_IP or hostname\/backuppc<\/code>.<\/p>\n\n\n\n
<\/a><\/figure>\n\n\n\n
<\/a><\/figure>\n\n\n\n
Add Hosts to Backup<\/h3>\n\n\n\n
<\/a><\/figure>\n\n\n\n
\/etc\/backuppc\/hosts<\/code> configuration file.<\/p>\n\n\n\n
Configure Backup Data Transfer Settings<\/h3>\n\n\n\n
<\/a><\/figure>\n\n\n\n
\/etc\/backuppc\/config.pl<\/code>.<\/p>\n\n\n\n
Configure BackupPC Backup Directories<\/h4>\n\n\n\n
<\/a><\/figure>\n\n\n\n
\/etc\/backuppc\/pc\/<\/code> directory.<\/p>\n\n\n\n
cp -p \/etc\/backuppc\/pc\/192.168.43.214.pl \/etc\/backuppc\/pc\/192.168.43.110.pl<\/code><\/pre>\n\n\n\n
sudo -u backuppc vim \/etc\/backuppc\/pc\/192.168.43.110.pl<\/code><\/pre>\n\n\n\n
systemctl reload backuppc<\/code><\/pre>\n\n\n\n
Configure BackupPC Backup Schedule<\/h3>\n\n\n\n
\n
<\/a><\/figure>\n\n\n\n
Run BackupPC Host Backup<\/h3>\n\n\n\n
<\/a><\/figure>\n\n\n\n
\/var\/lib\/backuppc\/pc\/ip_address_of_client\/<\/code><\/pre>\n\n\n\n
View BackupPC Host Backup Summary<\/h3>\n\n\n\n
<\/a><\/figure>\n\n\n\n
<\/a><\/figure>\n\n\n\n
Related Tutorials<\/h3>\n\n\n\n