Skip to main content

Installing Oh-My-Zsh on CentOS8

Central, Hong Kong

In order for Oh-My-Zsh to work on the system ,zsh need to be installed.

Install ZSH

sudo yum update && sudo yum -y install zsh

Make it as Default Shell

chsh -s (which zsh) root

If chsh not found

chsh -s /bin/zsh root
-bash: chsh: command not found
yum install util-linux-user

chsh -s /bin/zsh root

Verify

Logout from the root user and login again to verify the shell

[root@CentOS8 ~]# su
[root@CentOS8]~# echo $SHELL
/bin/zsh

Install Oh-My-Zsh Framework

Once Z Shell is installed and confirmed install the Framework from the GIT

yum install wget git
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh

Oh-My-Zsh will be installed in the home directory ~/.oh-my-zsh.Copy the zshrc.zsh-template config file to the home directory .zshrc and apply the config:

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
source ~/.zshrc

Change Oh-My-Zsh Themes

Oh-My-Zsh framework provides large number of themes. You can change the default themes by editing the config file .zshrc which will be under ./oh-my-zsh/themes/

Set ZSH_THEME to the name of the theme in your ~/.zshrc and run su to activate it:

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="agnoster"

...

Install external Themes

see external Themes.

Example: PowerLevel10k

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k

Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc.

su

Manual Update Oh-My-ZSH

rm -rf ~/.oh-my-zsh && git clone https://github.com/ohmyzsh/ohmyzsh.git ~/.oh-my-zsh