Monday Feb 09, 2009

TOTD #68: Installing Zones in Open Solaris 2008/11 on Virtual Box

The TOTD #64 describes how to install Open Solaris 2008/11 using Virtual Box. This Tip Of The Day (TOTD) is going to explain how to install non-global zones (aka Solaris Containers) on this Open Solaris image. Containers provide an operating-system level virtualization technology.

Thanks for the extensive discussion at zones-discuss forums, Bill Walker for lots of off-line support, and last but not the least Marcelo Arbore's nice blog showing how to install GlassFish in an Open Solaris zone.

This blog is going to focus on installing couple of non-global containers/zones in the Virtual Box image with all gory details. A later blog will show how to leverage these zones to demonstrate GlassFish High Availability.

Lets get started!

To begin with, there is one global zone always installed as shown below (user inputs highligted in bold):

arun@opensolaris:~# zoneadm list -vi
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared

Lets install the zone. The IP address is specified in 192.168.0.XXX range ...

arun@opensolaris:~# zonecfg -z zone1
zone1: No such zone configured
Use 'create' to begin configuring a new zone.
zonecfg:zone1> create
zonecfg:zone1> set zonepath=/export/home/zone1
zonecfg:zone1> set autoboot=true
zonecfg:zone1> add net
zonecfg:zone1:net> set address=192.168.0.99/24
zonecfg:zone1:net> set physical=e1000g0
zonecfg:zone1:net> end
zonecfg:zone1> commit
zonecfg:zone1> exit
arun@opensolaris:~# zoneadm -z zone1 install
A ZFS file system has been created for this zone.
  Authority: Using http://pkg.opensolaris.org/release/.
      Image: Preparing at /export/home/zone1/root ... done.
      Cache: Using /var/pkg/download.
 Installing: (output follows)
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                  52/52   7862/7862   72.41/72.41

PHASE                                        ACTIONS
Install Phase                            12939/12939
PHASE                                          ITEMS
Reading Existing Index                           9/9
Indexing Packages                              52/52

       Note: Man pages can be obtained by installing SUNWman
Postinstall: Copying SMF seed repository ... done.
Postinstall: Working around http://defect.opensolaris.org/bz/show_bug.cgi?id=741
       Done: Installation completed in 165.652 seconds.

 Next Steps: Boot the zone, then log into the zone console
             (zlogin -C) to complete the configuration process
arun@opensolaris:~# zoneadm -z zone1 boot
arun@opensolaris:~# zlogin -C zone1
[Connected to zone 'zone1' console]
68/68
Reading ZFS config: done.
Mounting ZFS filesystems: (6/6)

Specify the type of terminal ...

What type of terminal are you using?
 1) ANSI Standard CRT
 2) DEC VT100
 3) PC Console
 4) Sun Command Tool
 5) Sun Workstation
 6) X Terminal Emulator (xterms)
 7) Other
Type the number of your choice and press Return: 1
Creating new rsa public/private host key pair
Creating new dsa public/private host key pair
Configuring network interface addresses: e1000g0.

Configure NIC ...

- Host Name for e1000g0:1 ------------------------------------------------------
  Enter the host name which identifies this system on the network.  The name
  must be unique within your domain; creating a duplicate host name will cause
  problems on the network after you install Solaris.

  A host name must have at least one character; it can contain letters,
  digits, and minus signs (-).


    Host name for e1000g0:1 zone1






- Confirm Information for e1000g0:1 --------------------------------------------
  > Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.


    Host name: zone1

No Kerberos ...

- Configure Security Policy: ---------------------------------------------------
  Specify Yes if the system will use the Kerberos security mechanism.

  Specify No if this system will use standard UNIX security.

      Configure Kerberos Security
      ---------------------------
      [ ] Yes
      [X] No



- Confirm Information ----------------------------------------------------------
  > Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.


    Configure Kerberos Security: No

Specify the name service, domain, and domain resolver ...

