Automated build and install of tmux on centos 

It is usual for me to spin up a server for testing, sometimes it's only up for a couple of minutes but if I use it longer I find myself missing tmux. 

Unfortunately on centos7 the available tmux is too old (1.8-4.el7) for my taste so I have a little snippet I run to build and install it.

This downloads and builds the latest stable tmux release from github.


#!/bin/bash
yum -y remove tmux
yum -y install gcc jq libevent-devel ncurses-devel 
ORG=tmux
REPO=tmux
APP=tmux

# If you can't get this TAG/LOCATION stuff to work they probably rearranged files over at github
# Just go over to https://github.com/tmux/tmux/releases/ and download the tar.gz of the "Last release"
TAG=$(curl -s -L https://api.github.com/repos/$ORG/$REPO/releases/latest | jq -r '.tag_name')
LOCATION="https://github.com/$ORG/$REPO/releases/download/$TAG/$APP-$TAG.tar.gz"
# download tmux source
curl -L "$LOCATION" -o "/tmp/$APP-$TAG.tar.gz"

cd /tmp

# extract tmux source
tar xvf "$APP-$TAG.tar.gz"

cd "$APP-$TAG"
./configure && make
make install

I have this in a file cleverly called tmux-install.sh and mainly use it like this

ssh mycoolserver 'bash -s' < install/tmux/tmux-install.sh

If your not logging in as root you probably need to use sudo in a few places in the above code.



 

 

 

Comments