Saturday, November 15, 2014

How to Install tmate Server on CentOS 6.5

1- Install required packages for tmate and for compiling

Use group install for development tools. It will install all the following pakcages for you: autoconf automake binutils bison flex gcc gcc-c++ gettext libtool make patch pkgconfig redhat-rpm-config rpm-build rpm-sign
# yum groupinstall 'Development Tools'
Then install other required packages for tmate
# yum install git kernel-devel zlib-devel openssl-devel ncurses-devel cmake ruby libssh-devel
Check if libevent is installed and the version. We need libevent2
# rpm -qa | grep libevent
libevent-devel-1.4.13-4.el6.x86_64
libevent-doc-1.4.13-4.el6.noarch
libevent-headers-1.4.13-4.el6.noarch
libevent-1.4.13-4.el6.x86_64
If the version is older, remove it
yum remove libevent libevent-devel libevent-headers
Download libevent2
wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
tar xf libevent-2.0.21-stable.tar.gz
cd libevent-2.0.21-stable
Compile it and install
./configure
make
make install
Create a symbolic link if you are on a 64-bit server
ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5

2- Installing tmate-slave

Now download tmate-slave
# git clone https://github.com/nviennot/tmate-slave.git
Initialized empty Git repository in /root/Downloads/tmate-slave/.git/
remote: Counting objects: 23464, done.
remote: Total 23464 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (23464/23464), 18.50 MiB | 17.14 MiB/s, done.
Resolving deltas: 100% (13397/13397), done.
Change into the new directory and create the SSH keys
# cd tmate-slave/ $$ ./create_keys.sh 
Generating public/private dsa key pair.
Your identification has been saved in keys/ssh_host_dsa_key.
Your public key has been saved in keys/ssh_host_dsa_key.pub.
Save the 3x keys (dsa, rsa and ecdsa)
The key fingerprint is:
Install tmate-slave
# ./autogen.sh
# ./configure
# make

3- Starting tmate-slave

Move your tmate folder if you want. I have mine under $HOME/bin
[root@localhost bin]# mv ../Downloads/tmate-slave/keys/ .
If SSH is running, select another port and start tmate
# ./tmate-slave -k keys -l ../var/log/tmate.log -p 224 &

4- Configuring the client to use your server

Create $HOME/.tmate.conf with the following
set -g tmate-server-host "[your server FQDN]"
set -g tmate-server-port [server port]
set -g tmate-server-dsa-fingerprint   "dsa fingerprint"
set -g tmate-server-rsa-fingerprint   "rsa fingerprint"
set -g tmate-server-ecdsa-fingerprint "ecdsa fingerprint"
#set -g tmate-identity ""              # Can be specified to use a different SSH key

No comments: