Skip to content

Instantly share code, notes, and snippets.

@hSATAC
Forked from xinzweb/tmate-slave-ubuntu-1604.md
Created December 11, 2018 16:17
Show Gist options
  • Save hSATAC/de6227af4125deda64b086e3e6a2cd90 to your computer and use it in GitHub Desktop.
Save hSATAC/de6227af4125deda64b086e3e6a2cd90 to your computer and use it in GitHub Desktop.
Tmate-slave on Ubuntu 16.04

Install dependincies

apt-get install  git-core build-essential pkg-config libtool libevent-dev libncurses-dev zlib1g-dev automake libssh-dev cmake ruby

Install msgpack >= 1.2.0

git clone https://github.com/msgpack/msgpack-c.git
cd msgpack-c
cmake .
make
sudo make install

Install newer libssh >= 0.7.0

sudo add-apt-repository ppa:kedazo/libssh-0.7.x
sudo apt-get update
sudo apt-get install libssh-4

Compile tmate-slave

git clone https://github.com/tmate-io/tmate-slave.git
cd tmate-slave
./autogen.sh
./configure
make

Run tmate-slave

# NOW, tmate-slave is ready, let's run it and listen to port 2222. 

# This will generate SSH keys, REMEMBER the keys fingerprints, you need those later in `~/.tmate.conf` settings
# Those keys are stored under directory ./keys
./create_keys.sh
sudo sighup ./tmate-slave -p 2222 -k /etc/tmate-slave-keys

Then follow the instruction from https://tmate.io/ of the "Host your own tmate server" to setup the ~/.tmate.conf to use your own tmate-slave server on Ubuntu.

Make the tmate-slave run as a service

Setup systemd (/etc/systemd/system/tmate-slave.service)

[Install]
WantedBy=multi-user.target

[Unit]
Description=Tmate-Slave
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
Restart=always
User=root
ExecStart=/home/ubuntu/tmate-slave/tmate-slave -p 2222 -k /home/ubuntu/tmate-slave/keys

Enable/Start service

sudo systemctl daemon-reload
sudo systemctl enable tmate-slave
sudo systemctl start tmate-slave

You can check the status using systemctl status tmate-slave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment