Thursday, April 18, 2013

Mosh for a compute cluster

Mosh is an awesome tool for folks who repeatedly ssh to one machine. In an ideal world, you can keep stay logged in to the machine even as your computer’s internet connection turns on and off. Mosh does exactly this. I keep one terminal window open with mosh; whenever my computer reconnects to the internet, it automatically restarts the ssh session right where it left off, with no password entry or anything.

I wanted to use Mosh to connect to my computing cluster, but some dependencies were missing. It was a little confusing to get them set up, so I give the play-by-play here. First I got protobuf:

cd ~
mkdir src && cd src
tar xvzf protobuf-2.5.0.tar.gz
cd protobuf-2.5.0
./configure --prefix=/home/my_name/local
make install

Then I got mosh:

cd ~/src
git clone
cd mosh
PKG_CONFIG_PATH=/home/my_name/local/lib/pkgconfig ./configure --prefix=/home/my_name/local
make install

If I don't specify the package config path, I get a message:
No package 'protobuf' found

Don't be so sure that your home folder is in /home/your_name on every cluster! Just do a quick pwd to make sure you know where you are. The package config path must be absolute.

Then I can use mosh to log into the cluster:
mosh cluster_name server='LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/my_name/local/lib /home/my_name/local/bin/mosh-server'

Without specifying the library path, I get an error:
error while loading shared libraries: cannot open shared object file: No such file or directory

No comments:

Post a Comment