Home > Backup, Hyper-V, Linux > Install BackupPC on CentOS 6.3

Install BackupPC on CentOS 6.3

Last week, my boss asked me to install BackupPC on CentOS 6.3. Why CentOS? I actually have the same question–sorry, am used to Debian; regardless, my quest begun but I have to confess, it was not as easy as it seemed since there were fewer How To’s, Tips, and references for CentOS, especially 6 or 6.3 for that matter. This is reason enough for me to blog the steps I undertook to successfully install BackupPC on CentOS 6.3 and make it work after a week of “trial and error”–I may be a Debian user but am not a Linux geek. I am instead part of this group . Without further ado, let’s get it on!

  1. You need to have a running CentOS 6.3. I installed it with minimal components on a VM via Hyper-V 2; “lean but mean” so to say.

  2. Using Putty, connect to your CentOS box and install these useful tools:
    • wget – an easy-to-use CLI download tool.
    • nano – a file editor for humans.
    • screen – I like this tool because it allows you to have different screens for every task you to do; very useful, it enhances your Putty experience
    • man – your dependable CLI technical support.

    Use this command yum -y install man nano screen wget

  3. You need to add two special repositories, EPEL and REMI. A number of the packages we need for this endeavor is not part of the Red Hat / CentOS package manifest.
    wget -c http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    wget -c http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
    rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

  4. Enable the REMI repository.
    nano /etc/yum.repos.d/remi.repo

    Edit and save the above file to reflect this:

    name=Les RPM de remi pour Enterprise Linux $releasever – $basearch
    #baseurl=http://rpms.famillecollet.com/enterprise/$releasever/remi/$basearch/
    mirrorlist=http://rpms.famillecollet.com/enterprise/$releasever/remi/mirror
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
    failovermethod=priority

  5. Install the BackupPC pre-requisites.
    yum -y install perl-Compress-Zlib perl-Archive-Zip perl-File-RsyncP perl-suidperl openssh-clients expect

  6. Do an update, then upgrade, to make sure everything is up-to-date.
    yum -y update
    yum -y upgrade

  7. We need to create the user account that BackupPC will use and assign a password for it.
    adduser backuppc
    passwd backuppc

    You will be prompted to key-in your desired password. Remember this password ’cause you will need it later.

  8. And now folks, the moment you’ve all been waiting for, the BackupPC installation!
    yum -y install BackupPC

    I wish the command was longer or better yet, extremely complex but that’s just it…

  9. After the package installation, two biggies are now in place, Apache and BackupPC. Verify that these services are listed in the startup script.
    chkconfig –list backuppc
    chkconfig –list httpd

    Notice that both are turned off.

  10. We need to make these two services start at startup. Do this:
    chkconfig backuppc on
    chkconfig httpd on

  11. You’re probably guessing what’s Apache got to do with BackupPC; well, it runs the web interface but we need to do some tasks before we can use it. We first need to create the access file.
    htpasswd -c /etc/BackupPC/apache.users backuppc

    You will be prompted for a password; just key-in the password you assigned the backuppc user awhile back.

  12. Edit and save the BackupPC configuration file for Apache.
    nano /etc/httpd/conf.d/BackupPC.conf

    Your changes should reflect something like this:
    order deny,allow
    deny from all
    #allow from 127.0.0.1
    #allow from ::1
    allow from all
    AuthType Basic
    AuthUserFile /etc/BackupPC/apache.users
    AuthName “backuppc”

  13. As a safety precaution, make a duplicate of the BackupPC main configuration file.
    cp /etc/BackupPC/config.pl /etc/BackupPC/config.pl.ORIG

  14. We’ll use screen to help us accomplish this next task.
    screen
    nano /etc/BackupPC/config.pl

    In nano, press CTRL + W; this will invoke the search facility. Search for this parameter $Conf\{ServerMesgSecret\}.

    Now, press CTRL + A + C; this will open another screen. Run this command:
    mkpasswd -l 32 -d 16

    Highlight the output then press CTRL + A + P; this will bring you back to the previous screen. Right-click your mouse to paste the output between the single quotes of the aforementioned configuration parameter. You should have something like this:
    $Conf{ServerMesgSecret} = ‘7687nR848l39etpm7812w1f-pj3iEpb7’;

    Next, search for this parameter $Conf{CgiAdminUsers} and add backuppc. You should have something like this:
    $Conf{CgiAdminUsers} = ‘backuppc’;

  15. This time, edit the Apache configuration file.
    nano /etc/httpd/conf/httpd.conf

    Changes should reflect these changes:
    User backuppc
    Group apache
    ServerName actual_server_hostname_or_IP_Address:80
    (e.g. ServerName 172.27.10.25:80)

  16. Now, the secret that made the BackupPC web interface work:
    iptables -I INPUT -p tcp –dport 80 -j ACCEPT
    /sbin/service iptables save

    Just to make sure the firewall entry was saved, we verify.
    cat /etc/sysconfig/iptables. Result below:

    # Generated by iptables-save v1.4.7 on Mon Oct 15 15:57:49 2012
    *filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [4:464]
    -A INPUT -p tcp -m tcp –dport 80 -j ACCEPT
    -A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -p tcp -m state –state NEW -m tcp –dport 22 -j ACCEPT
    -A INPUT -j REJECT –reject-with icmp-host-prohibited
    -A FORWARD -j REJECT –reject-with icmp-host-prohibited
    COMMIT
    # Completed on Mon Oct 17 15:57:49 2012

  17. We now are nearing completion, let’s start the services.
    service httpd start
    service backuppc start

  18. The finale, access the BackupPC web interface.
    http://backuppc_server_hostname/BackupPC

