Motivation
The default shell on the school’s computing cluster is bash, and my commonly used zsh is not available. It feels very uncomfortable without auto-completion and syntax highlighting. Moreover, ordinary accounts do not have administrative privileges and cannot use sudo
to install zsh directly through package management tools. Therefore, it is necessary to compile and install zsh from source.
Install Dependency ncurse
The ncurse library (new curse) is an interface library that supports text-based user interfaces, and zsh depends on this library at runtime. Therefore, it is necessary to install the ncurse library before installing zsh.
Download ncurse version 6.1 (the latest version at the moment)
1
wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz --no-check-certificate
Extract and enter the extracted directory
1 2
tar xvfz ncurses-6.1.tar.gz cd ncurses-6.1
Configure the build
1
./configure --prefix="$HOME/software" CXXFLAGS="-fPIC" CFLAGS="-fPIC"
Here, the installation directory is specified as the
software
folder under the user’s home directory.Compile and install
1
make && make install
Install zsh from Source
Download the latest version of zsh
1
wget -O zsh.tar.xz https://sourceforge.net/projects/zsh/files/latest/download --no-check-certificate
Extract and enter the extracted directory
1 2
tar xvfz -C zsh zsh.tar.xz cd zsh
Configure the build
1
./configure --prefix="$HOME/software" CPPFLAGS="-I$HOME/software/include" LDFLAGS="-L$HOME/software/lib"
Here, the installation directory is specified as the
software
folder under the user’s home directory.Compile and install
1
make && make install
Finally, add the zsh binary folder to the system environment
1
export PATH=$HOME/software/bin:$PATH
You can also add this line to the bash configuration file
.bashrc
.
Install and Configure oh-my-zsh
Please refer to “oh-my-zsh Configuration for Command Line Users”.