Skip to content

Instantly share code, notes, and snippets.

@anthonyray
Last active May 6, 2024 06:15
Show Gist options
  • Save anthonyray/398fde676a7704c03d6624155ba0011e to your computer and use it in GitHub Desktop.
Save anthonyray/398fde676a7704c03d6624155ba0011e to your computer and use it in GitHub Desktop.
Set up OhMyZsh on Amazon EC2 instance running Ubuntu Server 14.04
  1. Connect to your EC2 instance
  2. Install zsh : sudo apt-get update && sudo apt-get install zsh
  3. Edit your passwd configuration file to tell which shell to use for user ubuntu : sudo vim /etc/passwd
  4. Look for ubuntu user, and replace bin/bash by bin/zsh
  5. Install OhMyZsh : sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"
  6. Disconnect from your instance and reconnect it.
@BrunoGomesCoelho
Copy link

And use "yum" instead of apt-get if running it on their linux OS :)

@raulmarcosl
Copy link

Thanks for this, chsh -s /bin/zsh didn't work and I was looking for an alternative.

@rushi721
Copy link

rushi721 commented Sep 4, 2019

Thanks because the chsh for root didn't work for me too

@bruno-robert
Copy link

bruno-robert commented Oct 15, 2019

Thanks for this, chsh -s /bin/zsh didn't work and I was looking for an alternative.

You can run sudo chsh -s /bin/zsh ubuntu to change the user ubuntu's default shell. Replace 'ubuntu' with your username. You will have to logout and log back in (or change source manually) to see the change take effect

@unfor19
Copy link

unfor19 commented Jan 15, 2020

Combining the original solution with instance user data, you can add the following script to the instance's user-data, and then you'll have zsh installed when the instance is ready.

Very handy when using EC2 Launch Template

#!/bin/bash
sudo apt-get update && sudo apt-get install -y zsh && \
sudo chsh -s /bin/zsh ubuntu && \
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

@sandiprb
Copy link

Thanks, for this.

Added an updated version here: https://gist.github.com/sandiprb/771bcbd100a3ebf53682903a627a40df

@ronakHegde98
Copy link

Thanks for this!

@peterkodermac
Copy link

this works on Oracle VPS too, thanks.

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