Created
August 8, 2024 20:23
-
-
Save realmiketalbot/8143376a26e9e897bbf435a670e87bd7 to your computer and use it in GitHub Desktop.
Install tmux and dependencies from source on a Linux system with no root access
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the installation directory | |
INSTALL_DIR=$HOME/.local | |
# Install libevent from source | |
mkdir -p ~/libevent-src | |
cd ~/libevent-src | |
wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz | |
tar -xvf libevent-2.1.12-stable.tar.gz | |
cd libevent-2.1.12-stable | |
./configure --prefix=$INSTALL_DIR --disable-openssl | |
make | |
make install | |
# Install ncurses from source | |
mkdir -p ~/ncurses-src | |
cd ~/ncurses-src | |
wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.2.tar.gz | |
tar -xvf ncurses-6.2.tar.gz | |
cd ncurses-6.2 | |
./configure --prefix=$INSTALL_DIR | |
make | |
make install | |
# Set environment variables for the libevent and ncurses installations | |
export CFLAGS="-I$INSTALL_DIR/include -I$INSTALL_DIR/include/ncurses" | |
export LDFLAGS="-L$INSTALL_DIR/lib" | |
export LD_LIBRARY_PATH=$INSTALL_DIR/lib:$LD_LIBRARY_PATH | |
export PKG_CONFIG_PATH=$INSTALL_DIR/lib/pkgconfig:$PKG_CONFIG_PATH | |
export TERMINFO=$INSTALL_DIR/share/terminfo | |
# Install tmux from source | |
mkdir -p ~/tmux-src | |
cd ~/tmux-src | |
wget https://github.com/tmux/tmux/releases/download/3.2a/tmux-3.2a.tar.gz | |
tar -xvf tmux-3.2a.tar.gz | |
cd tmux-3.2a | |
./configure --prefix=$INSTALL_DIR CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" | |
make | |
make install | |
# Add tmux to PATH | |
if ! grep -q "$INSTALL_DIR/bin" ~/.bashrc; then | |
echo "export PATH=$INSTALL_DIR/bin:\$PATH" >> ~/.bashrc | |
source ~/.bashrc | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment