Skip to content

Instantly share code, notes, and snippets.

@jshcrowthe
Last active December 8, 2022 18:38
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save jshcrowthe/f0779322ecf9a26cac30 to your computer and use it in GitHub Desktop.
Save jshcrowthe/f0779322ecf9a26cac30 to your computer and use it in GitHub Desktop.
Installing Oh My ZSH oh Fedora (2015 CIT 325 Image)

Installing oh-my-zsh on Fedora (for DB class images)

Oh-my-zsh is an extension of the traditional z shell that is extensible via community created plugins (Plugins found here: oh-my-zsh github repo). It is, in my opinion, a breath of fresh air in comparison to the traditional bash shell.

DO THE FOLLOWING IN ORDER

Installing ZSH (using yum)

The first step for this install is getting zsh we will do this via yum. From your terminal:

sudo yum install zsh

Follow the install (there may be some prompts that you have to go through asking about using different mirrors, typically you can y through these.

Install oh-my-zsh (using wget)

After installing zsh execute the following command:

wget --no-check-certificate http://install.ohmyz.sh -O - | sh

This will fetch oh-my-zsh for you and create a .zshrc file based on the oh-my-zsh config template.

NOTE: This will automagically add the PATH vars from the existing .bashrc and .bash_profile files to your config (YAY!)

Changing your shell

Typically on an OS X install of oh-my-zsh the shell will be changed automatically. However this step will fail on THIS fedora image (I don't know if it's on all of them). So after installing oh-my-zsh you will need to run the following command:

sudo chsh -s /usr/bin/zsh

This will set your default shell to ZSH.

NOTE: You will need to log out and log back in to see this change, just rebooting your terminal will not do

Updating your .zshrc

Bro. McLaughlin has given us some some terminal niceties that we want so we are going to go get those.

The following command will open up the .zshrc file for you. This file will have a lot of oh-my-zsh specific things in it (I'll give a potential set up for you) for now don't worry about those.

gedit ~/.zshrc

Then copy and paste the following block at the BOTTOM of the file:

# Set the JAVA_HOME path.
export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75-2.5.4.2.fc20.x86_64
 
# Set the CLASSPATH path.
export CLASSPATH=/usr/share/java/mysql-connector-java.jar:.
 
# User specific aliases and functions
. /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
 
# Wrap sqlplus with rlwrap to edit prior lines with the
# up, down, left and right keys.
sqlplus()
{
  if [ "$RLWRAP" = "0" ]; then
    sqlplus "$@"
  else
    rlwrap sqlplus "$@"
  fi
}
 
# Set the bindkey.
bindkey -v
bindkey "^R" history-incremental-search-backward
export EDITOR="vim"
 
# history stuff
HISTFILE=~/.zsh-histfile
HISTSIZE=2000

# Set vi as a command line editor.
set -o vi

Reboot your terminal (not your machine) and you should be good to go!

Configuring oh-my-zsh

I have a very specific configuration that I like for my terminal in terms of look so I figured that I would post that here as well.

Theme

By default the oh-my-zsh theme is set to robbyrussell. I personally don't like this I prefer a modified version of a different theme. On line 8 change

ZSH_THEME="robbyrussell"

TO:

ZSH_THEME="agnoster"

Now if you reboot your terminal it'll look nice and gross. We need to change the terminal font to allow for some niceness. Click THIS LINK and download the font.

Installing the font

There is probably a better way to do this BUT I am just trying to get this to work and this is what I found that works. Only if you simply downloaded the file into the downloads directory then executing the following command will take care of the copy and install.

*NOTE: If you downloaded the file into a different directory then simply replace ~/Downloads/Inconsolata+for+Powerline.otf with the path to your file

sudo mkdir /usr/share/fonts/inconsolata && sudo cp ~/Downloads/Inconsolata+for+Powerline.otf /usr/share/fonts/inconsolata/inconsolata.otf && sudo fc-cache -v

After doing this jump into your terminal profile (Edit/Profile Preferences) click off the "Use the system fixed width font" box and change the font to "Inconsolata Light"

After doing this change your font size to your liking and you are good to go!

Copy link

ghost commented Sep 13, 2015

'Sudo chsh -s /usr/bin/zsh' changes root's shell which is OK but probably not what you had in mind. To change user's shell, run the command without sudo and it will ask for user's password and then change user's shell. A mystery why the script can't handle this, though.

@Sadin
Copy link

Sadin commented Jan 27, 2017

Updated for currrent fedora images, as well as found the package necessary for the chsh to be installed and make the auto shell swap work.

https://gist.github.com/Sadin/7d0f7bd0ecaf02df82cbf9cf5f086d68

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