As the default Zsh on CentOS is usually an older version, many cool things are not possible on this version of Zsh, like installing oh-my-zsh or using awesome powerlevel10k prompt system, it’s understandable if you’d like to have the latest Zsh on your system. Easy peasy !!

Note: Please remember to remove the sudo from the commands if you are already in “root” or sudo-er mode

We’ll be following these steps:

Install the pre-requisites

We need GCC (C++ compiler) and other related stuffs for building Zsh from the source code.

$ sudo yum groupinstall "Development tools"  
$ sudo yum install ncurses-devel

Now, check if GCC is installed properly, by

$ gcc -v

Download the latest source

Now, we gonna get the latest code of Zsh.
Please update the link (in the shown command) with the latest by checking this web-folder.
Don’t forget to update the filename as well, if needed.

$ cd /usr/local/src
$ sudo curl -L https://www.zsh.org/pub/zsh-5.8.tar.xz \
-o zsh-5.8.tar.xz

Build & Install

Unzip the file, “dig in” to the folder, and build & install from the source.

$ sudo tar -xf zsh-5.8.tar.xz  # the actual version of the downloaded file might be different
$ cd zsh-5.8
$ sudo ./configure && sudo make && sudo make install

Final steps

Add Zsh to the login shells by adding ‘/usr/local/bin/zsh’ on the last line of the config file, /etc/shells

$ sudo -e /etc/shells
$ sudo chsh $USER

Update the system’s default symlink to the new Zsh version.

$ sudo ln -sf /usr/local/bin/zsh /bin/zsh
$ zsh --version

It’s always a good habit to clean up after doing stuffs. ;)

$ sudo make clean

That’s it !

voila

Related

Want to have a super, cool-looking command shell? Gotcha, fam. Check out my blog on Pimping up My Linux Terminal.


If you find this post helpful, you can show your support through Patreon or Paypal or by buying me a coffee. Thanks!