Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am looking for the step by step instructions to setup at least two simple Ubuntu Virtual Core 12.10 Server VMs on Oracle VirtualBox under Windows 7 64bit.

The test setup would be:

  1. Apache HTTP server on the Windows host acting as a Load Balancer. The result will be that going to http://localhost:8080 would balance between two nodes and providee session replication.

  2. Two lean, small footprint, Ubuntu Server guest nodes with Java 7 and Tomcat 7.

The intention is to help everyone doing High Availability / Load Balancing development and testing to create a reasonable environment on the local workstation or mainstream notebook in as little time as possible.

share|improve this question

closed as not constructive by EEAA, Magellan, Ward, Scott Pack, Zypher Oct 22 '12 at 22:01

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Have you done any research yourself? Or are you just asking here in the hope that someone can do all the work for you? –  Colin 't Hart Oct 22 '12 at 9:48
1  
I just got it all running 8 hours ago. There are many bits and pieces around the interned, but not a single site provides a half-way comprehensive answer. Partially I was thinking of answering it myself and looking for comments / improvement suggestions. –  Alex Pakka Oct 22 '12 at 12:11
1  
This question received over 1k views. While I don't dispute moderators' decision to close it, I would be willing to improve both, the question and the answer... E.g. I could specify more details about the required setup to avoid any arguments about flavours. –  Alex Pakka Feb 22 '13 at 18:55
add comment

1 Answer

up vote 2 down vote accepted

Following assumes you did use Tomcat before, and simply want to create your own test environment.

Pre-requisits: As this is a 64bit setup, ensure your host supports CPU hardware virtualization. Many notebooks do not support it out of the box, but vendors typically provide BIOS upgrade, sometimes with warranty implications, that enables virtualization. Alternatively, use 32bit guests.

Step 1 Download ubuntu-12.10-server-amd64.iso (this one has worked for me, feel free to try other flavours, the instructions are not very specific to this build).

Step 2 Open Oracle VM VirtualBox manager and create a New Machine with the following profile:

Operating System: Linux

Version: Ubuntu (64bit)

Base memory: 512 MB Processors: 1 CPU Display: leave default

Storage: Remove SATA and add SCSI controller, Lsilogic. Add VDI HDD of at least 2GB in size (512 MB of it will be used for swap, actual OS and software will use about 1.1GB). I recommend 4GB with Dynamically Allocated Storage option to have some room for tests. Also add IDE controller and attach your Ubuntu Server .iso as a CD drive The reason behind SCSI is that we will use Virtual Core of Ubuntu and it does not have SATA drivers out of the box.

Audio: Disable it

Network: You can choose Bridged Adapter for startes, you will switch to Host-only Adapter later on. Alternatively, create two NICs, with NAT and Host-only adapter (see Step 4)

Make sure the order of devices in your machine setup has HDD first for later on.

Step 3 Start up your machine. Right after selecting language for the setup, hit F4 to select core before starting the actual installation. Choose "Install minimal virtual machine" (more on it here: http://askubuntu.com/questions/57336/minimal-system-or-minimal-virtual-machine-on-install) Follow the setup process using defaults, use up entire disk for your partition etc., until you hit the section "Software Selection"; mark Tomcat Java server there. Keep going through GRUP install and login as user you created. All in all it should take about 15-20 minutes. After it is running from HDD, you already have your Tomcat started!

Notes:

  • On your host system, open a browser and go to http://[guest host name]:8080; if your were going with default host name, it would be http://ubuntu:8080 - you will see your Tomcat start page with all the paths where you can configure and put your code. If it does not resolve, run ifconfig on your guest and use the IP address.
    • Your webapps are under /var/lib/tomcat7/webapps/
    • Your tomcat7 server.xml is under /etc/tomcat7
    • Logs are under /var/log/tomcat7

If you are not a vim professional and have experience with various commanders I recommend to, sudo apt-get install mc to be able to start Midnight Commander via mc.

Power down your new machine via e.g. sudo shutdown -P 0.

Step 4 Cloning of the VM. When you clone it to create another guest, make sure that your MAC address on the NIC stays the same, there is a small problem with NIC autodetection. So, to clone: a) create a clone b) change MAC address of the NIC c) start up the second machine (it will take 2 minute delay as network layer will complain) d) change /etc/udev/rules.d/70-persistent-net.rules so that ATTR{address}== matches the MAC address of the NIC in VirtualBox settings. Done.

Step 5 Setting up the network.

  • In VM Manager File | Preferences ensure you have VirtualBox Host-Only Ethernet Adapter and that the DHCP is on and set up.
  • Switch your Ubuntu guests settings on eth0 to VirtualBox Host-Only Ethernet Adapter. Check that MAC addresses are different among them, but do not change from what you had in 70-persistent-net.rules
  • Start both VMs up, they should get two different local addresses. If you bridge your main LAN adapter and your Virual one in Windows, you will be able to use their IPs to access the web sites.

Step 6 Setting up Apache HTTP. Follow, e.g. these instructions http://satishkumars.wordpress.com/2012/03/07/how-to-load-balance-tomcat-7-with-apache-2-2/

Step 7 Configuring actual Tomcat cluster: http://tomcat.apache.org/tomcat-7.0-doc/cluster-howto.html

Useful tools: - If you are tried of sudo-ing every time, do sudo su - to work as root, as you probably do not care much about the security on these virtual machines - lshw -class network gives you a nice overview on your NIC adapters - ifdown eth0 then ifup eth0 allow you to renew network settings without restart

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.