Kategorie-Archiv: Linux

VirtualBox tutorial dedicated to the creation of an distributed environment for Java developing

Background
This VirtualBox tutorial is about the creation of an distributed environment for Java developing. Background is, that I am teaching Advanced Java Programming (named PROG2 at ZHAW). Topics of the PROG2 lecture are:

  1. Multi-Threading (Basic and Advanced Threading Concepts)
  2. Input/Output (JDBC, File-IO, TPC/UDP, Client-Server)
  3. Testing (Mockups, Mokito)
  4. Graphical User Interfaces (Swing/AWT/Android)

Motivations for this tutorial do exist many, but the first and foremost was the desire to test networked Java applications in a (close to real) distributed environment.

Basic System Layout
The basic setup is inspired by the virtual environment proposed for a local OpenStack deployment, described in detail in tutorial „Creating a VirtualBox-based Test Infrastructure„. It consists of:

  1. One Master Node (aka Controller Node)
  2. Two Worker Nodes (Compute Nodes)

Basic System Configuration

  1. Hardware: VT Enabled PC
  2. Host Operating Systems: OpenSuse
  3. Virtualization: VirtualBox
  4. Virtual Networking: Host only connections. a VirtualBox concept for providing purely internal networks between your host and Virtual Machines
  5. Guest Operating Systems: Ubuntu Server (LTS or not doesn’t make a difference here)

Hardware Support for Virtualization
Whether or not your local host machine provides hardware support for Virtualization Technologies (VT, vmx or svm) can be found out by running this command in a terminal „cat /proc/cpuinfo |grep -E „vmx|svm““. Here is what I got on my Dell Ultrabook (VMX support is indicated in bold)

tmb@tmbuell:~> cat /proc/cpuinfo |grep -E „vmx|svm“
flags : fpu vme de (…) eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est (…) flags : fpu vme de pse tsc (…) ds_cpl vmx smx est flags : fpu vme de pse (…) monitor ds_cpl vmx smx est tm2 (…) bmi2 ms invpcid rtm flags : fpu vme de pse tsc msr (…) monitor ds_cpl vmx smx est tm2 ssse3

The Guest OS
tmb@tmbuell:~> less /etc/SuSE-release
openSUSE 13.1 (x86_64)
VERSION = 13.1
CODENAME = Bottle
# /etc/SuSE-release is deprecated and will be removed in the future, use /etc/os-release instead

Virtualization based on VirtualBox
Installing VirtualBox on OpenSuse is trivial using zypper and a terminal:
tmb@tmbuell:~> zypper install virtualbox
zypper search virtualbox
Loading repository data…
Reading installed packages…

S | Name | Summary | Type
–+——————————+——————————————–+———–
i | python-virtualbox | Python bindings for virtualbox | package
i | virtualbox | VirtualBox is an Emulator | package
| virtualbox | VirtualBox is an Emulator | srcpackage
i | virtualbox-devel | Devel files for virtualbox | package
| virtualbox-guest-kmp-default | Guest kernel modules for VirtualBox | ackage
i | virtualbox-guest-kmp-desktop | Guest kernel modules for VirtualBox | package
| virtualbox-guest-kmp-pae | Guest kernel modules for VirtualBox | package
i | virtualbox-guest-tools | VirtualBox guest tools | package
i | virtualbox-guest-x11 | VirtualBox X11 drivers for mouse and video | package
| virtualbox-host-kmp-default | Host kernel module for VirtualBox | package
i | virtualbox-host-kmp-desktop | Host kernel module for VirtualBox | package
| virtualbox-host-kmp-pae | Host kernel module for VirtualBox | package
i | virtualbox-qt | Qt GUI part for virtualbox | package
| virtualbox-websrv | WebService GUI part for virtualbox | package

Viruaal Machine Creation and Configuration
The selected environment requires the creation of several VMs, whereas most of them do share the same basic characteristics and configuration. A smart approach is to configure and then to use „Cloning“ to create duplicates.

Since we’ll have several VMs that are associated with each other we have to configure a set of Virtual Networks. For that launch Virtual Box, navigate to File>Preferences>Network. Then choose the option to add „Host-Only Networks“. Create three Host-Only Network Connections; Vboxnet0-Vboxnet2.

Configure Vboxnet0 with IPv4 Address 10.10.10.1 and IPv4 Network Mask 255.255.255.0, Vboxnet1 with IPv4 Address 10.20.20.1 and IPv4 Network Mask 255.255.255.0, and Vboxnet2 IPv4 Address 192.168.100.1 and IPv4 Network Mask 255.255.255.0.

Stay Tuned, More To Come On
Network Configuration, SSH Access, Port Forwarding, Guest installation, Sharing between Guests and Guest, and Guest and Hosts (Shared Folder, USB, SFTP), Guest Additions, Java installation, Git and GitHub

A Simple Android Project – Bin2Dec Converter

For some demonstration purposes I developed an Android/Java-based Bin2Dec Converter. The program illustrates Java IF/ELSE structures and was designed using Nassi-Shneider diagrams. The initial case, user requirements, and the final design plus some background information on NS-diagrams can be found here Bin2Dec Converter: Requirements and Design

The application can be downloaded here: Android Bin2Dec Converter Android APK.

Google Apps and KDE Kontact

It is now roughly 11 years since I turned to Linux and ever since it stays as my one and only OS, for private and professional matters. Isnt that a long time?

Pointless to elaborate why Linux appeals to computer scientist. Yet besides all those nitty gritty technical merits of Linux, it was and still is the appeal of KDE that made up for quite some frustrations. Since the very begining I use KMail, for instance, and I don““t see any reason why this should change as long as the community sticks to its plain design and efficient usability.

So why writing this? I finally bought an HTC Nexus; the Android framework is truly impressive. Consequently, I am now using more of the Google universe since the integration of Android and the rest of Googles Apps/Services is compelling (let““s face it). So an pressing question was how to sync Android / Gmail Calendar with Kontact and the solution is GCALDeamon. The tool is pretty simple to install/use especially in view of the many configurations it supports. Very well done, definitively worth this post.

A good intro to started off can be found at How to make Kontact work with Google Apps. There is little detail though, in particular it doesnt tell explicitely whether to use „file-based“ or „http-based/http-server“ sync. Both options are possible (c.f. the manual of the tool). It works fine for me with the http-based option.