安装zsh

# 查看当前使用的shell
echo $SHELL 
# 查看shell列表确认是否安装zsh 或 直接执行 `zsh --version` 
cat /etc/shells 

# 安装zsh
yum -y install zsh
# 查看shell列表
cat /etc/shells
# 切换shell为zsh
chsh -s /bin/zsh

安装ohmyzsh

# 安装 git
yum install -y git
# 安装 oh-my-zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh

下载插件

# 下载 历史命令记录插件
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH/plugins/zsh-autosuggestions

# 下载 命令行高亮显示插件
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $ZSH/plugins/zsh-syntax-highlighting

添加主题

vim ~/.oh-my-zsh/themes/ybd.zsh-theme

把下面内容写入文件

# 根据tjkirch.zsh-theme这个主题改的 , 微调样式
# 
# ----------------------
# 访问ip 用户 主机名 git
# 当前路径			时间
# ----------------------

ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[green]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_CLEAN=""

function prompt_char {
	if [ $UID -eq 0 ]; then echo %{$fg_bold[cyan]%}%~ %{$reset_color%}; else echo $; fi
}

line=`who`

function print_ip {
	echo $line | awk 'NR==1{print $5}' | sed 's/[()]//g';
}

PROMPT='%{$fg[green]%}$(print_ip) %{$fg[magenta]%}%n%{$reset_color%}%{$fg[blue]%} %{$fg[yellow]%}%m%{$reset_color%}$(git_prompt_info)
$(prompt_char)'

RPROMPT='%{$fg[green]%}%D{%Y-%m-%d %H:%M:%S}%{$reset_color%}'

修改配置

# 修改配置
vim ~/.zshrc

# 加上插件
plugins=(git zsh-autosuggestions z cp docker docker-compose zsh-syntax-highlighting kubectl)

# 自动更新
zstyle ':omz:update' mode auto

# 自动更新时间
zstyle ':omz:update' frequency 1

# 更改主题
ZSH_THEME="ybd"

# 加载配置
omz reload