美文网首页
非root下安装zsh+oh-my-zsh

非root下安装zsh+oh-my-zsh

作者: SnC_ | 来源:发表于2019-11-11 11:44 被阅读0次

在服务器上,个人没有root权限,无法直接安装应用。
以下是安装zsh与oh-my-zsh的步骤。

Download zsh :

wget -O zsh.tar.xz https://sourceforge.net/projects/zsh/files/latest/download
mkdir zsh && unxz zsh.tar.xz && tar -xvf zsh.tar -C zsh --strip-components 1
cd zsh

Compile zsh

./configure --prefix=$HOME
make
make install

安装oh-my-zsh

curl https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sed -e 's/grep\ \/zsh\$\ \/etc\/shells/which zsh/g' | zsh

想要每次进入shell时使用zsh,可以修改.bashrc (.bash_profile是machine boot up时运行的,不适用于远程登录)
将zsh可执行文件所在的路径加入到 $PATH 环境变量中。

export PATH="$HOME/bin:$PATH"

sleep 1
zsh

至于为什么要加sleep 1,是因为万一.bashrc配置出了问题,你下一次远程登录时脚本出错会立刻退出终端。解决方法就是在.bashrc运行到出错位置之前迅速按下ctrl+c停止。加上 sleep 1,是为了保险,后续可以删去。

参考链接
https://stackoverflow.com/questions/15293406/install-zsh-without-root-access
https://franklingu.github.io/programming/2016/05/24/setup-oh-my-zsh-on-ubuntu-without-sudo/

如果遇到编译问题

遇到如下报错
configure: error: "No terminal handling library was found on your system.
This is probably a library called curses or ncurses. You may need to install a package called 'curses-devel' or 'ncurses-devel' on your system"
参考如下链接
https://unix.stackexchange.com/questions/123597/building-zsh-without-admin-priv-no-terminal-handling-library-found
https://www.drewsilcock.co.uk/compiling-zsh
结合两个链接里的内容,可以成功安装。
第二个链接中的icmake,yodl等一般不需要用到。

相关文章

网友评论

      本文标题:非root下安装zsh+oh-my-zsh

      本文链接:https://www.haomeiwen.com/subject/eextictx.html