I'd like to add Oh My Zsh to my Vagrant bootstrap process, but a straight install isn't working.
via curl:
curl -L http://install.ohmyz.sh | sh
via wget:
wget --no-check-certificate http://install.ohmyz.sh -O - | sh
Oh My Zsh is a framework for Zsh, the Z shell. In order for Oh My Zsh to work, Zsh must be installed. Please run zsh --version to confirm.
Theme installation with oh-my-zsh If you're using oh-my-zsh you can keep your themes in the ~/. oh-my-zsh/themes directory as a . zsh-theme file. You'll see that this directory is prepopulated with over 100 themes already!
Found the solution:
# Added zsh shell. sudo apt-get install zsh wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh sudo chsh -s /bin/zsh vagrant zsh
As an nice addition, so that your terminals don't look too similar on the different boxes
# Change the oh my zsh default theme. sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="3den"/g' ~/.zshrc
Here's a complete Vagrantfile
that installs Oh My Zsh on an Ubuntu 14.04.2 LTS box and sets it as the default shell for standard vagrant
user.
This works with Vagrant 1.7.2. (Your milage may vary with different versions.) It uses the directions from the Manual Installation section of the Readme instead of trying to use the automatic scripts.
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| # Pick a box to use: config.vm.box = "ubuntu/trusty64" ############################################################ # Oh My ZSH Install section # Install git and zsh prerequisites config.vm.provision :shell, inline: "apt-get -y install git" config.vm.provision :shell, inline: "apt-get -y install zsh" # Clone Oh My Zsh from the git repo config.vm.provision :shell, privileged: false, inline: "git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh" # Copy in the default .zshrc config file config.vm.provision :shell, privileged: false, inline: "cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc" # Change the vagrant user's shell to use zsh config.vm.provision :shell, inline: "chsh -s /bin/zsh vagrant" ############################################################ end
As a bonus, you can do a one time copy of your host machine's .zshrc
file to the vagrant box with:
config.vm.provision "file", source: "~/.zshrc", destination: ".zshrc"
(Keep in mind, You may have to figure things that don't work initially because of differences between the host machine and the vagrant box's setups.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With