-
-
Save bxshi/76a29560d35942558375778abe07fc74 to your computer and use it in GitHub Desktop.
Install tmux locally without 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 | |
# 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." |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.