Skip to content

Instantly share code, notes, and snippets.

@ashiqopu
Last active May 22, 2021 02:05
Show Gist options
  • Select an option

  • Save ashiqopu/f1f5e5080fefd198992d2c05d4af1a51 to your computer and use it in GitHub Desktop.

Select an option

Save ashiqopu/f1f5e5080fefd198992d2c05d4af1a51 to your computer and use it in GitHub Desktop.
vagrant box build

Inside the VM after everything is installed. For compression purpose.

  • Zero out the vm and exit
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

Outside the VM (after compressing and logging out)

  • Creating the box
    • Make sure you have vagrant installed: https://www.vagrantup.com/downloads
    • Find the virtualbox VM name from the left panel of the VirtualBox main window.
    • OS specific (for making it easy to point to output directory)
      • Linux (Ubuntu):
        • Good practice to open a terminal to an appropriate directory
      • Windows:
        • Open powershell to an appropriate directory (ctrl + shift + right-mouse-click should give you option to open powershell as admin. Non-admin is also fine)
    • Use command (replace my-virtual-machine with the VM name and mynew with some useful name, say miniNDN):
vagrant package --base my-virtual-machine --output mynew.box

Post completion testing:

  • Add the vagrant box to your box list (replace the mynewboxV1 name as desired, say miniNDNv1):
vagrant box add mynewboxV1 mynew.box
  • Create a new Vagrantfile in a new directory (note: there's no extension) following miniNDN recommendations.
Vagrant.configure("2") do |config|
  config.vm.box = "mynewboxV1"
  config.vm.provider "virtualbox" do |vb|
    vb.memory = "8192"
    vb.cpus = "4"
  end
end
  • Create the VM and bring it online
vagrant up
  • Run any expected tests after logging in
vagrant ssh
  • One example test to see if mininet is working
sudo mn --test pingall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment