Tmux is a terminal multiplexer. Terminal multiplexer allow you to switch easily between several programs in one terminal, you can detach them (keep running in the background) and reattach them again to a different terminal.
In this article I will show how you can install tmux from source on non-root user.
Install Tmux from Source (Non-Root User)
Follow the below steps to install tmux from source on non-root user.
Step #1 : Install Libevent
If libevent package is not installed on your system. Follow the below command to download and install libevent from its official website and configure and install.
$ wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz $ tar xvf libevent-2.0.22-stable.tar.gz $ cd libevent-2.0.22-stable $ ./configure --prefix=$HOME $ make # use make -j 8 to speed it up if your machine is capable $ make install
Step #2 : Install Tmux
Now after installing libevent package on your system lets install tmux source tarball from its official website.
$ wget https://github.com/tmux/tmux/releases/download/2.2/tmux-2.2.tar.gz $ tar xvf tmux-2.2 $ ./configure --prefix=$HOME CFLAGS="-I$HOME/include" LDFLAGS="-L$HOME/lib" $ make $ make install
In above command I have set the installation prefix to my home directory and also mentioned gcc where to find the libevent headers and libraries using the CCFLAGS and LDFLAGS.
Step #3 : $PATH Setup
tmux binary has been installed on $HOME/bin, so we need to tweak the $PATH variable a bit so that bash will find the binary before the system one.
$ export PATH=$HOME/bin:$PATH
You can also put the above line in your .bashrc file.
Step #4 : Testing
Now you can use tmux, run the below command to check the tmux running version.
$ tmux -V tmux 2.2