How to compile rsync on [crappy] shared hosting

November 19, 2010

I’m working on a client’s shared hosting server that doesn’t allow rsync. (It’s on there, just blocked from use, and tech support on $5/month hosting doesn’t know what rsync is.)

Anyway, getting rsync running in the home directory turned out to be very easy. If you’re running crappy shared Linux hosting with at least SSH access, and have the same problem, try this:

First make a space in your home directory, I used ~/opt (and src for the source code):
mkdir -p ~/opt/src
Then go to http://samba.anu.edu.au/rsync/ and get the latest source. As of now that’s 3.0.7, so I did:
cd ~/opt/src
Download (using curl in my case, because wget was blocked):
curl -O http://samba.anu.edu.au/ftp/rsync/src/rsync-3.0.7.tar.gz
tar -xzf rsync-3.0.7.tar.gz
cd rsync-3.0.7/
Now build it into ~/opt/rsync:
./configure --prefix=$HOME/opt/rsync
make
make install

Those should generate a bunch of output, hopefully with no errors… if it looks like it worked, run ~/opt/rsync/bin/rsync to confirm.
If that worked, and especially if there is already an rsync on the server but it’s blocked, you’ll want to give your version precedence in the PATH. So:
nano ~/.bashrc
Add a line at the end:
export PATH=~/opt/rsync/bin:$PATH
Ctrl+W saves, Ctrl+X exits.
Reload bashrc:
source ~/.bashrc
(or logout and back in)
Verify:
which rsync (should be the one you just created)
rsync

That’s it, unless your hoster put up some other restrictions (like the compiler itself), which is very possible.