如今基本差很少了,能夠從新打包發佈了php
Usage: vagrant package [options] [name|id] Options: --base NAME Name of a VM in VirtualBox to package as a base box (VirtualBox Only) --output NAME Name of the file to output --include FILE,FILE.. Comma separated additional files to package with the box --vagrantfile FILE Vagrantfile to package with the box -h, --help Print this help
打開virtualbox看一下虛擬機實例的名字: phptest_default_1490589998754_16798 而後打包node
vagrant package --base phptest_default_1490589998754_16798 -output centos7_php7.box
等待一下子,一個你定製好的vagrant box打包好了git
你可能還有其餘的軟件須要提早安裝,好比redis,好比nodejs,能夠參照個人另外一篇博客CentOS 7 安裝 gitlab 8.1.7github
Warning: Authentication failure. Retrying... 這個問題的緣由是vagrant在初始化時虛擬機實例時,若是發現insecure key,會自動生成新的key pair去替換掉默認的,打包時把新的public key打包進box。這樣使用該包生成新的實例時,和默認的insecure key就不匹配了。解決方案就是在打包以前,把虛擬機中的的public key從新替換秤默認的。redis
cd /home/vagrant sudo -u vagrant wget https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O .ssh/authorized_keys
這時不要關閉虛擬機,把 .vagrant\machines\default\virtualbox
目錄下的private_key文件刪除 在host系統上執行centos
vagrant package
這樣就能夠了。 還有些很是規解決方案,好比,修改ssh登陸時使用用戶名密碼對等,php7
config.ssh.username = "vagrant" config.ssh.password = "vagrant"
解決方案就是把相應的Vagrantfile打包進來ssh
vagrant package --base xx --output centos7_php7 --vagrantfile xx