由于0.10.10版本中的错误,当前的Chef配方未运行。如何将Vagrant使用的Chef版本升级到0.10.12?
我不想只为VM的当前实例更新它--我一直在销毁和重建这些实例。我是否需要更改Vagrant基础框中的某些内容,或者我的(物理)系统安装中的某些内容?
发布于 2013-08-13 23:43:21
使用Vagrant插件vagrant-omnibus对我来说效果很好:
vagrant plugin install vagrant-omnibus
然后,在进行配置之前,只需在Vagrantfile中配置chef版本:
config.omnibus.chef_version = :latest
您还可以指定特定的版本:
config.omnibus.chef_version = '11.6.0'
发布于 2013-05-06 23:10:38
添加这些行
config.vm.provision :shell, :inline => 'apt-get install build-essential ruby1.9.1-dev --no-upgrade --yes'
config.vm.provision :shell, :inline => "gem install chef --version 11.4.2 --no-rdoc --no-ri --conservative"
在你的config.vm.provision :chef_solo
块之前到你的Vagrantfile。
支持hauraki对http://dougireton.com/blog/2012/12/23/automatically-upgrading-chef-client-on-vagrant-up/的评论
编辑后加入了Jason Mayfield的评论。一定要给他投赞成票。我添加了--no-upgrade
以加快速度,并与第二行上的--conservative
相匹配。相反,您可以像Jason那样删除--no-upgrade
和--conservative
。
编辑以包含匿名user228653建议的编辑
发布于 2012-07-15 00:40:54
重建基本框。首先,在不提供和SSH的情况下启动它。
vagrant up --no-provision
vagrant ssh
然后,执行更新框所需的命令。这可能包括更新Chef和Ruby。可选的,更新操作系统的包,等等。你应该清理所有不需要的东西,比如下载的包文件或缓存。
例如,我在我的Vagrant盒中使用了Opscode Omnibus Full Stack Installer for Chef (最初是用VeeWee构建的),并且我还更新了包。
sudo dpkg --purge chef chef-full
sudo true && curl -L https://www.opscode.com/chef/install.sh | sudo bash
sudo apt-get update && sudo aptitude safe-upgrade
sudo rm /var/cache/apt/archives/*.deb
不要忘记将磁盘“清零”以减小磁盘大小。
# a bunch of commands like gem install chef, apt-get upgrade, whatever
sudo dd if=/dev/zero of=/EMPTY bs=1M
sudo rm /EMPTY
exit
然后,将盒子打包并添加到您的Vagrant环境中以供使用。
vagrant package
vagrant box add mynewlucid32 package.box
如果您想使用相同的box名称,则需要首先删除现有的box (~/.vagrant.d/BOXNAME)。
https://stackoverflow.com/questions/11325479
复制相似问题