Wednesday, February 18, 2009

installation & configuration backuppc in fedora 9/10

Installing backuppc in fedora9/10

I have been given the task of setting up one backuppc server, and below are the steps on how I did it :)

Server setup

                         #yum install backuppc          

                         the perl module needed using yum

    • # yum install perl-Compress-Zlib perl-Archive-Zip perl-File-RsyncP perl-XML-RSS httpd
    • # rpm -Uvh backuppc-3.1.0-1%{dist}.i386.rpm
  1. 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
  6. Restart apache and backuppc service
    • # /etc/init.d/http restart
    • # /etc/init.d/backuppc restart
  7. Open your browser and point it to 'http://backuppc_server_ip/backuppc' and you should see the backuppc web interface 
  8. 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.
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
  5. You can start entering the client to the list of host and start backing up :)

No comments: