Synchronize files with Unison
Before beginning this guide, we assume you have completed the getting started guide. If you're new to Linux system administration, we recommend considering the guides in our using Linux series, particularly the administration basics guide. If you're simply looking to gain access to your Linode on your local system, you may want to consider deploying a remote file system. Conversely, if you need a more complex backup system, your needs may be better served by an incremental backup system.
These instructions work with the Linode platform. If you don't have a Linode yet, sign up for a Linux VPS and get started today.
Installing Unison on a Linode
Debian 5 (Lenny)Begin by installing the required software for Unison on the remote machine. Issue the following sequence of commands to ensure that your system's package database is up to date, that all installed packages are up to date, and install Unison:
apt-get update apt-get upgrade apt-get install unisonDebian also includes packages for Unison version 2.13 (packaged as unison2.13.16) if you need to use this older version of the software to interact with a specific client. Otherwise, install the more recent version of Unison, packaged as unison.
Ubuntu 9.10 (Karmic)Edit the /etc/apt/sources.list to enable to the Universe repositories, so that it resembles the following:
## main & restricted repositories deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted deb-src http://us.archive.ubuntu.com/ubuntu/ karmic main restricted deb http://security.ubuntu.com/ubuntu karmic-security main restricted deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted ## universe repositories deb http://us.archive.ubuntu.com/ubuntu/ karmic universe deb-src http://us.archive.ubuntu.com/ubuntu/ karmic universe deb http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe deb-src http://us.archive.ubuntu.com/ubuntu/ karmic-updates universe deb http://security.ubuntu.com/ubuntu karmic-security universe deb-src http://security.ubuntu.com/ubuntu karmic-security universeFinally, issue the following sequence of commands to: ensure that your system's package database is up to date, that all installed packages are up to date, and install Unison:
apt-get update apt-get upgrade apt-get install unison
CentOS 5The unison packages for CentOS are not included in the base distribution, but are included in the EPEL repositories. Enable the EPEL repository, and ensure that your system is up to date and install unison with the following commands:
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm yum update yum install unison227The EPEL repository also includes a package for Unison version 2.13 in the unison213 package. This may be helpful if you need to use this version of the client, otherwise use the more recent version of the software.
FedoraOn Fedora systems issue the following sequence of commands to ensure that your system is up to date and then install Unison:
yum update yum install unison
Installing Unison on Local MachinesIn order to function properly, the major and minor version numbers of Unison used by the remote and local system must match. Test the version of Unison that was installed by the package manager on your Linode by issue the following command:
unison -versionUse the information provided by the output of this command to aid in your decision on the appropriate version of your client.
If you are running a Linux-based system on your local machine you can install unison tools using the above procedures. If you're running Debian or Ubuntu systems, you can issue the following command to install a graphical front-end for Unison:
apt-get install unison-gtkDebian 5 (Lenny) also includes a graphical user interface for Unison version 2.13, packaged as "unison2.13.16-gtk".
If you're running OS X or Windows, download an appropriate Unison client. When successfully installed, provide the client with the resolvable address of the remote server, SSH keys or other authentication credentials, and the absolute paths to the local and remote folders that you want to synchronize. From now on, when you run Unison from the client app, changes to either or both of the specified file systems will be updated and reflected in both instances. Congratulations!