centos 源代码安装 tmux
评论百科介绍
tmux是一个优秀的终端复用软件,类似GNU Screen,但来自于OpenBSD,采用BSD授权。使用它直观的好处就是,通过一个终端登录远程主机并运行tmux后,在其中可以开启多个控制台而无需再“浪费”多余的终端来连接这台远程主机;当然其功能远不止于此。
软件下载
- tmux https://github.com/tmux/tmux
- libevent https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
安装流程
- 首先安装 libevent 要求是2.0 以上版本
- 安装 tmux
安装过程
ncurses-devel 需要安装
yum -y install ncurses-devel
libevent 的安装
wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
tar xzvf libevent-2.0.22-stable.tar.gz
cd libevent-2.0.22-stable
./configure
make && make install
tmux 的安装
git clone https://github.com/tmux/tmux.git
cd tmux/
sh autogen.sh
./configure
make && make install
可能出先的问题(1)
/tmux/tty.c:390: undefined reference to `event_initialized'
window.o: In function `window_pane_read_callback':
/tmux/window.c:945: undefined reference to `evbuffer_get_length'
/tmux/window.c:948: undefined reference to `evbuffer_get_length'
/tmux/window.c:956: undefined reference to `evbuffer_get_length'
/tmux/window.c:950: undefined reference to `evbuffer_pullup'
window.o: In function `window_destroy':
/tmux/window.c:356: undefined reference to `event_initialized'
/tmux/window.c:359: undefined reference to `event_initialized'
collect2: ld 返回 1
make: *** [tmux] 错误 1
[root@04 tmux]# cat /etc/redhat-release
CentOS release 6.7 (Final)
解决方法
使用
CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure
# 然后
make && make install
运行的时候可能出先的问题
tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
解决方法
# 64 位
ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5
# 32 位
ln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib/libevent-2.0.so.5
解决和vim配合和问题
echo "TERM=xterm-256color" >> /etc/profile
source /etc/profile