awlane | 58a83f6 | 2025-05-23 09:44:33 -0500 | [diff] [blame] | 1 | # Mini-NDN in [VirtualBox](https://www.virtualbox.org/) using [vagrant](https://www.vagrantup.com/) |
dulalsaurab | 8c8e633 | 2021-05-21 20:37:03 +0000 | [diff] [blame] | 2 | |
| 3 | ### [RECOMMENDED] Mini-NDN Vagrant Box |
| 4 | |
awlane | 58a83f6 | 2025-05-23 09:44:33 -0500 | [diff] [blame] | 5 | We provide a Vagrant box with Mini-NDN pre-installed. The box can be found |
| 6 | [here](https://portal.cloud.hashicorp.com/vagrant/discover/netlab-memphis-minindn). |
| 7 | For suggested Mini-NDN resource allocation, here's an example [`Vagrantfile`](Vagrantfile) using VirtualBox: |
dulalsaurab | 8c8e633 | 2021-05-21 20:37:03 +0000 | [diff] [blame] | 8 | ```ruby |
dulalsaurab | 8c8e633 | 2021-05-21 20:37:03 +0000 | [diff] [blame] | 9 | Vagrant.configure("2") do |config| |
awlane | 58a83f6 | 2025-05-23 09:44:33 -0500 | [diff] [blame] | 10 | config.vm.box = "netlab-memphis-minindn/minindn-0.7.0" |
dulalsaurab | 8c8e633 | 2021-05-21 20:37:03 +0000 | [diff] [blame] | 11 | config.vm.provider "virtualbox" do |vb| |
| 12 | vb.memory = "4096" |
| 13 | vb.cpus = "4" |
| 14 | vb.name = "mini-ndn-box" |
| 15 | end |
| 16 | end |
| 17 | ``` |
| 18 | ---- |
| 19 | |
awlane | 58a83f6 | 2025-05-23 09:44:33 -0500 | [diff] [blame] | 20 | For those on ARM64 MacOS devices, you can instead use our provided VMWare image. |
| 21 | You will need the [Vagrant VMWare Utility](https://developer.hashicorp.com/vagrant/docs/providers/vmware/installation) |
| 22 | installed. You can then initialize the Vagrant box using `vagrant up --provider vmware_desktop` |
| 23 | |
| 24 | This provider is not as well supported and may encounter minor issues. |
| 25 | |
| 26 | ```ruby |
| 27 | Vagrant.configure("2") do |config| |
| 28 | config.vm.box = "netlab-memphis-minindn/minindn-0.7.0" |
| 29 | config.vm.provider "vmware_desktop" do |vb| |
| 30 | vb.memory = "4096" |
| 31 | vb.cpus = "4" |
| 32 | end |
| 33 | end |
| 34 | ``` |
| 35 | ---- |
| 36 | |
dulalsaurab | 8c8e633 | 2021-05-21 20:37:03 +0000 | [diff] [blame] | 37 | ### [NOT RECOMMENDED] Building from scratch with `vagrant` and VirtualBox containing Mini-NDN |
| 38 | |
| 39 | * Download and install VirtualBox and Vagrant |
| 40 | * https://www.vagrantup.com/downloads |
| 41 | * https://www.virtualbox.org/wiki/Downloads |
| 42 | * To create and start fresh virtual machine: |
| 43 | * Create a file called "Vagrantfile" with this basic setup: |
| 44 | ```ruby |
dulalsaurab | 8c8e633 | 2021-05-21 20:37:03 +0000 | [diff] [blame] | 45 | Vagrant.configure("2") do |config| |
awlane | 58a83f6 | 2025-05-23 09:44:33 -0500 | [diff] [blame] | 46 | config.vm.box = "bento/ubuntu-22.04" |
dulalsaurab | 8c8e633 | 2021-05-21 20:37:03 +0000 | [diff] [blame] | 47 | config.disksize.size = '40GB' |
| 48 | config.vm.provider "virtualbox" do |vb| |
| 49 | vb.memory = 4096 |
| 50 | vb.cpus = 4 |
| 51 | vb.name = "mini-ndn-box" |
| 52 | end |
| 53 | end |
| 54 | ``` |
| 55 | * Open your terminal or command line in the directory that has Vagrantfile |
| 56 | * Start the virtual machine with, |
| 57 | `$ vagrant up` |
| 58 | * (If required) The username/password for the vm are both `vagrant`. |
| 59 | |
| 60 | * To install Mini-NDN, use the following commands: |
| 61 | ```bash |
| 62 | git clone https://github.com/named-data/mini-ndn.git |
| 63 | cd mini-ndn |
awlane | 58a83f6 | 2025-05-23 09:44:33 -0500 | [diff] [blame] | 64 | ./install.sh |
dulalsaurab | 8c8e633 | 2021-05-21 20:37:03 +0000 | [diff] [blame] | 65 | ``` |
| 66 | * To test mini-ndn: |
| 67 | * while still in the `mini-ndn` directory, enter |
| 68 | ```bash |
| 69 | sudo python examples/mnndn.py |
| 70 | ``` |
| 71 | * If it worked, You will see the Mini-NDN CLI. Enter `exit` to close the CLI. |
| 72 | |
awlane | 58a83f6 | 2025-05-23 09:44:33 -0500 | [diff] [blame] | 73 | (Recommended steps for distribution) |
dulalsaurab | 8c8e633 | 2021-05-21 20:37:03 +0000 | [diff] [blame] | 74 | * To clean and export vm as Vagrant Box: |
| 75 | * while in vm, enter these to clean: |
| 76 | ```bash |
| 77 | cd |
| 78 | sudo apt-get clean |
| 79 | sudo dd if=/dev/zero of=/EMPTY bs=1M |
| 80 | sudo rm -f /EMPTY |
| 81 | cat /dev/null > ~/.bash_history && history -c && exit |
| 82 | ``` |
| 83 | * Close the vm window and open a terminal in the same directory as the `Vagrantfile`. |
| 84 | * In the terminal, type this command where `vb_name` is the name of the vm defined in `Vagrantfile`, and `box_name` any name for the output `.box` file |
| 85 | ```bash |
| 86 | vagrant package --base vb_name --output box_name.box |
awlane | 58a83f6 | 2025-05-23 09:44:33 -0500 | [diff] [blame] | 87 | ``` |