blob: 06f7449fb12e8b2cc37dda5cff8f5127679084c9 [file] [log] [blame] [view]
dulalsaurab8c8e6332021-05-21 20:37:03 +00001# Mini-NDN in [VirtualBox](https://www.virtualbox.org/) using [vagrant](https://www.vagrantup.com/).
2
3### [RECOMMENDED] Mini-NDN Vagrant Box
4
5We have a Mini-NDN pre-installed in a vagrant box. The box can be found [here](https://app.vagrantup.com/sdulal/boxes/mini-ndn). For suggested Mini-NDN resource allocation,
6Here's an example [`Vagrantfile`](https://gerrit.named-data.net/c/mini-ndn/+/6426/18/vagrant/Vagrantfile):
7```ruby
8# -*- mode: ruby -*-
9# vi: set ft=ruby :
10Vagrant.configure("2") do |config|
11 config.vm.box = "sdulal/mini-ndn"
12 config.vm.provider "virtualbox" do |vb|
13 vb.memory = "4096"
14 vb.cpus = "4"
15 vb.name = "mini-ndn-box"
16 end
17end
18```
19----
20
21### [NOT RECOMMENDED] Building from scratch with `vagrant` and VirtualBox containing Mini-NDN
22
23* Download and install VirtualBox and Vagrant
24 * https://www.vagrantup.com/downloads
25 * https://www.virtualbox.org/wiki/Downloads
26* To create and start fresh virtual machine:
27 * Create a file called "Vagrantfile" with this basic setup:
28 ```ruby
29 # -*- mode: ruby -*-
30 # vi: set ft=ruby :
31 Vagrant.configure("2") do |config|
32 config.vm.box = "bento/ubuntu-20.04"
33 config.disksize.size = '40GB'
34 config.vm.provider "virtualbox" do |vb|
35 vb.memory = 4096
36 vb.cpus = 4
37 vb.name = "mini-ndn-box"
38 end
39 end
40 ```
41 * Open your terminal or command line in the directory that has Vagrantfile
42 * Start the virtual machine with,
43 `$ vagrant up`
44 * (If required) The username/password for the vm are both `vagrant`.
45
46* To install Mini-NDN, use the following commands:
47 ```bash
48 git clone https://github.com/named-data/mini-ndn.git
49 cd mini-ndn
50 ./install.sh --source
51 ```
52* To test mini-ndn:
53 * while still in the `mini-ndn` directory, enter
54 ```bash
55 sudo python examples/mnndn.py
56 ```
57 * If it worked, You will see the Mini-NDN CLI. Enter `exit` to close the CLI.
58
59(Additional optional "not really needed" steps)
60* To clean and export vm as Vagrant Box:
61 * while in vm, enter these to clean:
62 ```bash
63 cd
64 sudo apt-get clean
65 sudo dd if=/dev/zero of=/EMPTY bs=1M
66 sudo rm -f /EMPTY
67 cat /dev/null > ~/.bash_history && history -c && exit
68 ```
69 * Close the vm window and open a terminal in the same directory as the `Vagrantfile`.
70 * 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
71 ```bash
72 vagrant package --base vb_name --output box_name.box
73 ```