-
Notifications
You must be signed in to change notification settings - Fork 11
Vagrantfile for VirtualBox virtual nodes from a build .bin file
Welcome to the nycmeshfeed wiki!
To create a VirtualBox virtual node based on the firmware,
-
Install VirtualBox.org
-
Install VagrantUp.com
-
Create
mesh/build
andmesh/node
directories:mkdir mesh/build; mkdir mesh/node
-
cd mesh/build
-
vagrant init starrychloe/qmp-nycmesh-3.2.1
-
vagrant up
-
vagrant ssh
- If
vagrant ssh
appears not to work and appears to hang, tryls
to see if you are in fact logged in but just not seeing a command prompt.exit
from the guest and create this file, changing the path for your host system:
$ cat ssh-config Host default HostName 127.0.0.1 User vagrant Port 2222 UserKnownHostsFile /dev/null StrictHostKeyChecking no PasswordAuthentication no IdentityFile C:/Users/Chloe/workspace/mesh/build/.vagrant/machines/default/virtualbox/private_key IdentitiesOnly yes LogLevel FATAL
- Then use
ssh -F ssh-config default
to log in.
- If
-
cd qmpfw-nycmesh-3.2.1
-
Build the firmware based on the instructions here: https://github.com/nycmeshnet/nycmeshfeed. However this has already been done.
-
Copy the firmware image back to your host:
cp images/qMp*.bin /vagrant
-
Exit the guest build box:
exit
-
cd ../node
-
Copy this Vagrantfile into the
node
folder:
Vagrant.configure("2") do |config|
latest_bin = `ls -t ../build/*.bin | head -1`.strip
#latest_bin = Dir.glob('../build/*.bin').sort{ |a,b| File.new(a).stat <=> File.new(b).stat }.last
vdi_file = 'nycmesh-qmp-openwrt.vdi'
system "vboxmanage convertfromraw --format vdi #{latest_bin} #{vdi_file}" unless File.exist?(vdi_file)
config.vm.box = "centos/7"
config.vm.network "public_network"
config.vm.network "private_network", ip: "192.168.1.1"
config.vm.provider "virtualbox" do |vb|
vb.memory = "64"
# add the newly created build disk firmware
#vb.customize ['storageattach', :id, '--storagectl', 'IDE', '--port', 0, '--device', 0, '--type', 'hdd', '--medium', "none"]
vb.customize ['storageattach', :id, '--storagectl', 'IDE', '--port', 0, '--device', 0, '--type', 'hdd', '--medium', "nycmesh-qmp-openwrt.vdi"]
vb.customize ["modifyvm", :id, "--ostype", "Linux26"]
end
config.vm.provision "shell", inline: "" do
# delete the placeholder dummy hdd image. there should be a better way.
# NO WAY TO GET THE DUMMY HDD FILE NAME AFTER THE INSTANCE IS CREATED AND BEFORE THE NEW VDI IS INSTALLED!
# id = File.read(".vagrant/machines/default/virtualbox/id")
# hdd_file = `vboxmanage showvminfo #{id}`.split(/\n/).grep(/IDE \(0, 0\): /).first.split(/ /)[3]
# puts hdd_file
# File.delete(hdd_file) if hdd_file.index 'centos-7-1-1.x86_64.vmdk'
end
end
- Generate the box:
vagrant up
There's no known way to SSH into the node at this point (see https://superuser.com/questions/1309253/why-cant-i-log-into-my-dropbear-virtualbox-with-ssh-ssh-exchange-identificati). For now, open the VirtualBox GUI, select the node, and click Show to view the console. Press ENTER
to get a root command prompt.