Installations
From RdiffBackupWiki
Contents |
Linux
rdiff-backup is in the Fedora, Debian, Gentoo, and PLD distributions of GNU/Linux so for those distributions, you need only use the package manager and tell it to perform the installation.
For Red Hat, an RPM file is available for download from the rdiff-backup homepage.
For SuSE, do the following:
- Install python-devel and librsync packages using YaST
- Follow the 2-step directions that come with the rdiff-backup source.
For SuSE 9.2 (and possibly other recent versions), librsync is not available on the SuSE media as an RPM. Have no fear! Download the librsync source tarball from the link on the rdiff-backup home page, then do the following as root:
cd /usr/local/src/
tar -xzf {somepath/}librsync-{someversion}.tgz
cd librsync-{someversion}/
./configure
make
make install
ldconfig
I found that I had to say "make AM_CFLAGS=-fPIC" instead of plain "make" Dhoworth 02:04, 19 January 2007 (EST)
In the above, {somepath/} is (optionally) the temporary directory where you put the librsync source archive (.tgz), and {someversion} is the version number of the librsync you are installing.
Now librsync is installed, though RPM will not realize this. You could override that dependency with "--nodeps" when installing rdiff-backup from RPM, but it's just as easy to install rdiff-backup from source. Just extract the rdiff-backup source code and use its setup.py installation as described above for other SuSE versions.
(Note: It seems to work best if you do not try to use the --prefix option on the installation of rdiff-backup.) (Further note: For example, if you use --prefix /usr/local, it not only moves the executable script under /usr/local but all the modules as well and python cannot find them. I had to move them by hand Dhoworth)
Build on [Debian GNU/Linux] from source
When RPMs and .debs aren't configured quite right, use the source, Luke
Windows
Install Cygwin. When presented with the list of packages, opt to install gcc, make and Python in addition to all the packages installed by default.
Download, uncompress, compile and install librsync. Then download, uncompress and install rdiff-backup. Use the latest version (1.1.15). The stable version (1.0.5) has many bugs that makes it misbehave under Windows.
Use the task scheduler to run your backup regularly. Since rdiff-backup is a hash-bang file it will not execute directly from the Windows shell. You have to invoke it via Python:
python c:\cygwin\bin\rdiff-backup . c:\backup
Be careful, the file name matching and globbing mechanisms for inclusions and exclusions are buggy under Windows.
* File name matching is case sensitive, even though the file system is not, * it only works with relative paths, * it insists on Cygwin-style forward slashes, * it is confused by fully blank lines * and it requires unix-style line endings (use dos2unix to do the conversion).
Mac OS X
Simplest:
If you have [Darwin Ports] installed, simply run the following command:
sudo port install py-xattr sudo port install rdiff-backup
This will install all dependencies as well, including librsync, python, and py-xattr for Mac OS X. Note, you'll need to have the X11 SDK packages from the Xcode Developer Tools installed to run Mac Ports.
If the install of py-xattr fails during the installation of db44, try this solution from the macports-users mailing list:
sudo port install apr-util +no_bdb sudo port install subversion +no_bdb +tools sudo port install py-xattr sudo port install rdiff-backup
To install the development branch of rdiff, run:
sudo port install rdiff-backup-devel
Manual approach (latest version, best features):
- Make and install [librsync]
- Download and install [python]
- Download and install [[|http://undefined.org/python/#xattr py-xattr]]
- Download and install rdiff-backup from CVS (i.e., version 1.1.6 or newer).
librsync, python, and py-xattr can be installed via [Fink], for example:
sudo fink install librsync sudo fink install librsync-shlibs sudo fink install python24 sudo fink install python24-shlibs sudo fink install xattr-py24
Compatibility:
- CVS as of November 4, 2006 adds support for creation dates, extended
attributes (when py-xattr is used), and symlink modes. This corresponds to version 1.1.6.
- Recent 1.x versions work quite well on Mac OS X
- Version 0.12.6 seems to work fine on Mac OS X 10.2.8.
- Version 0.13.4 is broken on Mac OS X
Solaris
Using gcc instead of Solaris's CC can produce much better results, both when compiling librsync and rdiff-backup's modules. If Python is compiling rdiff-backup's C and _librsync modules with the 'pycc' command, simply addCC=gccto your environment variables.
Also, you may need to compile librsync with -fPIC so that python can load it. I use:
./configure
make AM_CFLAGS=-fPIC
make install
A bug in librsync-0.9.6 (fixed in 0.9.7) causes the following run-time error often, but not always:
ERROR: (rs''file''copy_cb) seek failed: Invalid argument
This is fixed in the CVS version, but the following minimal patch suffices:
diff -u -r1.1 buf.c --- buf.c 2004/03/23 02:54:34 1.1 +++ buf.c 2004/03/23 02:54:48 @@ -40,8 +40,8 @@ */ -#include <sys/types.h> #include <config.h> +#include <sys/types.h> #include <assert.h> #include <stdlib.h>
Also, rdiff-backup version 0.12.6 compiles but fails at run-time with an undefined symbol:
... ld.so.1: ... C.so: symbol major: referenced symbol not found
This is fixed in 0.13.4, which I what I am using on my solaris-8-sparc gcc-3.3-2 platform, successfully so far.
FreeBSD
Installing rdiff-backup is very simple because it is available in the FreeBSD Ports Collection.
To install the precompiled package just run e.g.
pkg_add ~ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-4-stable/All /rdiff-backup-0.12.7.tgz
For more information about using ports, see the "Installing Applications: Packages and Ports" section of the FreeBSD Handbook http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports.html.
OpenBSD
No major problems building 0.12.7 from source on OpenBSD 3.6, nor on 3.9 on 2007-04-15:
librsync 0.9.7 builds without problems with the usual commands:
* ./configure * make all check * make install
librsync installs in /usr/local by default, so build rdiff-backup with
* python setup.py --librsync-dir=/usr/local build
and install with
* python setup.py install --prefix=/usr/local
A minor annoyance is that the man page gets installed in /usr/local/share/man. Either add this path to /etc/man.conf, or copy /usr/local/share/man/man1/rdiff-backup.1 to /usr/local/man/man1.
HP-UX
The following installation of rdiff-backup-1.0.2 is based on use of GCC on HP-UX 11i:
* GNU tools were installed mostly in /usr/local for my system -
important for ease of library installs.
* Install zlib: add the '-s' option to ./configure (shared library) * Install librsync: add --with-pic and --enable-shared to ./configure
(shared library, position-independent)
* Install python from source.
* Install rdiff-backup with --librsync-dir3D/usr/local. (If you did
not make shared libraries for librsync, this will fail)
* Make sure rdiff-backup is in sshd's command path. * rdiff-backup will fail at runtime if zlib was not properly installed.
Note: be sure to exclude /dev/shm or you will get a severe Python dump (when you hit the rdiff-backup image).
INSTALLING RDIFF-BACKUP AS A USER (i.e., not administrator)
People in this category include those with web hosting accounts, or those who would like to keep all their rdiff-backup related files in one place. There are a few tricks that apply in this case, mostly related to applying the correct path settings. It may seem simple, but it took a heck of a long time for me to figure out
BACKGROUND
The standard install instructions assume that you're doing a system-wide install of rdiff-backup and associated files -- i.e., into places like /usr/bin, etc. Those of us who want to do an install in our user directories have a bit more work to do.
The common error associated with path problems is the dreaded "No module named rdiff_backup.Main". It's been covered several times on the rdiff-backup-users list, namely:%%% http://lists.gnu.org/archive/html/rdiff-backup-users/2002-12/msg00025.html
But this is only part of the story. I ran into lots of other errors for which no specific solution has been posted to the list, for example:%%% http://www.nongnu.org/rdiff-backup/old-list-archive/2002-June/000446.html
The value you need to set for PYTHONPATH is actually a very specific and non-obvious place. Also, it seems to be sensitive to where you set the build directory. We'll cover these settings in this guide.
NOTE: this guide assumes you have Python and the usual build tools (gcc, etc.) already installed.
CREATE A DESTINATION DIRECTORY
- Create a directory somewhere in your user-writeable space (usually, your
home directory). We'll call this <outputdir>_ in the instructions from now on.
NOTE: it may be tempting to assign <outputdir>_ to the same place
you unpacked rdiff-backup and/or librsync, but DON'T do this. A bunch of directories will get created in <outputdir>_ and they need to be kept separate from the ones already present in the archive, otherwise things will be messed up.
BUILDING LIBRSYNC
- Download and unpack librsync.
- Change to the librsync directory.
- Run ./configure --prefix
3D<outputdir> --exec-prefix3D<outputdir> - Run make all check. Confirm that all tests pass.
- Run make install. This should put a bunch of things in
<outputdir>/bin and <outputdir>/lib.
BUILDING RDIFF-BACKUP
- Download and unpack rdiff-backup.
- Run python setup.py install --prefix
3D<outputdir>
--librsync-dir=3D<outputdir>
Note this assumes that you're putting rdiff-backup and librsync in the
same place, which is OK.
- Set the environment variable PYTHONPATH to the site-packages directory.
In bash, type PYTHONPATH=3D<outputdir>/lib/python2.3/site-packages_
- Change to your <outputdir>/bin_ directory.
- Run ./rdiffbackup -V_. Confirm that this displays the version
information.
SETTING UP THE CLIENT/SERVER PARTS
- Repeat the above procedure on the other computer(s) you're using
- On the computer being used as the server, you'll need to make sure the
path assignents are made before rdiff-backup is run. Do the following:
* If your shell is bash, edit the .bashrc file. Note that
.bash_profile, which is where you'd normally do this, won't work because when rdiff-backup invokes the server, it does so as "not a tty", thus bypassing .bash_profile.
* Put the following lines in your .bashrc file:
export PATH=3D$PATH:<outputdir>/bin%%%
export PYTHONPATH=3D<outputdir>/lib/python2.3/site-packages
- Run a simple backup to test to make sure everything works.
For example, _./rdiff-backup --print-statistics <source>
<user>@<host>::<dest>_
FINE-TUNING AND POLISHING
- You'll probably want to follow the SSH key exchange instructions on the
"unattended rdiff-backup page" linked from the documentation page. (currently at http://arctic.org/~dean/rdiff-backup/unattended.html). I had trouble with this part, too. SSH doesn't like it when your home directory is group-writable, for instance -- you can correct this by using chmod g-w ~
- Setting up rdiff-backup to run as a cron job can also be a challenge for
those of us on user accounts. You'll probably have to make the same PATH and PYTHONPATH settings described above on your client computer, as well. Also, if stuff fails, try using absolute paths in the stuff you run using cron.
Hope that helps --- Joseph Luk, March 2006
