Vagrant is intended as a runtime environment for use with your development, not as the development environment (IDE, tools, etc) itself. But I thought it would be nice if I could run my IDE inside the VM. This would have several advantages, including: leverage IDE shortcuts for executing the app, make it easier to connect the debugger, and ease ramp up time for other developers.
So I looked into setting up a Vagrant VM with Netbeans. The necessary steps are downloading and installing Netbeans in a provisioner, and forwarding X11 from the VM to the Host.
There are many options to do silent installation of Netbeans. I had this inside my shell provisioner (note, this takes quite a while to download and install, and you should do this after installing java)
wget http://download.netbeans.org/netbeans/7.3/final/bundles/netbeans-7.3-javaee-linux.sh chmod 755 netbeans-7.3-javaee-linux.sh sudo ./netbeans-7.3-javaee-linux.sh --silent -J-Dnb-base.installation.location=/opt/netbeans-7.3 rm netbeans-7.3-javaee-linux.sh
Add to Vagrantfile: config.ssh.forward_x11 = “false”
run vagrant with “vagrant up –no-provision” so you don’t download netbeans again!
vagrant ssh into the VM, running netbeans brings up the UI on your host display, it “just works!”
At this point, it works but performance is horrible. Clicking on a menu in Netbeans takes about 12 seconds to respond.
vagrant ssh-config > ~/.ssh/config(be careful not to blow it away if that file already exists). The command looks like
ssh -F ~/.ssh/config -c arcfour,blowfish-cbc -XC defaultNote that the ssh config is set to “Host default” and we need to specify that (“default”) in the ssh command. Using localhost in the ssh command will not work. After this change, performance is much better but still bad (response time opening menus goes from 12 seconds to 4 seconds)
VMWare’s provider is rumored to have special graphics optimizations that let you work with an IDE inside a VM.
You can try VRDP, it may have better performance than X11
NX Server is supposed to be faster than X11
In conclusion, using Vagrant as your complete development environment does not really work out as well as you’d hope. Perhaps not so surprisingly, it’s best to use Vagrant as it was intended.