Last active
August 3, 2024 10:20
-
-
Save aaabramov/0f1d963d788bf411c0629a6bcf20114d to your computer and use it in GitHub Desktop.
Installing zsh + oh-my-zsh on Amazon EC2 Amazon Linux 2 AMI. (Prepared in the scope of posting https://aaabramov.medium.com/installing-zsh-oh-my-zsh-on-amazon-ec2-amazon-linux-2-ami-88b5fc83109)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum update | |
# Installing ZSH | |
sudo yum -y install zsh | |
# Check ZSH has been installed | |
zsh --version | |
# Install "util-linux-user" because "chsh" is not available by default | |
# See https://superuser.com/a/1389273/599050 | |
sudo yum install util-linux-user | |
# Change default shell for current user, most of the times it would be "ec2-user" | |
# Or use "sudo chsh -s $(which zsh) $(whoami)" to be sure | |
chsh -s "$(which zsh)" | |
# Install oh-my-zsh from https://github.com/ohmyzsh/ohmyzsh#basic-installation | |
# OPTIONAL | |
# I recommend you to install the following plugins which make your life easier and more colorful | |
# Assuming you have git installed | |
# If not, simply do "sudo yum install git -y" | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
# And then add them to "~/.zshrc" file | |
plugins=(git zsh-autosuggestions zsh-syntax-highlighting) |
Ran into an issue with executing chsh
but found a post on setting a password for the default user ec2-user.
sudo passwd ec2-user
After setting the password the script ran without error.
It looks like Amazon Linux 2 AMI installs zsh shell 5.0.2 by default. Is there a channel that can be used to grab a newer zsh install?
@tbenavides - I had a similar issue when a "regular user" was trying to change the shell. I was able to run
sudo usermod --shell $(which zsh) the_user_id
and get it changed for him and we did not have to set a blank password
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Install oh-my-zsh before the optional part from 19 onwards by executing the following command.
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"