参考
https://gist.github.com/ryin/3106801
- 如果网不好, 连接GitHub下载工具包出现问题时, 可以先下载好, 然后再修改shell脚本
- 安装libevent时会遇到一个关于"openssl"的错误, 修改shell脚本中的
./configure --prefix=$HOME/local --disable-shared #(原脚本中的第28行)
为
./configure --prefix=$HOME/local --disable-shared --disable-openssl
即可
下面是我自己用的安装脚本:
#!/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
# 下面是libevent, ncurses, tmux 要安装的版本
LIBEVENT_VERSION = 2.1.12
NCURSES_VERSION
TMUX_VERSION=3.2
INSTALL_DIR=$HOME/program
# 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-3.2.tar.gz https://github.com/tmux/tmux/releases/download/3.2/tmux-3.2.tar.gz
# wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
# wget https://mirrors.sjtug.sjtu.edu.cn/gnu/ncurses/ncurses-6.1.tar.gz
# extract files, configure, and compile
############
# libevent #
############
tar xvzf libevent-${LIBEVENT_VERSION}-stable.tar.gz
cd libevent-${LIBEVENT_VERSION}-stable
./configure --prefix=$INSTALL_DIR/local --disable-shared --disable-openssl
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-${NCURSES_VERSION}.tar.gz
cd ncurses-${NCURSES_VERSION}
./configure --prefix=$INSTALL_DIR/local $NCURSES_OPTION
make
make install
cd ..
############
# tmux #
############
tar xvzf tmux-${TMUX_VERSION}.tar.gz
cd tmux-${TMUX_VERSION}
./configure --prefix 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"
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."