- Name Service -----------------------------------------------------------------
  On this screen you must provide name service information.  Select the name
  service that will be used by this system, or None if your system will either
  not use a name service at all, or if it will use a name service not listed
  here.

  > To make a selection, use the arrow keys to highlight the option
    and press Return to mark it [X].


      Name service
      ------------
      [ ] NIS+
      [ ] NIS
      [X] DNS
      [ ] LDAP
      [ ] None



- Domain Name ------------------------------------------------------------------
  On this screen you must specify the domain where this system resides.  Make
  sure you enter the name correctly including capitalization and punctuation.


    Domain name: sfbay.sun.com





- DNS Server Addresses ---------------------------------------------------------
  On this screen you must enter the IP address of your DNS server(s).  You
  must enter at least one address.  IP addresses must contain four sets of
  numbers separated by periods (for example 129.200.9.1).



    Server's IP address: 10.0.2.3
    Server's IP address:
    Server's IP address:

The value of IP address for your DNS server is copied from "/etc/resolv.conf" in the global zone. Specify DNS search list and confirm the information ...

- DNS Search List --------------------------------------------------------------
  On this screen you can enter a list of domains that will be searched when a
  DNS query is made.  If you do not enter any domains, DNS will only search
  the DNS domain chosen for this system.  The domains entered, when
  concatenated, may not be longer than 250 characters.



    Search domain:
    Search domain:
    Search domain:
    Search domain:
    Search domain:
    Search domain:




- Confirm Information ----------------------------------------------------------
  > Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.


          Name service: DNS
           Domain name: sfbay.sun.com
    Server address(es): 10.0.2.3

No need to create an address entry for the zone ...

- Name Service Error -----------------------------------------------------------
  Unable to find an address entry for zone1 with the specified DNS
  configuration.


      Enter new name service information?
      -----------------------------------
      [ ] Yes
      [X] No

Specify and confirm NFSv4 domain name ...

- NFSv4 Domain Name ------------------------------------------------------------
  NFS version 4 uses a domain name that is automatically derived from the
  system's naming services. The derived domain name is sufficient for most
  configurations. In a few cases, mounts that cross domain boundaries might
  cause files to appear to be owned by "nobody" due to the lack of a common
  domain name.

  The current NFSv4 default domain is: "sfbay.sun.com"


      NFSv4 Domain Configuration
      ----------------------------------------------
      [X] Use the NFSv4 domain derived by the system
      [ ] Specify a different NFSv4 domain



- Confirm Information for NFSv4 Domain -----------------------------------------
  > Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.


    NFSv4 Domain Name:  << Value to be derived dynamically >>

Timezone ...

- Confirm Information ----------------------------------------------------------
  > Confirm the following information.  If it is correct, press F2;
    to change any information, press F4.


    Time zone: Pacific Time
               (US/Pacific)

Specify the root password and then see the comment as:

System identification is completed.

This comment indicates successful creation of the zone.

Login to "zone1" as:

zone1 console login: root
Password:
Feb  8 16:12:10 zone1 login: ROOT LOGIN /dev/console
Sun Microsystems Inc.   SunOS 5.11      snv_101b        November 2008

Check the network configuration ...

root@zone1:~# ifconfig -a
lo0:1: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL>
mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0:1: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS>
mtu 1500 index 2
        inet 192.168.0.99 netmask ffffff00 broadcast 192.168.0.255
root@zone1:~#

After "zone1" is completely installed, then it can be viewed as:

arun@opensolaris:~$ zoneadm list -vi
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   1 zone1            running    /export/home/zone1             ipkg     shared

And then install "zone2" using the steps described above and check it's network configuration as:

root@zone2:~# ifconfig -a
lo0:2: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL>
mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0:2: flags=201000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4,CoS>
mtu 1500 index 2
        inet 192.168.0.98 netmask ffffff00 broadcast 192.168.0.255
root@zone2:~#

And it's shown in the list of zones as:

arun@opensolaris:~# zoneadm list -vi
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   1 zone1            running    /export/home/zone1             ipkg     shared
   2 zone2            running    /export/home/zone2             ipkg     shared

OK, so we installed 2 non-global zones in an Open Solaris image running as guest in Virtual Box.

Typing "~." takes you back to the global zone.

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all tips is available here.

