Menu

Automation with Rex

30 March 2013

With (R)?ex you can manage all your boxes from a central point through the complete process of configuration management and software deployment. (R)?ex uses SSH as its default transport layer. So there is no need to install anything on your servers. You just need a ssh enabled account.

Install Rex server

Since Rex is using SSH as its transport layer, we only have to install Rex on one central instance, called rex server. We do not need to install anything on all the other servers, except OpenSSH, of course. At the beginning we configure basic security (SSH) and setup a user for Rex.

The rex user will need a private/public keypair, in order to login into the servers without password authentication. For that reason, we generate this keys on the rex server, without passphrase, just accept the defaults!

ssh-keygen -t rsa

I'm using the rex user, created above, to login to the all the servers. First login as rex user at the rex server, and copy its public key to the root user, or a user with all the sudo rights, on all the servers you are going to manage by rex: ssh-copy-id [email protected].

Now test the SSH login with your keypair and make sure it works because we're going to disable any other login method. Make sure this user can use sudo too.

Lots of Perl libraries will be installed, next to Rex binaries, see the perl modules i.e. at /usr/share/perl5/Rex

Install Rex from source code on Github

You find the repository of Rex here. Install a particular version (i.e. 0.40) is easy, since each version is a git branch. First we need to install the tools we need to compile the source code to binaries, as well as Git:

sudo apt-get install build-essential
sudo apt-get install git

Then we need few libraries, on which Rex depends, using Ubuntu Precise (12.04) LTS:

/usr/local/share: the perl modules (see in /usr/local/share/perl/5.14.2) and the man pages (/usr/local/share/man)

If you want to install another Rex version, delete these files from /usr/local, clone the source code in an other version from Github, and compile again. To delete previous Rex version from /usr/local/bin and /usr/local/share/perl/5.14.2 use: