非root权限安装tmux

原因

使用 tmux 确实可以不用再担心因为自己电脑的宕机导致实验没跑完… (但不排除服务器的问题)。
费话不多少,tmux 具体使用主要参考阮一峰的博客

安装方法

需要根据自己的路径进行一些调整,比如说版本号,安装路径,差不多理一下脚本就能改写的。有什么问题欢迎留言~

#!/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.9a # 这里需要看下载什么版本的
INSTALL_DIR=/data1/zcl # 这里需要更改路径

# create our directories
mkdir -p $INSTALL_DIR/local 
#mkdir $INSTALL_DIR/tmux_tmp
#cd $INSTALL_DIR/tmux_tmp

# download source files for tmux, libevent, and ncurses
# 这三个wget被我注释了因为我提前下载,直接wget的话很慢
#wget -O tmux-${TMUX_VERSION}.tar.gz http://sourceforge.net/projects/tmux/files/tmux/tmux-${TMUX_VERSION}/tmux-${TMUX_VERSION}.tar.gz/download
#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.1.11-stable.tar.gz
cd libevent-2.1.11-stable
./configure --prefix=$INSTALL_DIR/local --disable-shared
make
make install
cd ..

############
# ncurses  #
############
tar xvzf ncurses-6.1.tar.gz
cd ncurses-6.1
./configure --prefix=$INSTALL_DIR/local
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."


  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值