Jonathan on August 24th, 2008

RHEL/CentOS does not ship with rdiff-backup, and the existing well-known RPM sites only have really old versions. Even the version of rdiff-backup on the Red Hat extras (EPEL) site was last updated over a year ago (July 2007). These instructions work for rdiff-backup-1.2.0 and librsync-0.9.7.

Here are the steps to get it built:

1. Set up your rpmbuild directories:

  $ mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/RPMS  ~/rpmbuild/RPMS/i386
  $ mkdir -p ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/SRPMS
  $ echo "%_topdir $HOME/rpmbuild" > ~/.rpmmacros

2. Build librsync

2.1 Download latest librsync source code
http://librsync.sourceforge.net/

2.2 Build an rpm from librsync source code. The current version (0.9.7, released 2004-10-10) has a few problems which cause the standard rpmbuild command to fail. We’ll need to fix the librsync.spec file before building an rpm.

2.3 Fix the librsync.spec file.

  $ tar zxf /tmp/librsync-0.9.7.tar.gz
  $ vi librsync-0.9.7/librsync.spec

a) Change the “Version:” tag value to 0.9.7 (it’s accidentally set at 0.9.6)
b) Change the “Copyright:” tag name to “License:”
c) Change the “Source:” tag from its existing value:

http://prdownloads.sourceforge.net/librsync/librsync-0.9.6.tar.gz?download”

to the following:

http://prdownloads.sourceforge.net/librsync/librsync-0.9.7.tar.gz

2.3.1 I found some information that claimed if you are running selinux, then you must add the “–enable-shared” line to the configure script:

  ./configure --prefix=/usr --mandir=/usr/share/man/ --enable-shared

For details, see this post:
http://www.mail-archive.com/rdiff-backup-users@nongnu.org/msg03171.html

However, when adding that line, I wasn’t able to get the rpmbuild to complete. The error that I received was:

  Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/librsync-0.9.7-root
  error: Installed (but unpackaged) file(s) found:
      /usr/lib/librsync.so
      /usr/lib/librsync.so.1
      /usr/lib/librsync.so.1.0.2

I had to give up on this approach and elected to try a different workaround to make rdiff-backup run on selinux. See Instruction 5 for more info.

2.4 Move the old librsync tarball out of the way and tar up the modified one.

  $ mv /tmp/librsync-0.9.7.tar.gz /tmp/librsync-0.9.7.tar.gz.0
  $ tar zcf /tmp/librsync-0.9.7.tar.gz librsync-0.9.7/

2.5 Build the rpm file from the modified tarball.

  $ rpmbuild -ta /tmp/librsync-0.9.7.tar.gz

2.6 Install the librsync and librsync-devel rpms

  $ sudo rpm -ivh ~/rpmbuild/RPMS/i386/librsync-0.9.7-1.i386.rpm
  $ sudo rpm -ivh ~/rpmbuild/RPMS/i386/librsync-devel-0.9.7-1.i386.rpm

3. Build rdiff-backup

3.1 Download latest rdiff-backup source code (1.2.0 released 2008-07-27)
http://www.nongnu.org/rdiff-backup/

3.2 Build an rpm from rdiff-backup source code.

  $ rpmbuild -ta /tmp/rdiff-backup-1.2.0.tar.gz

3.3 Install the rdiff-backup rpm

  $ sudo rpm -ivh ~/rpmbuild/RPMS/i386/rdiff-backup-1.2.0-1.i386.rpm

4. Clean up work. Optionally, you can remove your rpmbuild directory since you don’t need it anymore.

  $ rm -fr ~/rpmbuild/ ~/.rpmmacros

5. If you are running selinux, you need to fix the selinux perms before running rdiff-backup. This is the workaround I mentioned earlier since I couldn’t get librsync to compile as described in step 2.3.1.

  $ sudo chcon -t textrel_shlib_t /usr/lib/python2.4/site-packages/rdiff_backup/_librsync.so

Tags: , ,