I’ve been using zsh for years, more specifically the oh-my-zsh framework, it will make your terminal smarter, sexier and easier to use. Here’s a little tutorial to show how you can set up your custom zsh shell with oh-my-zsh and automate this for newly created virtual servers under virtualmin.

A delightful community-driven (with 1,000+ contributors) framework for managing your zsh configuration. Includes 200+ optional plugins (rails, git, OSX, hub, capistrano, brew, ant, php, python, etc), over 140 themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.

About 90% of the time when managing virtual servers I’m the one doing it and by default i wanted to apply zsh and the oh-my-zsh framework for newly created virtual servers. It saves you some space by centralizing the code and automates the process. This was quite easy to achieve and here’s an outline of the following changes you need to make.

The steps

First and foremost make sure you have zsh installed on your distro, then under System Customization -> Custom Shells enable /bin/zsh.

To make /bin/zsh the default shell for new virtual servers go to System Settings -> Server Templates -> Default Settings under Administration User and Initial unix shell select /bin/zsh.

Now it’s time to download and set up oh-my-zsh. The easiest way to do this is to ssh into your virtualmin server and run this command sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)". It will install and prompt you to change the default shell to zsh. If you’re having any issues visit oh-my-zsh on github.

Once installed, move the ~/.oh-my-zsh folder to a more centralized location, like /opt/oh-my-zsh. Modify the ~/.zshrc file and change export ZSH to export ZSH=/opt/oh-my-zsh. Then copy the .zshrc file to /etc/skel/ so that it will be included in new virtual server creation.

… And that’s about it, hope you enjoyed this simple tutorial.