無root條件安裝zsh和oh-my-

zsh是一大終端利器, 什麼?你還不知道?
不僅是樣式而且在自動補全等等功能完爆bash,誰用誰知道! zsh
如何在一個沒有root環境的賬戶下配置呢? 這時候就要我們自己編譯zsh了
參考:

  1. 安裝zsh

首先從sourceforge下載zsh

wget -O zsh.tar.gz https://sourceforge.net/projects/zsh/files/latest/download
mkdir zsh && tar -xvf zsh.tar.gz -C zsh --strip-components 1
cd zsh
# 配置,比如將Zsh安裝到~下
./configure --prefix=$HOME
make
make install

網上給的解壓的部分多爲tar -xvzf zsh.tar.gz但實際上我用的時候提示文件並沒有被壓縮, 所以我去掉了z

我這裏將它直接安裝到了~文件夾下, 安裝過後home文件夾出現了sharebin文件夾,然後運行zsh有反應, 說明安裝成功了
還是推薦安裝到$HOME/usr目錄下

  1. 安裝oh-my-zsh

克隆oh-my-zsh到本地, 手動執行

wget --no-check-certificate https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
bash install.sh
  1. 出現問題
    並沒有出現網上所說的, 安裝完oh-my-zsh出現相關字樣. 反倒是在運行zsh的時候, 出現:
/public/liangy/.oh-my-zsh/lib/theme-and-appearance.zsh:2: colors: function definition file not found
/public/liangy/.oh-my-zsh/oh-my-zsh.sh:76: compinit: function definition file not found
/public/liangy/.oh-my-zsh/plugins/git/git.plugin.zsh:83: command not found: compdef
/public/liangy/.oh-my-zsh/plugins/git/git.plugin.zsh:98: command not found: compdef
...

problem
這是因爲oh-my-zsh沒有找到我們的zsh,所以我們需要手動指定

  1. 修改oh-my-zsh配置

參考githubissuehttps://github.com/robbyrussell/oh-my-zsh/issues/4607
Add export FPATH=$HOME/usr/share/zsh/'version of zsh'/functions:$FPATH in your .zshrc

這裏, 我們只需要稍作修改
export FPATH=$HOME/share/zsh/'version of zsh'/functions:$FPATH
因爲我們的zsh源碼位於~/share/zsh裏, 所以這一步與其他不同

配置成功
zsh success

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章