首先安装zsh

apt update&&apt ugprade -y
apt install zsh -y

如果能够正常访问github.comgithubusercontent.com,那么使用如下命令即可安装ohmyzsh

$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

如果无法访问github.com,那就建议使用gitee提供的国内镜像来安装,方法如下:

git clone https://gitee.com/mirrors/oh-my-zsh.git
cd oh-my-zsh/tools
vi ./install.sh

找到install.sh中的REMOTE=${REMOTE:-https://github.com/${REPO}.git},将其修改为REMOTE=${REMOTE:-https://gitee.com/mirrors/oh-my-zsh.git},保存即可。

 sed -i 's%https://github.com/${REPO}.git%https://gitee.com/mirrors/oh-my-zsh.git%g' oh-my-zsh/tools/install.sh

执行./install.sh就可以使用国内镜像来正常安装ohmyzsh

➜  ~ neofetch
  `.::///+:/-.        --///+//-:``    bbq@raspi2b
 `+oooooooooooo:   `+oooooooooooo:    -----------
  /oooo++//ooooo:  ooooo+//+ooooo.    OS: Raspbian GNU/Linux 12 (bookworm) armv7l
  `+ooooooo:-:oo-  +o+::/ooooooo:     Host: Raspberry Pi 2 Model B Rev 1.1
   `:oooooooo+``    `.oooooooo+-      Kernel: 6.6.62+rpt-rpi-v7
     `:++ooo/.        :+ooo+/.`       Uptime: 20 mins
        ...`  `.----.` ``..           Packages: 894 (dpkg)
     .::::-``:::::::::.`-:::-`        Shell: zsh 5.9
    -:::-`   .:::::::-`  `-:::-       Terminal: /dev/pts/0
   `::.  `.--.`  `` `.---.``.::`      CPU: BCM2835 (4) @ 900MHz
       .::::::::`  -::::::::` `       Memory: 140MiB / 920MiB
 .::` .:::::::::- `::::::::::``::.
-:::` ::::::::::.  ::::::::::.`:::-
::::  -::::::::.   `-::::::::  ::::
-::-   .-:::-.``....``.-::-.   -::-
 .. ``       .::::::::.     `..`..
   -:::-`   -::::::::::`  .:::::`
   :::::::` -::::::::::` :::::::.
   .:::::::  -::::::::. ::::::::
    `-:::::`   ..--.`   ::::::.
      `...`  `...--..`  `...`
            .::::::::::
             `.-::::-`