centos下安裝 配置zsh 相關問題解決

2021-10-01 10:32:50 字數 3868 閱讀 7782

【先安裝zsh,再安裝oh-my-zsh】

使用wget安裝

上述方法在ubuntu、mac中使用沒有問題,非常順暢,但在centos中遇到了下面這些問題,記錄一下。

os版本:centos linux release 7.6.1810 (core)

kernel版本:3.10.0-957.el7.x86_64

該錯誤類似下面這種情況

/home/marcel/.oh-my-zsh/oh-my-zsh.sh:78: compinit: function definition file not found

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:80: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:93: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:100: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:109: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:119: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:129: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:138: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:144: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:147: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:150: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:153: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:163: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:166: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:168: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:182: command not found: compdef

/home/marcel/.oh-my-zsh/plugins/git/git.plugin.zsh:193: command not found: compdef

$spaceship_prompt_trunc is deprecated. use $spaceship_dir_trunc instead.

spaceship_setup:3: add-zsh-hook: function definition file not found

spaceship_setup:4: add-zsh-hook: function definition file not found

$spaceship_prompt_trunc is deprecated. use $spaceship_dir_trunc instead.

spaceship_setup:3: add-zsh-hook: function definition file not found

spaceship_setup:4: add-zsh-hook: function definition file not found

嘗試網上給出的方法:

rm ~/.zcompdump* ,在~路徑下沒有發現.zcompdump檔案

重灌 oh-my-zsh

經過上面的嘗試都不生效,後來找到了另乙個方法,新增$fpath~/.zshrc配置檔案中即可解決該問題。具體為, 在**~/.zshrc**配置檔案新增如下語句:

export fpath=/usr/share/zsh/5.0.2/functions/:$fpath
上述的/usr/share/zsh/5.0.2/中的5.0.2是zsh版本,可以通過zsh --version$shell --version命令檢視zsh版本資訊。

設定完成後,通過source ~/.zshrc命令即可生效。但自己在執行source ~/.zshrc命令時有發生了下面的錯誤。

經過3.1 的修改後,執行source ~/.zshrc命令時有發生了下面的錯誤:

-->

source ~/.zshrc

-bash: autoload: command not found

-bash: /users/suy/.oh-my-zsh/oh-my-zsh.sh: line 41: syntax error near unexpected token `

('-bash: /users/suy/.oh-my-zsh/oh-my-zsh.sh: line 41: `

for plugin(

$plugins

); do'

可以通過依次執行下面的命令解決該問題:

zsh

chsh -s $(

which zsh)

參考【github】

執行上述chsh -s $(which zsh)命令可能會有chsh says 「invalid shell」類似的提示,解決方法見3.3

執行chsh -s $(which zsh)命令可能會有chsh says 「invalid shell」類似的提示,解決方法:

add zsh to /etc/shells:

command -v zsh |

sudo

tee -a /etc/shells

you can now use chsh to set zsh as shell:

sudo chsh -s "$(

command -v zsh)

""$"

參考【stackexchange】

通過在終端中即將入如下命令即可:

upgrade_oh_my_zsh
可參考 【stackoverflow - issue】

Centos下安裝配置tengine

tengine是由 網發起的web伺服器專案。它在nginx的基礎上,針對大訪問量 的需求,新增了很多高階功能和特性。tengine的效能和穩定性已經在大型的 如 網,天貓 等得到了很好的檢驗。它的最終目標是打造乙個高效 穩定 安全 易用的web平台。下面介紹在centos下安裝配置tengine的...

Centos 下安裝配置 MySQL

這裡介紹使用yum的方式安裝mysql,這是centos一種快速安裝的方式,對應的ubantu工具是apt get,基本用法是一樣的 1 檢查是否已經存在mysql rpm qa mysqld 2 安裝mysql yum y install mysql mysql server mysql deve...

centos下redis安裝配置

直接用yum安裝即可 yum install redisredis server直接啟動即可。直接啟動時是用的預設配置,而為了外網能夠連線並且安全起見,需要我們自己配置redis。linux下的redis.conf在 etc redis.conf requirepass 密碼 修改授權的ip 預設的...