-
Notifications
You must be signed in to change notification settings - Fork 12
Run las2peer on VMs
At some time you may want to run las2peer on a virtual machine. There are some issues you could run into, this tutorial should give you some answers.
I used QEMU on Ubuntu to set up a las2peer VM, but some points can easily be transferred to other set ups. Feel free to add more tutorials for other VM solutions.
Running las2peer in VirtualBox is not recommended as it can not provide enough random numbers (see below for details) for key generation (unless you move your mouse and keyboard). You should expect that key generation will take minutes!
Assuming you have at least Ubuntu 14.04 running, install QEMU and virt-manager using: sudo apt-get install qemu-system-x86
and sudo apt-get install virt-manager
.
- Download the ISO you want to use as guest system. I used Ubuntu 14.04 LTS Server.
- Open
Virtual Machine Manager
, create a new VM and follow the instructions. I recommend to set up a virtual disk with at least 20GB of disk space to be on the safe side. - Start the VM and install the OS. At some point you will be asked to install additional software. Select
openssh-server
to be able to access your VM conveniently (or runsudo apt-get install openssh-server
after the installation). - Boot the guest machine, log in and get the IP address shown after the login. In the host machine, you can access the machine using
ssh username@IP
and access the machine using sftp in the file manager. - To run las2peer, you need Java 8. I recommend OpenJDK since it already ships with the Java Cryptography Extension Policy Files. Ubuntu 14.04 doesn't have OpenJDK 8 in the official repository. You need to set up a PPA with
sudo apt-add-repository ppa:openjdk-r/ppa
, then runsudo apt-get update && sudo apt-get install openjdk8-jre
to install the JRE. You may check the Java version usingjava -version
and set the version usingsudo update-alternatives --config java
if needed.
Random numbers are a rare good on a system. Linux gets entropy from random keyboard and mouse events or special hardware in order to generate random numbers. On a VM, none of these entropy sources are available; so las2peer would not be able to generate a single key pair unless you go to your VM and press random buttons on your keyboard. You need to make the hosts random number generator available to the guest system.
In QEMU do the following:
- Open the VM, go to VM details (the blue "i")
- click on "Add hardware"
- click on "RNG" and accept
- click on "Apply"
Now, the random number generator is available to your guest system.
Notice: QEMU also makes hardware random number generators available to the guest system, so you shouldn't have any performance losses.
las2peer is now ready to start. Guests can access other guests using their IPs. Simply copy the las2peer folder to your VMs and launch them.
Launch the bootstrapping node:
java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher --port 9085 --node-id-seed 1 uploadStartupDirectory\(\'etc/startup\'\) interactive
And any additional host:
java -cp "lib/*" i5.las2peer.tools.L2pNodeLauncher --port 9085 --bootstrap [HOSTIP]:9085 --node-id-seed [SEED] interactive