Skip to content

Instantly share code, notes, and snippets.

@OndrejValenta
Last active November 14, 2024 15:43
Show Gist options
  • Save OndrejValenta/41c4c60f837ccd56c57ba496177676b3 to your computer and use it in GitHub Desktop.
Save OndrejValenta/41c4c60f837ccd56c57ba496177676b3 to your computer and use it in GitHub Desktop.

Install Zsh and Oh-my-zsh on CentOS 7

Based on this article

ALL INSTALLATIONS ASSUME YES WHEN PROMPTED, that's what -y does

This script can be copy paste to ssh as is. No hands installation. :-)

yum install zsh -y
chsh -s /bin/zsh root
echo $SHELL
yum install wget git -y
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh

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

@alexandrecastello
Copy link

Very good! Works fine

@duzhuoshanwai
Copy link

Collage teacher need us to learn Centos , thank u

@cviniciussn
Copy link

Great! Thanks!

@OndrejValenta
Copy link
Author

Btw. RockyLinux is way to go, guys. I really like it so far. Although, RedHat, mastered by evil corp IBM, tries to do everything possible to kill other variants of RHEL

@xayangjing
Copy link

To fix "zsh: command not found: chsh" on Roky , please install util-linux-user

yum install zsh -y                                                                                     
chsh -s /bin/zsh root
echo $SHELL
Last metadata expiration check: 0:33:35 ago on Mon 28 Aug 2023 01:38:17 PM CST.
Package zsh-5.8-9.el9.aarch64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
zsh: command not found: chsh
/bin/bash
dnf install  util-linux-user                                                                                 1 ↵[97][14:15:13]
Last metadata expiration check: 0:37:06 ago on Mon 28 Aug 2023 01:38:17 PM CST.
Dependencies resolved.
============================================================================================================================================================
 Package                                  Architecture                     Version                                    Repository                       Size
============================================================================================================================================================
Installing:
 util-linux-user                          aarch64                          2.37.4-11.el9_2                            baseos                           29 k

Transaction Summary
============================================================================================================================================================
Install  1 Package

Total download size: 29 k
Installed size: 138 k
Is this ok [y/N]: y
Downloading Packages:
util-linux-user-2.37.4-11.el9_2.aarch64.rpm                                                                                 107 kB/s |  29 kB     00:00
------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                       1.2 kB/s |  29 kB     00:23
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                    1/1
  Installing       : util-linux-user-2.37.4-11.el9_2.aarch64                                                                                            1/1
  Running scriptlet: util-linux-user-2.37.4-11.el9_2.aarch64                                                                                            1/1
  Verifying        : util-linux-user-2.37.4-11.el9_2.aarch64                                                                                            1/1

Installed:
  util-linux-user-2.37.4-11.el9_2.aarch64

chsh -s /bin/zsh root                                                                                     
Changing shell for root.
Shell changed.

@DrjavaB
Copy link

DrjavaB commented Oct 7, 2023

unfortunately encountered this error
in_subnet:18: bad math expression: operand expected at '
in_subnet:9: bad option: -a

@Mohammed-5253
Copy link

If anyone wants ready data for ubuntu, it is here

# Install Zsh
sudo apt-get update
sudo apt-get install zsh -y

# Change the default shell for the root user
sudo chsh -s /bin/zsh root

# Check the default shell for the root user
echo $SHELL

# Install wget and git
sudo apt-get install wget git -y

# Install Oh My Zsh
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

# Copy the Zsh configuration template
/bin/cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

# Source the Zsh configuration
source ~/.zshrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment