-
-
Save cynipe/187e8d509d57f198f5c2a9adc53edb73 to your computer and use it in GitHub Desktop.
A shell script to install tmux-2.5 and its dependencies from tarball (Only for CentOS, Ubuntu and Amazon Linux)
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 | |
# Install tmux from source | |
# Jul 12th, 2016 / [email protected] | |
# Sep 29th, 2016 / cynipe : Added Amazon Linux support and some fixes | |
set -ex | |
[ -f /etc/os-release ] && . /etc/os-release || { echo "Could not find /etc/os-release"; exit 1; } | |
TMUX_VERSION="2.5" | |
LIBEVENT_VERSION="2.0.22-stable" | |
NCURSES_VERSION="${NCURSES_VERSION}" | |
TMUX_URL="https://github.com/tmux/tmux/releases/download/${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz" | |
LIBEVENT_URL="https://github.com/libevent/libevent/releases/download/release-${LIBEVENT_VERSION}/libevent-${LIBEVENT_VERSION}.tar.gz" | |
NCURSES_URL="ftp://ftp.gnu.org/gnu/ncurses/ncurses-${NCURSES_VERSION}.tar.gz" | |
WORKDIR="/tmp" | |
BUILD_DIR="${WORKDIR}/tmux_build_$(date +%y%m%d_%H%M%S)" | |
PKGCONFIG_DIR="${BUILD_DIR}/lib/pkgconfig" | |
TARGET_DIR="/usr/local/tmux-${TMUX_VERSION}" | |
TERMINFO_DIR_PATH="/usr/share/terminfo" | |
TERMINFO_DIRS_PATH="/etc/terminfo:/lib/terminfo:/usr/share/terminfo" | |
cd ${WORKDIR} | |
echo "Installing tmux for ${NAME}..." | |
if [ "${NAME}" = "Ubuntu" ]; then | |
sudo apt-get -y install build-essential autoconf libtool pkg-config | |
curl -sSL ${TMUX_URL} | tar xvz | |
cd tmux-${TMUX_VERSION} | |
./configure --prefix=${TARGET_DIR} && make && sudo make install | |
cd .. | |
rm -rf tmux-${TMUX_VERSION} | |
elif [ "${NAME}" = "Amazon Linux AMI" ]; then | |
sudo yum -y install glibc-static automake autoconf pkgconfig libevent-devel ncurses-devel | |
curl -sSL ${TMUX_URL} | tar xvz | |
cd tmux-${TMUX_VERSION} | |
./configure --prefix=${TARGET_DIR} && make && sudo make install | |
cd .. | |
rm -rf tmux-${TMUX_VERSION}* | |
elif [ "${NAME}" = "CentOS Linux" ] || [ "${NAME}" = "Amazon Linux AMI" ]; then | |
sudo yum -y install glibc-static automake autoconf pkgconfig | |
mkdir ${BUILD_DIR} | |
echo "########################" | |
echo "BUILDING LIBEVENT..." | |
echo "########################" | |
curl -sSL ${LIBEVENT_URL} | tar xvz | |
cd libevent-${LIBEVENT_VERSION} | |
./configure --prefix=${BUILD_DIR} && make && make install | |
cd .. | |
rm -rf libevent-${LIBEVENT_VERSION}* | |
echo "########################" | |
echo "BUILDING NCURSES..." | |
echo "########################" | |
curl -sSL ${NCURSES_URL} | tar xvz | |
cd ncurses-${NCURSES_VERSION} | |
./configure --prefix=${BUILD_DIR} --enable-pc-files --with-pkg-config-libdir=${PKGCONFIG_DIR} --with-default-terminfo-dir=${TERMINFO_DIR_PATH} --with-terminfo-dirs=${TERMINFO_DIRS_PATH} && make && make install | |
cd .. | |
rm -rf ncurses-${NCURSES_VERSION}* | |
echo "########################" | |
echo "BUILDING TMUX..." | |
echo "########################" | |
curl -sSL ${TMUX_URL} | tar xvz | |
cd tmux-${TMUX_VERSION} | |
PKG_CONFIG_PATH=${PKGCONFIG_DIR} ./configure --enable-static --prefix=${TARGET_DIR} && make && sudo make install | |
cd .. | |
rm -rf tmux-${TMUX_VERSION}* | |
else | |
echo "Your OS is neither Ubuntu or CentOS" | |
exit 1 | |
fi | |
sudo ln -sf $TARGET_DIR/bin/tmux /usr/local/bin/tmux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment