Installing Zsh 5.9 from Source on CentOS 7 and 8

zsh 5.9 manual install on CentOS

* This page contains promotional content

The zsh on CentOS7/8 is old, so I installed the latest version at this point, 5.9, by hand

Preparation

Since we use commands such as wget and make, install the developer tools first

$ export LANG=C
$ sudo yum groupinstall "Development Tools"
$ sudo yum install ncurses-devel

Downloading and installing

/usr/bin/zsh and /bin/zsh already exist, so install into /usr/local

$ wget https://jaist.dl.sourceforge.net/project/zsh/zsh/5.9/zsh-5.9.tar.xz
$ tar xf zsh-5.9.tar.xz
$ cd zsh-5.9
$ ./configure --prefix=/usr/local --enable-multibyte
$ make
$ sudo make install

Append it to /etc/shells

# echo /usr/local/bin/zsh >> /etc/shells

After that, switch to /usr/local/bin/zsh with the chsh command

Incidentally, for LDAP users a little bit of fixing is needed
Overriding the LDAP shell with a different shell

PATH

If you want programs inside /usr/local/bin to be used with priority across the whole system, change the PATH inside /etc/init.d/functions

-PATH="/sbin:/usr/sbin:/bin:/usr/bin"
+PATH="/usr/local/bin:/sbin:/usr/sbin:/bin:/usr/bin"
 export PATH

See also