Skip to content

Instantly share code, notes, and snippets.

@ridvanaltun
Created June 29, 2021 19:16
Show Gist options
  • Save ridvanaltun/e4e090bbfa05cedabaff5cba5541faf8 to your computer and use it in GitHub Desktop.
Save ridvanaltun/e4e090bbfa05cedabaff5cba5541faf8 to your computer and use it in GitHub Desktop.
Create Vagrant box from existing Vagrant Box
# create an example ubuntu box
vagrant init bento/ubuntu-18.04

# deploy it
vagrant up

# connect to the box over ssh
vagrant ssh

# install what ever you want
sudo apt-get install ...

# clear apt cache
apt-get clean

# clear bash history and exit
cat /dev/null > ~/.bash_history && history -c && exit

# shut down
vagrant halt

# create box from existing box
vagrant package --output package.box

# add the box to .vagrant.d (vagrant home)
vagrant box add --name mynewbox file:///d:/package.box

# you can use it now
vagrant init mynewbox

You can manualy upload new box from: https://app.vagrantup.com/boxes/new

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment