我想将Oh My Zsh添加到我的Vagrant引导程序中,但直接安装不起作用.
通过卷曲:
curl -L http://install.ohmyz.sh | sh
通过wget:
wget --no-check-certificate http://install.ohmyz.sh -O - | sh
Alan Quigley.. 30
找到解决方案:
# 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
作为一个很好的补充,所以你的终端在不同的盒子上看起来不太相似
# Change the oh my zsh default theme. sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="3den"/g' ~/.zshrc
Alan W. Smit.. 20
这是一个完整的Vagrantfile
,在Ubuntu 14.04.2 LTS盒子上安装Oh My Zsh并将其设置为标准vagrant
用户的默认shell .
这适用于Vagrant 1.7.2.(您的milage可能因版本不同而有所不同.)它使用自述文件的" 手动安装"部分中的说明,而不是尝试使用自动脚本.
# -*- 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
作为奖励,您可以使用以下命令将主机.zshrc
文件的一次性副本复制到流浪者盒中:
config.vm.provision "file", source: "~/.zshrc", destination: ".zshrc"
(请记住,由于主机和流浪盒的设置不同,您可能必须先找出最初不起作用的东西.)