Whew, I sure am glad we’re done.

Now give yourself a pat on back for a job well done…

Hope this helps

Advertisements
  1. October 19, 2012 at 10:46 pm

    Terrific work! That is the type of info that should be shared across the net. Disgrace on Google for now not positioning this post upper! Come on over and visit my site . Thank you =)

  2. cultavix
    October 23, 2012 at 6:38 pm

    thank you, thank you, thank you! you have cleared up a few questions that I had… if only we would all share our troubles with the detail and elegance that you presented this information!! ๐Ÿ™‚

    • October 25, 2012 at 10:07 am

      You’re welcome. Glad it was helpful

  3. norm
    November 7, 2012 at 6:00 am

    In step 17 the second line should be:
    service backuppc start

    • November 8, 2012 at 9:34 am

      Thanks for pointing it out; it actually was a typo. Correction applied.

  4. Dennis
    November 14, 2012 at 8:32 am

    I’m getting the follow error; please help!

    Error: Package: BackupPC-3.2.1-7.el6.x86_64 (epel)
    Requires: perl(Net::FTP::RetrHandle)
    Error: Package: BackupPC-3.2.1-7.el6.x86_64 (epel)
    Requires: httpd
    Error: Package: BackupPC-3.2.1-7.el6.x86_64 (epel)
    Requires: perl(Net::FTP::AutoReconnect)
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

    • November 17, 2012 at 11:04 pm

      Dennis, Hi. Please retry steps 3 through 5 and install BackupPC again. Hope this helps.

      • Dennis
        November 20, 2012 at 5:40 am

        [root@##server ##user]# rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
        warning: remi-release-6.rpm: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
        Preparing… ########################################### [100%]
        package epel-release-6-7.noarch is already installed
        package remi-release-6-1.el6.remi.noarch is already installed
        [root@##server ##user]# nano /etc/yum.repos.d/remi.repo
        [root@##server ##user]#
        [root@##server ##user]# yum -y install perl-Compress-Zlib perl-Archive-Zip perl-File-RsyncP perl-suidperl openssh- clients expect
        Loaded plugins: fastestmirror
        Loading mirror speeds from cached hostfile
        epel/metalink | 14 kB 00:00
        * base: mirror.nl.leaseweb.net
        * epel: mirror.nl.leaseweb.net
        * extras: mirror.nl.leaseweb.net
        * remi: rpms.famillecollet.com
        * updates: mirror.nl.leaseweb.net
        base | 3.7 kB 00:00
        epel | 4.3 kB 00:00
        epel/primary_db | 4.8 MB 00:00
        extras | 3.5 kB 00:00
        remi | 2.9 kB 00:00
        remi/primary_db | 423 kB 00:00
        updates | 3.5 kB 00:00
        Setting up Install Process
        Package perl-Compress-Zlib-2.020-127.el6.x86_64 already installed and latest version
        Package perl-Archive-Zip-1.30-2.el6.noarch already installed and latest version
        Package perl-File-RsyncP-0.68-6.el6.x86_64 already installed and latest version
        Package 4:perl-suidperl-5.10.1-127.el6.x86_64 already installed and latest version
        Package openssh-clients-5.3p1-81.el6_3.x86_64 already installed and latest version
        Package expect-5.44.1.15-4.el6.x86_64 already installed and latest version
        Nothing to do
        [root@##server ##user]# yum -y update
        Loaded plugins: fastestmirror
        Loading mirror speeds from cached hostfile
        * base: mirror.nl.leaseweb.net
        * epel: mirror.nl.leaseweb.net
        * extras: mirror.nl.leaseweb.net
        * remi: rpms.famillecollet.com
        * updates: mirror.nl.leaseweb.net
        Setting up Update Process
        No Packages marked for Update
        [root@##server ##user]# yum -y upgrade
        Loaded plugins: fastestmirror
        Loading mirror speeds from cached hostfile
        * base: mirror.nl.leaseweb.net
        * epel: mirror.nl.leaseweb.net
        * extras: mirror.nl.leaseweb.net
        * remi: rpms.famillecollet.com
        * updates: mirror.nl.leaseweb.net
        Setting up Upgrade Process
        No Packages marked for Update
        [root@##server ##user]# adduser backuppc
        adduser: user ‘backuppc’ already exists
        [root@##server ##user]# passwd backuppc
        Changing password for user backuppc.
        New password:
        Retype new password:
        passwd: all authentication tokens updated successfully.
        [root@##server ##user]# yum -y install BackupPC
        Loaded plugins: fastestmirror
        Loading mirror speeds from cached hostfile
        * base: mirror.nl.leaseweb.net
        * epel: mirror.nl.leaseweb.net
        * extras: mirror.nl.leaseweb.net
        * remi: rpms.famillecollet.com
        * updates: mirror.nl.leaseweb.net
        Setting up Install Process
        Resolving Dependencies
        –> Running transaction check
        —> Package BackupPC.x86_64 0:3.2.1-7.el6 will be installed
        –> Processing Dependency: perl-Time-modules for package: BackupPC-3.2.1-7.el6.x86_64
        –> Processing Dependency: perl(XML::RSS) for package: BackupPC-3.2.1-7.el6.x86_64
        –> Processing Dependency: perl(Time::ParseDate) for package: BackupPC-3.2.1-7.el6.x86_64
        –> Processing Dependency: httpd for package: BackupPC-3.2.1-7.el6.x86_64
        –> Running transaction check
        —> Package BackupPC.x86_64 0:3.2.1-7.el6 will be installed
        –> Processing Dependency: httpd for package: BackupPC-3.2.1-7.el6.x86_64
        —> Package perl-Time-modules.noarch 0:2006.0814-5.el6 will be installed
        —> Package perl-XML-RSS.noarch 0:1.45-2.el6 will be installed
        –> Processing Dependency: perl(DateTime::Format::W3CDTF) for package: perl-XML-RSS-1.45-2.el6.noarch
        –> Processing Dependency: perl(DateTime::Format::Mail) for package: perl-XML-RSS-1.45-2.el6.noarch
        –> Running transaction check
        —> Package BackupPC.x86_64 0:3.2.1-7.el6 will be installed
        –> Processing Dependency: httpd for package: BackupPC-3.2.1-7.el6.x86_64
        —> Package perl-DateTime-Format-Mail.noarch 0:0.3001-6.el6 will be installed
        –> Processing Dependency: perl(DateTime) >= 0.18 for package: perl-DateTime-Format-Mail-0.3001-6.el6.noarch
        –> Processing Dependency: perl(Params::Validate) for package: perl-DateTime-Format-Mail-0.3001-6.el6.noarch
        —> Package perl-DateTime-Format-W3CDTF.noarch 0:0.04-8.el6 will be installed
        –> Running transaction check
        —> Package BackupPC.x86_64 0:3.2.1-7.el6 will be installed
        –> Processing Dependency: httpd for package: BackupPC-3.2.1-7.el6.x86_64
        —> Package perl-DateTime.x86_64 1:0.5300-1.el6 will be installed
        –> Processing Dependency: perl(Class::Singleton) >= 1.03 for package: 1:perl-DateTime-0.5300-1.el6.x86_64
        –> Processing Dependency: perl(List::MoreUtils) for package: 1:perl-DateTime-0.5300-1.el6.x86_64
        –> Processing Dependency: perl(Class::Singleton) for package: 1:perl-DateTime-0.5300-1.el6.x86_64
        —> Package perl-Params-Validate.x86_64 0:0.92-3.el6 will be installed
        –> Running transaction check
        —> Package BackupPC.x86_64 0:3.2.1-7.el6 will be installed
        –> Processing Dependency: httpd for package: BackupPC-3.2.1-7.el6.x86_64
        —> Package perl-Class-Singleton.noarch 0:1.4-6.el6 will be installed
        —> Package perl-List-MoreUtils.x86_64 0:0.22-10.el6 will be installed
        –> Finished Dependency Resolution
        Error: Package: BackupPC-3.2.1-7.el6.x86_64 (epel)
        Requires: httpd
        You could try using –skip-broken to work around the problem
        You could try running: rpm -Va –nofiles –nodigest
        [root@##server ##user]#

  5. Fleck
    November 15, 2012 at 4:06 am

    Awesome post, thanks so much for the help!!

  6. Prashant
    November 30, 2012 at 4:59 pm

    Very Good Post..It helped me a lot….:)

  7. January 11, 2013 at 3:36 am

    This was a great post. Install worked perfectly, but I ran into a few issues:
    EPEL install must be done using the following link for the RPM: http://mirrors.xmission.com/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

    Also, when you do your search in the config file, do not add the \’s in the search terms…

    Finally, I had to edit IPTABLES manually and add this line as the command above gave me an error: -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT

    Otherwise, it worked perfectly and I had no trouble following your guide. Thank you very much!

    • Kristin Bates
      March 23, 2013 at 11:24 pm

      I was having the same problem. Kept getting a “Bad argument `80′” kicked back at me. I couldn’t find any refernce to dport in man. Took a close look at other entries in iptables and found the answer.

      The command should be:
      # iptables -I INPUT -p tcp –dport 80 -j ACCEPT
      # /sbin/service iptables save

      Worked perfectly in CentOS 6.4

      Thanks for the tutorial it has been a great help.

      • Kristin Bates
        March 23, 2013 at 11:27 pm

        The font is making it hard to read. There are suppose to be two – – before dport. Hope this helps someone else.

  8. Anonymoose
    January 25, 2013 at 8:18 pm

    Nice tutorial. I was trying to install BackupPC from source on CentOS 6.3 and kept running into bother getting the CGI to work properly.

    Thank god for package managers! ๐Ÿ˜€

  9. February 11, 2013 at 10:29 pm

    The installation worked fine, but I can’t access the host from my workstation. The host address is http://10.0.0.5/BackupPC. Here’s my iptables:

    # Generated by iptables-save v1.4.7 on Mon Feb 11 14:14:18 2013
    *filter
    :INPUT ACCEPT [0:0]
    :FORWARD ACCEPT [0:0]
    :OUTPUT ACCEPT [32:3952]
    -A INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT
    -A INPUT -p icmp -j ACCEPT
    -A INPUT -i lo -j ACCEPT
    -A INPUT -p tcp -m state –state NEW -m tcp –dport 22 -j ACCEPT
    -A INPUT -j REJECT –reject-with icmp-host-prohibited
    -A INPUT -p tcp -m tcp –dport 80 -j ACCEPT
    -A INPUT -p tcp -m state –state NEW -m tcp –dport 80 -j ACCEPT
    -A FORWARD -j REJECT –reject-with icmp-host-prohibited
    COMMIT

    What else should I check? I can ping the host fine from my workstation.

    • February 21, 2013 at 10:56 am

      Verify if Apache is already running. From your workstation, point your browser to http://10.0.0.5. You should get the Apache initial page otherwise, you may need to start it… ๐Ÿ™‚

      • April 28, 2013 at 8:59 am

        [root@boron ~]# service httpd status
        httpd (pid 1357) is running…

  10. February 24, 2013 at 12:20 am

    Great Information. Thanks!

  11. Ben
    March 18, 2013 at 7:21 am

    On CentOS 6.3 with DirectAdmin is have the follow error:

    Error: Package: BackupPC-3.2.1-10.el6.x86_64 (epel)
    Requires: httpd
    Error: Package: BackupPC-3.2.1-10.el6.x86_64 (epel)
    Requires: perl(Net::FTP::RetrHandle)
    Error: Package: BackupPC-3.2.1-10.el6.x86_64 (epel)
    Requires: perl(Net::FTP::AutoReconnect)
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

  12. mcvays
    July 13, 2013 at 3:46 am

    Great write up. This was exactly what I needed to this backuppc off the ground. Thanks for taking the time to write this out.

  13. okna Drewniano Aluminiowe
    August 17, 2013 at 9:33 pm

    Very nice post. I just stumbled upon your weblog and wished to say that
    I’ve really enjoyed surfing around your blog posts. In any case I will be subscribing to your rss feed and I hope you write again very soon!

  14. August 23, 2013 at 10:53 pm

    All Work for me.

    Just one thing:

    I have a web site in my centos. If i change the apache user to backuppc, i canยดt connect with my databases. What can i do?

    • September 8, 2013 at 10:49 am

      You can, I think, use the username you currently use for the other website. In my VM lab, I used www-data for Apache user and group and it worked fine. Just make sure the BackupPC database uses the same user credential. ๐Ÿ™‚

  15. anonym
    January 11, 2014 at 3:58 am

    Grandios!!!!!

    only this works fine “–dport ” not “-dport”iptables -I INPUT -p tcp –dport 80 -j ACCEPT

    Thanks!

  16. March 1, 2015 at 5:22 pm

    Hello. I got thi erro when making full backup
    2015-03-01 17:10:32 full backup started for directory /
    2015-03-01 17:10:33 Got fatal error during xfer (Unable to read 4 bytes)
    2015-03-01 17:10:38 Backup aborted (Unable to read 4 bytes)
    Please help me fix this.
    Czarek.

    • July 15, 2015 at 2:55 pm

      Which backup client did you attempt to do a full backup?

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: