Set up Unison for Two Way Syncing on 2 Centos Servers

Have been played with both Async and Unison, I found Unison is more powerful, especially on 2 way syncing include deletion. Unison is easy to get start as well.

You can setup Unison by compiling the source, but it is not as easy as I thought – I ran into some libraries dependency conflicts.

Luckily, I am working on Centos servers. I can just use Yum to install it.

Enable Fedora EPEL repos for your Yum with protectbase

wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5-4.noarch.rpm
yum install yum-protectbase.noarch -y
yum repolist

Install Unison via Yum

yum install unison -y

Enable SSH Access without Password

On local host, do these:

ssh-keygen
#followed by three ENTERs
ssh-copy-id -i .ssh/id_rsa.pub root@remotehost
ssh root@remotehost

Sample Unison Command

/usr/bin/unison /web/live1 ssh://remoteserver/web/live2 \
-ignore "Path WEB-INF/config" \
-ignore "Path WEB-INF/derby" \
-ignore "Path WEB-INF/test/test.xml"

Reference

HowTo Use unison File Synchronizer
3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id

2 thoughts on “Set up Unison for Two Way Syncing on 2 Centos Servers”

  1. Thank you for this. I usually use Debian so I don’t know my way around the innards of CentOS so well. When I tried it on 6.3 the yum-protectbase.noarch package couldn’t be found; how much a problem is this?

Leave a Reply

Your email address will not be published. Required fields are marked *