我用的是腾讯云服务器,安装的 Centos 7 系统,下面是安装的教程和遇到的问题解决办法:

一、安装步骤:

  1. 安装 zsh

  2. 安装 git

  3. 下载oh-my-zsh的安装脚本

  • 安装 wget(centos7 默认是没有的)
  1. 下载 zsh 安装脚本
  • 我这里因为用 github 源无法下载,一直卡在 clone into “xxx”,所以改换了国内的镜像源

gitee 源 wget https://gitee.com/mirrors/oh-my-zsh/raw/master/tools/install.sh

  1. 编辑 install.sh

找到以下部分

Default settings
ZSH\=](https://g.yuque.com/gr/latex?%7BZSH%3A-~%2F.oh-my-zsh%7D%0AREPO%5C%5C%3D#card=math&code=%7BZSH%3A-~%2F.oh-my-zsh%7D%0AREPO%5C%5C%3D&height=36&width=724){REPO:-ohmyzsh/ohmyzsh}<br />REMOTE\={REPO}.git}{BRANCH:-master}

把

REPO=Centos7 安装oh my zsh - Silentims - 博客园 - 图3{REMOTE:-[https://github.com/{REPO}.git})

替换为

REPO=Centos7 安装oh my zsh - Silentims - 博客园 - 图4{REMOTE:-[https://gitee.com/{REPO}.git})

  1. 编辑后保存, 运行安装即可. (运行前先给 install.sh 权限)

赋予可执行权限
chomd +x install.sh # 运行 sh install.sh

  1. 修改仓库地址

cd ~/.oh-my-zsh
git remote set-url origin https://gitee.com/mirrors/oh-my-zsh.git
git pull

二、切换为 zsh

  1. 输入cat /etc/shells命令来查看本地安装的 shell

/bin/sh
/bin/bash /usr/bin/sh
/usr/bin/bash /bin/tcsh /bin/csh /bin/zsh

  1. 切换 sehll 至 zsh
  2. 查看当前使用的 shell

三、oh-my-zsh 插件设置

  1. 编辑主题和插件
  • 修改主题:找到下面设置主题的部分,修改引号中的名称即可(比如我这里用的 ys 主题)
  • 修改插件:找到插件的部分,直接修改,常用的插件可以自行参考网上其他文章

Centos7 安装oh my zsh - Silentims - 博客园 - 图5

plugins=(git
sublime
z
web-search
wd
zsh-autosuggestions
extract
zsh-syntax-highlighting)

Centos7 安装oh my zsh - Silentims - 博客园 - 图6

  1. 刷新配置文件
  • 在刷新配置的过程中,提示 zsh-autosuggestions、zsh-syntax-highlighting 插件 not found,可通过单独下载解决(下载后再次刷新配置文件):

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting
https://www.cnblogs.com/silentims/p/13740267.html