Skip to content

Latest commit

 

History

History
46 lines (43 loc) · 1.28 KB

vagrant-and-packer.md

File metadata and controls

46 lines (43 loc) · 1.28 KB

Installing Vagrant/Packer on Ubuntu/Debian

Add the HashiCorp GPG key.

curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -

Add the official HashiCorp Linux repository.

sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"

Update and install.

sudo apt-get update 
sudo apt-get install vagrant
sudo apt-get install packer

Add public box in vagrant

Using Public Boxes

Adding a bento box to Vagrant

vagrant box add bento/ubuntu-18.04
vagrant box add --provider virtualbox bento/ubuntu-16.04
vagrant box add --provider virtualbox bento/ubuntu-18.04
vagrant box add --provider virtualbox bento/ubuntu-20.04

Using a bento box in a Vagrantfile

Vagrant.configure("2") do |config|
  config.vm.box = "bento/ubuntu-18.04"
end

Building Boxes

Requirements: install packer, vagrant and virtualbox

clone bento project

git clone https://github.com/chef/bento.git

To build an Ubuntu 18.04 box for only the VirtualBox provider

cd packer_templates/ubuntu
packer build -only=virtualbox-iso ubuntu-16.04-amd64.json
packer build -only=virtualbox-iso ubuntu-18.04-amd64.json
packer build -only=virtualbox-iso ubuntu-20.04-amd64.json