Technorati: totd opensolaris zones containers solaris virtualbox glassfish

Tuesday Jan 13, 2009

TOTD #65: Windows 7 Beta 1 Build 7000 on Virtual Box: NetBeans + Rails + GlassFish + MySQL


Microsoft released Windows 7 Beta 1 - the next major version of Vista, download here. There are tons of improvments mostly centered around making the content easily & intuitively accessible. But hey, Mac OSX already serves that purpose well for quite some time ;-)

But I still want to make sure that our Rails stack (NetBeans, GlassFish, and MySQL) work fine on it. And it very well do, without any issues, as you'll realize at the end of this blog :)

Lets first get started with installing Windows 7 Beta as a Virtual Box image. Few points to note here:
  • Only IE can be used for downloading Windows 7 Beta, FireFox & Safari on Mac do nothing (confirmed). With a growing share of both Mac and Firefox (TODO: add a link), I think this combination needs to be at least included on their testing matrix. There was no clear way to file bugs but sent feedback using "Send Feedback" button that is omnipresent on top-right corner of each window.
  • The 64-bit Windows 7 installer do not work on Virtual Box 2.1 installed on a 64-bit MacBook Pro. So had to download the 32-bit installer instead :( This seems to be a Virtual Box bug so filed #3027.
  • The 32-bit and 64-bit files are named "7000.0.081212-1400_client_en-us_Ultimate-GB1CULFRE_EN_DVD-32bit.iso" and "7000.0.081212-1400_client_en-us_Ultimate-GB1CULXFRE_EN_DVD.iso" respectively. If you noticed the only difference is the letter "X" before "FRE" . This required a deep look to spot the difference and very non-intuitive. Frankly, I had to put the two names above each other to spot the difference ;-)
Here are my Virtual Box VM settings:


Anyway, after that the install process was pretty simple. Anybody who has previous Windows install experience can vouch the installation mostly  goes seamless, as was the case here. The complete installation using screen snapshots is shown here. Some of the snapshots from my install process are shown below:









Ta da ... after multiple boots during installation, the final welcome screen shows up as following:



Even the beta install required an activation key. The key is shown on the screen after the download. A freshly installed Windows 7 Beta shows the following disk properties:



Lets install our Rails stack.

Download JDK 6 U11 (TODO: check with or w/o NetBeans), MySQL 5.1, NetBeans 6.5 (which includes GlassFish v3 Prelude, JRuby 1.1.4, Rails 2.1, and other goodies)! Alternatively, you can also download JDK 6 U11 + NetBeans 6.5 co-bundle here.

Install them in the same order by double-clicking on the downloaded bundle and taking all default values.

First MySQL installation ...



MySQL is automatically started and registered with Windows as a service.

And then NetBeans installation ...



Because of the default access controls setup in Windows 7 (as in Vista as well), NetBeans need to be run as an administrator by right-clicking, selecting "Run as administrator". Screencast #26 shows to develop, run, and debug a Rails application on GlassFish v3 Prelude. Here are some screen snapshots as the steps outlined in that screencast are performed.

Here is a snapshot that shows how a simple Rails application can be created:



Running the Rails application on GlassFish v3 Prelude ...



And now debugging using the NetBeans IDE ...



Overall, I'm happy with the first experience of Windows 7 Beta 1. The install process was smooth and it was nice to see the picture of a fish on the welcome screen. They can even consider swapping it with a glassfish ;-)

TOTD #64 showed how to install OpenSolaris 2008/11 using Virtual Box and run the same stack there. So be it Windows 7 or Open Solaris 2008/11, you can develop, run, and debug your Rails application with pleasure using NetBeans and GlassFish. And of course, Mac OS X :)

What is your primary Operating System for development ?

Do you use any Virtualization software for trying multiple Operating Systems ? Which one ?

Technorati: totd windows windows7 virtualbox netbeans glassfish mysql rubyonrails jruby

Monday Jan 12, 2009

TOTD #64: OpenSolaris 2008/11 using Virtual Box

