首先執行 yum
命令來安裝須要的 zsh
原始程序與 git
程序來 pull
代碼。git
yum install -y zsh git
安裝 oh my zsh
腳本 (這一步須要安裝 git
)。github
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
使用 which zsh
查看 zsh
的安裝目錄,通常都存儲在 /usr/bin/zsh
目錄下。shell
which zsh
使用 chsh
命令切換使用的 shell 程序。工具
chsh -s /usr/bin/zsh
執行如下命令在當前目錄拉取圖標的倉庫,並切換到其目錄下,執行 ./install.sh
腳本便可安裝成功。字體
git clone https://github.com/powerline/fonts.git
使用 vi
工具編輯 /root/.zshrc
文件,更改 ZSH_THEME="robbyussell"
字段爲 ZSH_THEME="agnoster"
字段,並經過 source ~/.zshrc
命令更新它們的配置文件。插件
使用 ZSH 替換原有的 SHELL 最主要的緣由就是要使用其功能強大的插件,這裏只推薦安裝三個插件,它們分別是 wd
、zsh-syntax-highlighting
、zsh-autosuggestions
。code
首先依次執行下列的命令,將後面兩個插件的倉庫克隆到 Oh My Zsh 的插件目錄下。blog
cd ~/.oh-my-zsh/custom/plugins git clone https://github.com/zsh-users/zsh-syntax-highlighting.git git clone https://github.com/zsh-users/zsh-autosuggestions.git
完成克隆操做以後,那麼兩個插件的全路徑分別是:get
/root/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-syntax-highlighting.zsh
/root/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
繼續使用 vi
編輯 ~/.zshrc
文件。it
# 其餘內容 plugins=( git wd zsh-syntax-highlighting zsh-autosuggestions ) source /root/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh source /root/.oh-my-zsh/custom/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh source $ZSH/oh-my-zsh.sh # 其餘內容
編輯完成以後,執行 source ~/.zshrc
命令更新 ZSH 配置,最後的效果以下圖。