(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