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 Note: Man pages can be obtained by installing SUNWman Next Steps: Boot the zone, then log into the zone console |
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, Host name for e1000g0:1 zone1 - Confirm Information for e1000g0:1 ——————————————– 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 – 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 Name service – 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 ——————————————————— Server’s IP address: 10.0.2.3 |
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: – Confirm Information ———————————————————- Name service: DNS |
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? |
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 – 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 |
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
Related posts:- TOTD #64: OpenSolaris 2008/11 using Virtual Box
- TOTD #35: Rails Database Connection on Solaris
- GlassFish Beanie, Open Solaris CD, Cool shirts, 2 GB SD Card – Goodies at Sun booth in #eclipsecon
- TOTD #65: Windows 7 Beta 1 Build 7000 on Virtual Box: NetBeans + Rails + GlassFish + MySQL
- TOTD #119: Telnet to GlassFish v3 with NetBeans 6.8 – “Could not open connection to the host”