CentOS 编译 tmux

今天在 CentOS 6.4 的 VPS 上编译 tmux,发现老是 make 出错,放狗后解决,列出几个注意点:

两个依赖包 ncurses-devellibevent (2.0.10 版本以上):

$ yum install -y ncurses-devel
$ wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
$ tar xzf libevent-2.0.21-stable.tar.gz
$ cd libevent-2.0.21-stable
$ ./configure
$ make && make install

下载 tmux;

$ wget http://downloads.sourceforge.net/tmux/tmux-1.9a.tar.gz
$ tar -xvzf tmux-1.9a.tar.gz
$ cd tmux-1.9a

直接 ./configure 老是编译不过,需要:

$ CFLAGS="-I/usr/local/include" LDFLAGS="-L//usr/local/lib" ./configure
$ make && make install1

编译完运行 tmux 还可能出错:

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

Alan

Frontend Engineer