(1)clone 源代码仓库:php
$ git clone https://github.com/tmux/tmux.git
(2) 编译以前先安装libevent,去官网下载tar包:
http://libevent.orggit
选择须要下载的版本复制连接地址,使用wget下载到本地(图形化的也能够直接下载),如(选择合适的版本,通常选stable便可):github
wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz
tar -xzf libevent-2.0.22-stable.tar.gz cd libevent-2.0.22-stable/ $ ./configure && make $ sudo make install
(3) 编译tmux:shell
cd tmux/ sh autogen.sh ./configure && make
安装编译过程可能会提示一些错误:
1)aclocal command not found
缘由:自动编译工具未安装,安装上便可:ubuntu
centOS: yum install automake
ubuntu:apt-get install libncurses5-dev centos: yum install ncurses-devel
(4) 编译成功以后会在tmux下生成一个可执行程序:tmuxcentos
./tmux
执行的时候可能会出现找不到库的状况:ruby
./tmux: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory
把安装好的libevent库的路径使用软连接到对应的目录:bash
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
(5)设置环境变量app
export PATH=xxx工具
(6)经常使用的tmux配置:
[root@c936a812-4ccb-491f-8eee-1dd4f670494b ~]# cat .tmux.conf set -g prefix C-x unbind C-b setw -g mode-keys vi #容许用鼠标切换窗口/调节分屏大小 setw -g mouse-resize-pane on setw -g mouse-select-pane on setw -g mouse-select-window on setw -g mode-mouse on set-option -g history-limit 5000 bind -t vi-copy 'v' begin-selection # Begin selection in copy mode. bind -t vi-copy 'C-v' rectangle-toggle # Begin selection in copy mode. bind -t vi-copy 'y' copy-selection # Yank selection in copy mode. bind Left swap-window -t -1 bind Right swap-window -t +1 bind '"' split-window -c "#{pane_current_path}" bind % split-window -h -c "#{pane_current_path}" bind c new-window -c "#{pane_current_path}" bind k selectp -U bind j selectp -D bind h selectp -L bind l selectp -R bind ^k resizep -U 10 bind ^j resizep -D 10 bind ^h resizep -L 10 bind ^l resizep -R 10 bind ^u swapp -U bind ^d swapp -D bind ^a last bind ^q killp set-window-option -g window-status-current-bg yellow set-window-option -g window-status-current-fg black # Plugins set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-yank' set -g @plugin 'tmux-plugins/tmux-copycat' set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-continuum' # Plugin configure set -g @continuum-restore 'on' run '~/.tmux/plugins/tpm/tpm' You have new mail in /var/spool/mail/root
其中须要用到插件管理,须要先安装插件管理器:
$ git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm