Thursday 23 February 2012

Install BackupPC server in Centos|Rhel|Fedora


BackupPC is an entirely disk-based backup and recovery system. It offers a number of advantages, some of which are available only with BackupPC,
Backuppc Support any client OS and has a Web interface to allows user control of and access to backups

How BackupPC Works
The BackupPC model has one user per client. This fits the usage pattern of the type of environment it was specifically designed for: backing up several users’ PCs (hence the name). This should typically be the user who owns the data on the machine. In the case of a large file server, it should be an administrator. BackupPC emails the owner if it cannot back up the client after a configurable time, and the owner can control restores using the web interface. The following list describes how BackupPC works.
Now we will show you how install Backup pc on Centos/Rhel/Fedora, the current installation is done on a machine with CentOS 5.2 installed, but it work also for fedora and RHEL.
Open your terminal, and under root type :
 yum install perl-Compress-Zlib perl-Archive-Zip perl-File-RsyncP perl-XML-RSS httpd
rpm  -Uvh   http://dev.centos.org/centos/5/testing/i386/RPMS/backuppc-3.1.0-1.el5.centos.i386.rpm
1- Add user backuppc to your machine, User backuppc will be created upon installation. Change apache user to backuppc.
 vi /etc/httpd/conf/httpd.conf

Change ‘User apache‘ to ‘User backuppc
Save
2- Edit file /etc/httpd/conf.d/backuppc.conf
 # vi /etc/httpd/conf.d/backuppc.conf   

change ‘Allow from 127.0.0.1‘ to ‘Allow from all
Save
3- Create password for cgi-bin admin user
# htpasswd -c /var/lib/backuppc/passwd/htpasswd admin
4- Edit backuppc config file
# vi /etc/BackupPC/config.pl 
Find and change accordingly
$Conf{ServerHost} = 'localhost';
$Conf{SplitPath} = '/usr/bin/split';
$Conf{CatPath} = '/bin/cat';
$Conf{GzipPath} = '/bin/gzip';
$Conf{Bzip2Path} = '/usr/bin/bzip2';
$Conf{BackupPCUser} = 'backuppc';
$Conf{TopDir} = '/var/lib/backuppc';
$Conf{ConfDir} = '/etc/BackupPC';
$Conf{LogDir} = '/var/log/BackupPC';
$Conf{InstallDir} = '/usr';
$Conf{CgiDir} = '/usr/share/backuppc/cgi-bin';
$Conf{ServerInitdPath} = '/etc/init.d/backuppc';
$Conf{ServerInitdStartCmd} = '$sshPath -q -x -l root $serverHost$serverInitdPath start';
$Conf{SshPath} = '/usr/bin/ssh';
$Conf{NmbLookupPath} = '/usr/bin/nmblookup';
$Conf{PingPath} = '/bin/ping';
$Conf{CgiAdminUsers} = 'admin';
Save
5- Grant passwordless sudo for user backuppc to run /bin/gtar and /bin/tar
# visudo

Add these entries :
Defaults !lecture # to disable lecture
backuppc ALL=NOPASSWD:/bin/gtar,/bin/tar # enable user backuppc to run /bin/tar and /bin/gtar without authentication.
Comment this entry
#Defaults requiretty
Save and exit
Restart apache and backuppc service
# /etc/init.d/http restart
# /etc/init.d/backuppc restart

Open your browser and point it to ‘http://backuppc_server_ip/backuppc‘ and you should see the backuppc web interface


After this, you have to do almost all the configuration through the web interface. To test, you can run localhost backup first. You have to create the host, fill up all the setting and you are ready to go. Record the host and ip in /etc/hosts.
II Client setup
1 – Create new user
# useradd backupuser
# passwd backupuser
2- Grant passwordless sudo for user backupuser
# visudo
Add these entries
Defaults !lecture # to disable lecture
backupuser ALL=NOPASSWD:/bin/gtar,/bin/tar # enable user backuppc to run /bin/tar and /bin/gtar without authentication.
Comment this entry
#Defaults requiretty
Save
3- From the server using backuppc user, create ssh public key
# su -s /bin/bash backuppc
$ mkdir .ssh
$ chown backuppc.backuppc .ssh
$ chmod 700 .ssh
$ ssh-keygen -t rsa
$ ssh-copy-id -i .ssh/id_rsa.pub backupuser@client
4 – To make sure that the 3rd step is a success, try to ssh to backupuser@client using backuppc user from the server. If no password is asked, then you are ready.
# su -s /bin/bash backuppc
$ ssh backupuser@client
You can start entering the client to the list of host and start backing up :)
If something didnt work , please post it in the forum

No comments:

Post a Comment