非root用户安装Tmux

参考
https://gist.github.com/ryin/3106801

  1. 如果网不好, 连接GitHub下载工具包出现问题时, 可以先下载好, 然后再修改shell脚本
  2. 安装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."
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值