Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sadin/7d0f7bd0ecaf02df82cbf9cf5f086d68 to your computer and use it in GitHub Desktop.
Save Sadin/7d0f7bd0ecaf02df82cbf9cf5f086d68 to your computer and use it in GitHub Desktop.
Installing Oh My ZSH oh Fedora 25+

Installing oh-my-zsh on Fedora

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 dnf)

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

sudo dnf 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 the latest fedora image, unless you install the chsh command manually packaged in the "util-linux-user" package. So after installing oh-my-zsh you will need to run the following commands:

sudo dnf install util-linux-user -y

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!

@BrunoVernay
Copy link

OhMyZSH has a valid TLS certificate now: You should use it. (Ignoring it --no-check-certificate is a risky usage!)
It will also be simpler.

And while I am talking about security, remember: Copy/Paste from Web to terminal

https://explainshell.com/explain?cmd=curl+-fsSL+https%3A%2F%2Fraw.github.com%2Frobbyrussell%2Foh-my-zsh%2Fmaster%2Ftools%2Finstall.sh

Great and useful page otherwise.

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