安装zsh

# 安装zsh
yum -y install zsh

# 更改当前用户的默认shell
chsh -s /bin/zsh

# 重启主机,root用户可以不用重启
reboot

# 查看当前正在使用的shell
echo $SHELL

# 查看当前有哪些shell包
cat /etc/shells

安装oh my zsh

# 任选一种安装方式即可
# 01手动安装
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# 复制.zshrc配置文件
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

# 02使用curl自动安装
curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh

# 03使用wget自动安装
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

常用插件

安装语法高亮插件
# 安装语法高亮插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
安装自动补全插件zsh-autosuggestions
# 克隆插件到oh-my-zsh自定义插件目录
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

启用插件

vim ~/.zshrc
# 找到plugins=(git)这一行,找"plugins"关键字
# 编辑这一行代码,添加zsh-syntax-highlighting
# 如启用多个插件,请以空格隔开
plugins=(zsh-syntax-highlighting zsh-autosuggestions)
# 更新资源
source ~/.zshrc