Difference between revisions of "BackupPC"
Line 240: | Line 240: | ||
Note: There are times when the backuppc user needs a real shell specified in /etc/passwd, for example, when the backuppc user is used to run sudo commands or pre/post scripts.<br /> | Note: There are times when the backuppc user needs a real shell specified in /etc/passwd, for example, when the backuppc user is used to run sudo commands or pre/post scripts.<br /> | ||
− | Now you can go to the admin backuppc panel to set your host | + | Now you can go to the admin backuppc panel to set your host<br /> |
+ | _________________________________________________ | ||
+ | |||
+ | '''When restarting the BackupPC service you may receive the error as indicated below :<br /> | ||
+ | ''' | ||
+ | [root@backuppc ~]# service backuppc restart<br /> | ||
+ | |||
+ | Shutting down BackupPC: [ OK ]<br /> | ||
+ | Starting BackupPC: [ OK ]<br /> | ||
+ | '''BackupPC: WARNING: Your BackupPC $Conf{TopDir} is not listed in the locate<br /> | ||
+ | BackupPC: database configuration's PRUNEPATHS. This may cause all of your<br /> | ||
+ | BackupPC: backed up files to be indexed!'''<br /> | ||
+ | |||
+ | '''To remove the warning,''' you should create a custom template /etc/e-smith/templates-custom/etc/updatedb.conf/10conf (copy the default /etc/e-smith/templates/etc/updatedb.conf/10conf)<br /> and add the directory /var/lib/BackupPC to the PRUNEPATHS list, then expand-template /etc/updatedb.conf <br /> | ||
=== Uninstall === | === Uninstall === |
Revision as of 23:02, 13 August 2014
Maintainer
Daniel B. from Firewall Services
Version
Description
BackupPC is a powerful, high-performance, enterprise-grade system for backing up a large number of Linux and Windows PCs and laptops to a server's disk. BackupPC is highly configurable and easy to install and maintain.
With the decreasing cost of disks and raid systems, it is practical and cost effective to backup a large number of machines onto a server's local disk or network storage. This is what BackupPC does. For some sites, this might be the complete backup solution. For other sites, additional permanent archives could be created by periodically backing up the server to tape. A variety of Open Source systems are available for doing backup to tape.
BackupPC is written in Perl and extracts backup data via SMB using Samba, tar over ssh/rsh/nfs, or rsync. It is robust, reliable, well documented and freely available as Open Source on SourceForge.
More information & support is available at http://backuppc.sourceforge.net
Features
A clever pooling scheme minimizes disk storage and disk I/O. Identical files across multiple backups of the same or different PCs are stored only once resulting in substantial savings in disk storage and disk I/O.
One example of disk use: 95 laptops with each full backup averaging 3.6GB each, and each incremental averaging about 0.3GB. Storing three weekly full backups and six incremental backups per laptop is around 1200GB of raw data, but because of pooling and compression only 150GB is needed.
Optional compression support further reducing disk storage. Since only new files (not already pooled) need to be compressed, there is only a modest impact on CPU time.
No client-side software is needed. The standard smb protocol is used to extract backup data on Windows clients. On linux clients, tar over ssh/rsh/nfs is used to backup the data. With version 2.0.0, rsync is also supported on any client that has rsync or rysncd.
A powerful web (http/cgi) user interface allows administrators to view log files, configuration, current status and allows users to initiate and cancel backups and browse and restore files from backups.
A full set of restore options is supported, including direct restore (via smbclient, tar, or rsync/rsyncd) or downloading a zip or tar file.
Supports mobile environments where laptops are only intermittently connected to the network and have dynamic IP addresses (DHCP).
Flexible configuration parameters allow multiple backups to be performed in parallel, specification of which shares to backup, which directories to backup or not backup, various schedules for full and incremental backups, schedules for email reminders to users and so on. Configuration parameters can be set system-wide or also on a per-PC basis.
Users are sent periodic email reminders if their PC has not recently been backed up. Email content, timing and policies are configurable.
Tested on Linux, Freenix and Solaris hosts, and Linux, Windows 95, Windows 98, Windows 2000, Windows XP, and Windows Vista clients.
Detailed documentation.
Open Source hosted by SourceForge and freely available under GPL.
Requirements
- SME Server 7.X or 8.X
- a dedicated volume is recommended (can be a simple disk or a RAID array)
Installation
- Mount a volume on /var/lib/BackupPC
This part is optional but highly recommended. Backups should always be on a separate volume. First, prepare your hard drive for ext3 fs (you can use any fs which support hardlinks, I always use ext3 as it's very reliable) In this example, I use a simple partition /dev/sdb1, it could also be a RAID array (/dev/md3) or a LVM logical volume (or a combination of RAID and lvm). By the way, if you know how to manage LVM, its usage is also recommended as it will be easier to manage backups data later.
mkfs.ext3 -L BACKUPPC -m 1 /dev/sdb1
Now, we need to create the directory
mkdir -p /var/lib/BackupPC
Add the mount point in fstab. Just add something like:
/dev/sdb1 /var/lib/BackupPC ext3 noatime 0 0
And check everything is ok
mount -a mount | grep BackupPC /dev/sdb1 on /var/lib/BackupPC type ext3 (rw,noatime)
- create some symlinks
This part is optional but recommended. With these commands, all BackupPC related files (config and logs) will be stored on the BackupPC volume. You'll then be able to swap the BackupPC disk between two servers.
mkdir -p /var/lib/BackupPC/{etc,log} ln -s /var/lib/BackupPC/etc /etc/BackupPC ln -s /var/lib/BackupPC/log /var/log/BackupPC
- configure needed repositories (needed on SME 8.X)
- install the rpms (SME 7.X)
You need to configure the EPEL directory as explained on this page: Epel and the sme7contribs as explained here due to SME7 now at EOL: SME8.0_Contribs_QA#Setup
yum --enablerepo=sme7contribs install smeserver-BackupPC signal-event backuppc-update
- install the rpms (SME 8.X)
yum --enablerepo=epel install BackupPC yum --enablerepo=smecontribs install smeserver-BackupPC
- updates configuration files following the installation
signal-event backuppc-update
- remove -N option for Samba >=3.5 from /etc/BackupPC/config.pl ( 3 lines) for SME8
cp /etc/BackupPC/config.pl /etc/BackupPC/config.pl.orig cat /etc/BackupPC/config.pl.orig|sed 's/ -E -N -d 1/ -E -d 1 /g'>/etc/BackupPC/config.pl
regarding upstream :http://sourceforge.net/apps/mediawiki/backuppc/index.php?title=BackupPC_on_Fedora_Core_9
http://sourceforge.net/apps/mediawiki/backuppc/index.php?title=Troubleshooting
and also bugs : bugzilla:7016 and bugzilla:7281
You should now be able to access the interface in the server-manager or directly on https://my.domain.tld/BackupPC
You'll find three sample configuration:
- smeserver-template is a sample config file to backup a SME Server.
- localhost-template is a sample config file to backup the server itself.
- windows-template is a sample to backup a windows host using cygwin+rsyncd
To create a host using a template, create a new host, add =<template_name>
For example
myserver=smeserver-template
When you submit, the configuration from smeserver-template will be copied on my_server. You then can edit my_server's config
Upgrade from smeserver-backuppc.fws-3.0-1
If you already use the previous version of the contrib, some other steps are needed as the default location of the backups has changed from /opt/backuppc/files to /var/lib/BackupPC
The easiest way is just to symlink the old location to the new one:
ln -s /opt/backuppc/files /var/lib/BackupPC
Then, you can install the new release:
yum --enablerepo=smecontribs install smeserver-BackupPC
Then, just enter the following commands:
mv /etc/BackupPC/config.pl.back /etc/BackupPC/config.pl mv /etc/BackupPC/hosts.back /etc/BackupPC/hosts mv /etc/BackupPC/pc/localhost.pl.back /etc/BackupPC/pc/localhost.pl db configuration delprop backuppc version usermod -d /var/lib/BackupPC/ -m backuppc mv /home/e-smith/files/users/backuppc/.ssh/ /var/lib/BackupPC/ signal-event backuppc-update
You should be done ;)
DB properties
there's only two properties you can change:
- status: (enabled|disabled) Do you want the service to start automatically when the server boot ?
- examples: (enabled|disabled) Do you want the sample configuration files to be added again if they are removed ?
- sudo: a list of commands backuppc will be able to run as root using sudo. The default is "/usr/bin/rsync,/bin/gtar"
When you have configured this, you should run
signal-event backuppc-update
as an example if you want to be able to wake on lan :
config setprop backuppc sudo `config getprop backuppc sudo`,/sbin/ether-wake signal-event backuppc-update
then simply add a script to your prebackup command or your ping command like :
#!/bin/sh # Set the mac address for each host host1_mac=<mac address> host1_name=<host name> host2_mac=<mac address> host2_name=<host name> # How long does the host take to boot boottime=120 # Which interface to send the WoL packets out of interface=eth0 # Function to check if the host pings pingcheck() { ping -w 5 -c 2 $1 export pingstatus=$? } case $1 in host1) sudo etherwake -i $interface $host1_mac sleep $boottime pingcheck $host1_name exit $pingstatus ;; host2) sudo etherwake -i $interface $host2_mac sleep $boottime pingcheck $host2_name exit $pingstatus ;; *) echo "Unknown machine $1" exit 1 ;; esac
Operation
Backup a smeserver
To configure a SME Server client to be backed up using a configuration based on the provided smeserver-template, configure SSH from the backup server as follows:
[root@backupserver ~]# su -s /bin/bash backuppc bash-3.2$ ssh-keygen -t rsa -b 2048 (used a blank passphrase) bash-3.2$ cat /var/lib/BackupPC/.ssh/id_rsa.pub | ssh root@myserver.mydomain.com \ "cat >> /root/.ssh/authorized_keys2" (confirm the host key)
Backup a Linux host through rsync
To configure a Linux host client to be backed up, configure SSH from the backup server as follows in order to exchange certificates and to perform a login without passwords.
At the BackupPC server command line as root:
su -s /bin/bash backuppc ssh-keygen -t rsa -b 2048 # use a blank passphrase exit
Assuming SSH access to the remote host to be backed up is already configured, as root:
su -s /bin/bash backuppc ssh-copy-id -i ~backuppc/.ssh/id_rsa.pub root@your.host.name exit
You can test the key exchange:
su -s /bin/bash backuppc #become backuppc user ssh -l root your.host.name # add "-p 2222" for port 2222 exit #from the remote_host exit #from the backuppc user back to root
You should be able to log in without a password.
Note: There are times when the backuppc user needs a real shell specified in /etc/passwd, for example, when the backuppc user is used to run sudo commands or pre/post scripts.
Now you can go to the admin backuppc panel to set your host
_________________________________________________
When restarting the BackupPC service you may receive the error as indicated below :
[root@backuppc ~]# service backuppc restart
Shutting down BackupPC: [ OK ]
Starting BackupPC: [ OK ]
BackupPC: WARNING: Your BackupPC $Conf{TopDir} is not listed in the locate
BackupPC: database configuration's PRUNEPATHS. This may cause all of your
BackupPC: backed up files to be indexed!
To remove the warning, you should create a custom template /etc/e-smith/templates-custom/etc/updatedb.conf/10conf (copy the default /etc/e-smith/templates/etc/updatedb.conf/10conf)
and add the directory /var/lib/BackupPC to the PRUNEPATHS list, then expand-template /etc/updatedb.conf
Uninstall
yum remove smeserver-BackupPC BackupPC
Bugs
Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-BackupPC component or use this link