installing Zsh by source code without root super user privilege

In many cases, we may not be able to obtain the root super user rights of the machine. In order to use Zsh, we can compile, install and configure the source code independently. We can only use it under our own account, and it will not affect other users.


1. download and install ncurses

Zsh relies on ncurses when compiling. If there is no such dependency on the machine, it needs to be compiled and installed.

download ncurses source code:

wget http://ftp.gnu.org/gnu/ncurses/ncurses-6.2.tar.gz
tar zxvf ncurses-6.2.tar.gz
cd ncurses-6.2

set environment variables:

export CXXFLAGS=" -fPIC"
export CFLAGS=" -fPIC"

Compile and install ncurses:

./configure --prefix=$HOME/.ncurses --enable-shared
make
make install

Ncurses has been installed under .ncurses in the home directory.

2. download and install zsh

download zsh source code:

wget http://sourceforge.net/projects/zsh/files/zsh/5.0.7/zsh-5.0.7.tar.gz/download

set environment variables:

export INSTALLATION_PATH='$HOME/.ncurses'
export PATH=$INSTALLATION_PATH/bin/:$PATH
export LD_LIBRARY_PATH=$INSTALLATION_PATH/lib:$LD_LIBRARY_PATH
export CFLAGS=-I$INSTALLATION_PATH/include
export CPPFLAGS="-I$INSTALLATION_PATH/include" LDFLAGS="-L$INSTALLATION_PATH/lib"

compile and install zsh:

./configure --prefix=$HOME/.zsh --enable-shared
make
make install

Zsh will be installed under .zsh in the home directory.

3. set zsh to start by default

add the following code to .bashrc

exec $HOME/.zsh/bin/zsh

refresh .bashrc

source $HOME/.bashrc

zsh finish setting,enjoy yourself~

it can also be further installed oh-my-zsh

curl and wget, choose one
curl installation

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

wget installation

sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

原创文章,作者:ifee,如若转载,请注明出处:https://www.ifee.win/blog/2021/05/16/installing-zsh-by-source-code-without-root-super-user-privilege/

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注