Here is a blog entry that was sitting in my Drafts folder for a long time (just because I didn't realize :). Anyway, it shows how to install Open Solaris 2008/11 on Virtual Box. The original install was done using Virtual Box 2.0.6. I installed Virtual Box 2.1 this morning and the image was easily recognized by the updated Virtual Box.

Here are the basic steps.


Create a new VM ...



As part of the previous step, create a new Virtual Disk mapping to the downloaded Open Solaris image ...




The generated VM settings are shown as below:



Click on "Start" and configure for the first run as:




Boot the Virtual Macine from the LiveCD shows the following GRUB:



Take the default for Language and Keyboard and then the following screen is shown after the boot:



Click on "Install OpenSolaris" ...



Clicking on "Install" starts the installation ...



And finally the install is completed.



Click on "Reboot", select "Boot from Hard Disk" and press Enter ...



And then select if "full boot" or "text boot" is required as shown:




And the welcome screen is shown as:



Now you can develop your Rails applications using the NetBeans IDE and deploy them on GlassFish and MySQL easily as explained here. There are multiple updates to the stack described earlier - JRuby 1.1.6, Rails 2.2, MySQL Alpha 6.0.x, GlassFish v3 Prelude, and Virtual Box 2.1.

So go ahead and develop, deploy, and debug your Rails applications as described in screencast #26. You can even manage your Rails applications using JMX as described in TOTD #61, #62, and #63.

Hwo do you follow the latest on each technology:

And, of course, this blog talks about all of them :)

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive of all tips is available here.

Technorati: totd opensolaris virtualbox glassfish netbeans jruby rubyonrails mysql

Monday Jun 23, 2008

JRuby-on-Rails and MySQL on GlassFish on OpenSolaris in Virtual Box VM


My primary development machine is Mac OS Leopard on Intel Core 2 Duo (read osxtips). But the beauty of virtualization is that I can run multiple Operating Systems on a single powerful machine. And what better virtualization product than Virtual Box. And  Open Solaris has crossed leaps and boundaries making installation and getting started extremely simple :)

So here is an application stack that I tried:


Rails 2.1 + My SQL 5.0.51a



JRuby 1.1.2



GlassFish v3 TP2


OpenSolaris 2008.05


Virtual Box 1.6.2



Mac OSX Leopard




Intel 2.4 G Hz Core 2 Duo

You can easily deploy your Rails applications using MySQL database on GlassFish installed on OpenSolaris in a Virtual Box VM on Mac OS Leopard running on an Intel 2 Duo processor machine. Overall a happy experience :)

The complete instructions to install OpenSolaris using Virtual Box are very useful.

Here are basic steps ...

Create a new VM (settings given in the instructions):



Once all the options are chosen, the generated VM settings are shown as below:



Booting the Virtual Machine from the Live CD shows the following GRUB:



Pick the default options (GRUB, Keyboard & Language) and then the following default screen is shown:



Read and Close the license screen. And then click on the "Install Open Solaris" icon to continue the installation process. This step is important otherwise you'll keep booting from LiveCD every time (I messed up on this few times ;).



After choosing the Region, Location & Timezone and taking other defaults, the summarized installation options are shown:



And finally the installation is complete:



After the installation is complete, shutdown the VM by either selecting "System, Shut Down..." or click on the X on the VM window and selecting "Power off the machine". Change the boot sequence order to bring "Hard Disk" at the top by clicking on "Settings", "Advanced" tab and changing the order as shown below.



And finally, you can easily deploy a Rails 2.1 application on this newly configured machine as explained in Rails 2.1 on GlassFish.  TOTD #35 explains how Rails Database connection need to be configured on Solaris.
The final output of the application looks like:




Here are some pointers for you to get started:
Did you know the 3 keywords for GlassFish v3 - Modularity (OSGi compliant), Extensiblity (non-Java apps) & Emebeddability (runs in-VM) ? Read more on GlassFish v3 main page.

Stay in touch with us by posting your questions/comments/concerns to GlassFish Web Tier Forum or webtier@glassfish.

Technorati: rubyonrails jruby ruby opensolaris virtualbox mac glassfish v3
About

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.


Java EE 7 Samples

Stay Connected

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today