SO many articles on this that do not work or cannot revert misconfigs. Perhaps deleting all Boxes and starting again would help but Vagrant says they cannot be found / destroyed even after identifying using things like
vagrant box list
I am trying to acheive such a simple requirement - use Ubuntu server LTS, setup Nginx, PHP, MySQL. Config Nginx to display a test HTML and PHPinfo.php page.
Package that box so I can reuse an existing web dev VM that is setup and working.
Vagrant continually ignores new packaged box and loads 'default' despite editing Vagrantfile.
I have not done anything funky, just trying to create a base box from official ubuntu/xenial64 before I waste another 2 days where Vagrant packages without private/public keys and becomes useless.
Current sources are as below but this is so poorly documented regarding packaging a re-usable box that I am beginning to think Vagrant is unusable.
https://scotch.io/tutorials/how-to-create-a-vagrant-base-box-from-an-existing-one
#minimise and delete junk
sudo apt-get clean;
sudo dd if=/dev/zero of=/EMPTY bs=1M;
sudo rm -f /EMPTY;
cat /dev/null > ~/.bash_history && history -c && exit;
#package it
vagrant package --output lnmp_1604_70.box
#add box
vagrant box add lnmp_1604_70_v01 lnmp_1604_70.box
vagrant init lnmp_1604_70_v01
# IMPORTANT - do this before first vagrant up
config.vm.box = "lnmp_1604_70_v01"
config.ssh.insert_key = false;# in Vagrantfile
# It will keep the insecure key in place while prepping your VM for packaging
# If the key has already been replaced you can restore the default one by editing "~vagrant/.ssh/authorized_keys" and replacing it with # the insecure public key at https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub
Vagrant 1.9.8
The procedure described at How to Create a Vagrant Base Box from an Existing One works perfectly on my box.
I think that after
vagrant box add lnmp_1604_70_v01 lnmp_1604_70.box
you have to run
vagrant init lnmp_1604_70_v01
instead of, as you wrote in your question,
vagrant init lnmp_1604_70
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.