Skip to content

Instantly share code, notes, and snippets.

@bxshi
Forked from smsharma/ tmux_local_install.sh
Last active December 3, 2021 15:17
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save bxshi/76a29560d35942558375778abe07fc74 to your computer and use it in GitHub Desktop.
Save bxshi/76a29560d35942558375778abe07fc74 to your computer and use it in GitHub Desktop.
Install tmux locally without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $INSTALL_DIR/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.3
INSTALL_DIR=/group/hepheno/smsharma
# create our directories
mkdir -p $INSTALL_DIR/local $INSTALL_DIR/tmux_tmp
cd $INSTALL_DIR/tmux_tmp
# download source files for tmux, libevent, and ncurses
wget -O tmux-${TMUX_VERSION}.tar.gz https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz
wget https://github.com/downloads/libevent/libevent/libevent-2.0.19-stable.tar.gz
wget ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz
# extract files, configure, and compile
############
# libevent #
############
tar xvzf libevent-2.0.19-stable.tar.gz
cd libevent-2.0.19-stable
./configure --prefix=$INSTALL_DIR/local --disable-shared
make
make install
cd ..
############
# ncurses #
############
if [[ $(fs --version) =~ "afs" ]] && fs whereis "$HOME/local" ; then
NCURSES_OPTION=" --enable-symlinks"
else
NCURSES_OPTION=""
fi
tar xvzf ncurses-5.9.tar.gz
cd ncurses-5.9
./configure --prefix=$INSTALL_DIR/local $NCURSES_OPTION
make
make install
cd ..
############
# tmux #
############
tar xvzf tmux-${TMUX_VERSION}.tar.gz
cd tmux-${TMUX_VERSION}
./configure CFLAGS="-I$INSTALL_DIR/local/include -I$INSTALL_DIR/local/include/ncurses" LDFLAGS="-L$INSTALL_DIR/local/lib -L$INSTALL_DIR/local/include/ncurses -L$INSTALL_DIR/local/include"
CPPFLAGS="-I$INSTALL_DIR/local/include -I$INSTALL_DIR/local/include/ncurses" LDFLAGS="-static -L$INSTALL_DIR/local/include -L$INSTALL_DIR/local/include/ncurses -L$INSTALL_DIR/local/lib" make
cp tmux $INSTALL_DIR/local/bin
cd ..
# cleanup
rm -rf $INSTALL_DIR/tmux_tmp
echo "$INSTALL_DIR/local/bin/tmux is now available. You can optionally add $HOME/local/bin to your PATH."
@bxshi
Copy link
Author

bxshi commented Apr 19, 2017

The script is updated and now downloads tmux from GitHub.
Also added AFS support so if you happened to use Notre Dame's CRC server, then this could give you tmux without root access.

@bxshi
Copy link
Author

bxshi commented Apr 20, 2017

For people who are using this under AFS, if you detach tmux and then login again, you may have permission denied at your home directory. To solve this problem, you need to run kinit&aklog to refresh the AFS ticket.

Reference: http://stackoverflow.com/questions/23571012/how-to-provide-an-already-running-process-with-kerberos-and-afs-ticket

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