Skip to content

Instantly share code, notes, and snippets.

@RyanZurrin
Last active October 25, 2024 13:40
Show Gist options
  • Save RyanZurrin/e38a1be61eb34512847e06740aa5b99f to your computer and use it in GitHub Desktop.
Save RyanZurrin/e38a1be61eb34512847e06740aa5b99f to your computer and use it in GitHub Desktop.

BUILDING TMUX LOCALLY

Set HOME directory: export HOME=/data/pnlx/home/$USER

Install OpenSSL

# Download the latest version of OpenSSL
wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz
tar -xvzf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w

# Configure and install OpenSSL in your local directory
./config --prefix=$HOME/local --openssldir=$HOME/local/openssl no-shared
make
make install

Set env variables:

export CFLAGS="-I$HOME/local/include"
export LDFLAGS="-L$HOME/local/lib"
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH

Install libevent:

wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
tar -xvzf libevent-2.1.12-stable.tar.gz
cd libevent-2.1.12-stable
./configure --prefix=$HOME/local LDFLAGS="-ldl"
make
make install
cd ..

Install ncurses:

# Download the latest ncurses release
wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.4.tar.gz

# Extract the archive
tar -xzvf ncurses-6.4.tar.gz

# Enter the extracted directory
cd ncurses-6.4

# Configure and Build
./configure --prefix=$HOME/local --with-shared --with-termlib --enable-pc-files --with-pkg-config-libdir=$HOME/local/lib/pkgconfig --with-includes=$HOME/local/include --with-libs=$HOME/local/lib

make
make install

Update PKG_CONFIG_PATH

You need to tell pkg-config where to find the newly installed ncurses libraries. Add this line to your shell’s configuration file (/home/$USER/.bashrc):

export PKG_CONFIG_PATH=/home/$USER/local/lib/pkgconfig:$PKG_CONFIG_PATH

source /home/$USER/.bashrc

Build TMUX:

# Clone tmux from GitHub
git clone https://github.com/tmux/tmux.git
cd tmux

# Set paths to local binaries for autoconf, automake, pkg-config, and libraries
export PATH=$HOME/local/bin:$PATH
export PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig
export LD_LIBRARY_PATH=$HOME/local/lib:$LD_LIBRARY_PATH

# Generate configure script
sh autogen.sh

# Configure with paths to local libraries
./configure --prefix=$HOME/local CFLAGS="-I$HOME/local/include" LDFLAGS="-L$HOME/local/lib"

# Build and install tmux
make
make install

Add Everything to Your PATH

First set your HOME back to local export HOME=/home/$USER

Update Your ~/.bashrc or ~/.bash_profile

Open your ~/.bashrc (or ~/.bash_profile on some systems) and add the following lines at the end:

# Add local installations to PATH
export PATH="$HOME/local/bin:$PATH"
export LD_LIBRARY_PATH="$HOME/local/lib:$LD_LIBRARY_PATH"

Then, reload your ~/.bashrc or ~/.bash_profile:

# Reload the updated bash configuration
source ~/.bashrc  # or 'source ~/.bash_profile'

Test Installation

# Check that OpenSSL, libevent, and tmux are installed correctly
openssl version
tmux -V

This should print the installed versions of OpenSSL and tmux, showing that the setup is successful. You should now have a working tmux installed in a central location accessable from any of our PNL servers and workstations.

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