How To Create A Vagrant Base Box
January 4, 2018
https://scotch.io/tutorials/how-to-create-a-vagrant-base-box-from-an-existing-onehttps://www.vagrantup.com/docs/virtualbox/boxes.htmlThis tutorial will create a base box using Ubuntu 16.041. First, initialize vagrant, ssh into the box and install whatever you want on it.While still in ssh…You can also use this tutorial and script to initialize and install a lemp stack:
How To Provision A LEMP Stack in Vagrant2. Make the box as small as possible
$ sudo apt-get clean3. Then, “zero out” the driveNot sure what this does$ sudo dd if=/dev/zero of=/EMPTY bs=1M
$ sudo rm -f /EMPTY4. Clear the Bash History and exit the VM$ cat /dev/null > ~/.bash_history && history -c && exitNow continue from the vagrant command line
5. Repackage the server we just created into a new vagrant base boxwhere ‘mynew.box’ is any name you choose while adding .box at the end$ vagrant package --output mynew.box6. Add this new Vagrant Box into Vagrantwhere ‘mynewbox’ is any name you choose (preferrably similar to the name of the box you just added) and ‘mynew.box’ is the file name of the box you just created$ vagrant box add mynewbox mynew.boxThis now will “download” the box into your Vagrant installation allowing you to initiate this from any folder.To view the list of vagrant boxes:$ vagrant box listTo remove a vagrant box:
https://www.vagrantup.com/docs/cli/box.html$ vagrant box remove NAME
Posted in Tutorials