This
tutorial will help you, how to create an Oracle
Solaris Zone, install an application in that zone, and clone the zone. This article will also help you to get familiar with the basic operations of Solaris 11
Zone configuration and management.
Overview of the Environment We Will Implement
In
this how-to guide, I will set up three Oracle Solaris Zones, one to host an
environment for developers (devzone) and two to host Web applications
(webappzone1 and webappzone2).
Each zone will highlight a simple
feature of getting started with zones:
- With devzone, we'll see how to create a zone using the command line.
- With webappzone1, we'll see how to add an application to a zone.
- With webappzone2, we'll see how to clone a zone.
After
following the procedures in this tutorial, you will have three zone
environments configured as shown in image below. Each zone will have its file
system placed on the /zones ZFS data set and will have an exclusive network
connection through the physical data link (network port net1). The Web app
zones will also have the Apache Web server application.

Three Zones Accessing a Network Port
with Their File Systems on /zones
Note: "Global zone" refers to the default zone for the
system, which is also used for system-wide administrative control.
Now that we understand what we are
trying to do, we will go through the steps for achieving our goal.
Following image shows the settings
we will use.
Creating Your First Zone: devzone
This tutorial concentrates on the
tasks that are necessary to get Oracle Solaris Zone instances up and running
quickly.
Before We Start
Check the status of both the ZFS file system and the network:
root@labsrv:~# zfs list | grep zones
root@labsrv:~# dladm show-link
LINK
CLASS MTU STATE
OVER
net1
phys 1500 unknown
--
net0
phys 1500 up
--
Step 1: Configure an Oracle Solaris Zone
Let's start by creating a simple test zone using the command line.
root@labsrv:~# zonecfg -z devzone
Use 'create' to begin configuring a new zone.
zonecfg:devzone> create
create: Using system default template 'SYSdefault'
zonecfg:devzone> create
create: Using system default template 'SYSdefault'
zonecfg:devzone> set zonepath=/zones/devzone
zonecfg:devzone> set autoboot=true
zonecfg:devzone> set bootargs="-m verbose"
zonecfg:devzone> verify
zonecfg:devzone> commit
zonecfg:devzone> exit
In
this case, we have named the zone devzone and we have chosen /zones/devzone as
the location under which the zone will be installed. Also, the zone will
automatically start on boot in a verbose manner. We do this so that we don't
have to start the zone manually after a system reboot and so we can see all the
services start up.
By
default, all Oracle Solaris Zones are configured to have an automatic VNIC
called anet, which gives us a network device automatically. We cannot see this
network device yet, because it is automatically created when the zone is booted
and also automatically destroyed on shutdown. We can check this with the dladm
command:
root@labsrv:~# dladm show-link
LINK
CLASS MTU STATE
OVER
net1
phys 1500 unknown
--
net0
phys 1500 up
--
root@labsrv:~# zoneadm list -cv
ID NAME STATUS PATH BRAND IP
0 global running / solaris shared
- devzone configured /zones/devzone solaris excl
Step 2: Install the Zone
Now that the zone has been configured, we need to install it.It is important to understand that Oracle Solaris Zones in Oracle Solaris 11 are created by using the IPS feature. You will need to ensure you have access to your IPS repository. In this case, we have network access to our IPS repository.
root@labsrv:~# zoneadm -z devzone install
The following ZFS file system(s) have been created:
rpool/zones
rpool/zones/devzone
Progress being logged to
/var/log/zones/zoneadm.20130828T045714Z.devzone.instal
l
Image:
Preparing at /zones/devzone/root.
AI Manifest:
/tmp/manifest.xml.qFaOde
SC Profile:
/usr/share/auto_install/sc_profiles/enable_sci.xml
Zonename: devzone
Installation: Starting ...
Creating
IPS image
Startup linked: 1/1 done
Installing packages from:
solaris
origin: http://172.22.2.10/
DOWNLOAD PKGS
FILES XFER (MB) SPEED
Completed 183/183 33556/33556
222.2/222.2 221k/s
PHASE ITEMS
Installing new actions 46825/46825
Updating package state database Done
Updating image state Done
Creating fast lookup database Done
Installation: Succeeded
Note: Man
pages can be obtained by installing pkg:/system/manual
done.
Done:
Installation completed in 160 seconds.
Next Steps: Boot the
zone, then log into the zone console (zlogin -C)
to
complete the configuration process.
Log saved in non-global zone as
/zones/devzone/root/var/log/zones/zoneadm.20130
828T045714Z.devzone.install
The zone was installed in just 160 seconds. This is very quick when compared with other virtualization technologies and reflects the lightweight nature of Oracle Solaris Zones.
We can check on the status of our zone using the zoneadm command:
root@labsrv:~# zoneadm list -iv
ID NAME STATUS PATH BRAND IP
0 global running / solaris shared
- devzone installed /zones/devzone solaris excl
The
zonepath must live on a ZFS data set, and it is created automatically when the
zone is installed. You can check that by using the zfs command.
root@labsrv:~# zfs list |grep zones
rpool/zones 414M 73.9G
32K /zones
rpool/zones/devzone 414M 73.9G
32K /zones/devzone
rpool/zones/devzone/rpool 414M 73.9G
31K /rpool
rpool/zones/devzone/rpool/ROOT 414M 73.9G
31K legacy
rpool/zones/devzone/rpool/ROOT/solaris 414M
73.9G 390M /zones/devzone/root
rpool/zones/devzone/rpool/ROOT/solaris/var 24.2M
73.9G 23.7M /zones/devzone/root/var
rpool/zones/devzone/rpool/VARSHARE 31K
73.9G 31K /var/share
rpool/zones/devzone/rpool/export 62K 73.9G
31K /export
rpool/zones/devzone/rpool/export/home 31K
73.9G 31K /export/home
You can see the /zones and /zones/devzone
data sets have been created automatically for you. Having Oracle Solaris Zones
on a ZFS data set enables functionality, such as cloning and snapshots, and
allows Oracle Solaris Zones to take full advantage of ZFS.
Note: The size of devzone is only 414 MB. Oracle Solaris Zones
have a minimal footprint, reflecting how lightweight Oracle Solaris Zones are
as a virtualization technology.
Step 3: Boot and Complete the System Configuration
The final step in getting devzone up and running is to boot it and set up the system configuration.
1. Run
the following command to boot the zone and then access its console:
root@labsrv:~# zoneadm -z devzone boot; zlogin -C devzone
Note: The -C option to zlogin lets us access the zone console, that is, it takes us into the zone and lets us work within the zone.
Because
no system configuration files are available, the System Configuration Tool
starts up, as shown in image below.
2.
Press F2 to continue.
3.
Enter devzone as the computer name,
as shown in image, highlight manually to manually configure the network, and
then press F2 to continue.
Note: We do not select "Automatically" in this
example, but if you were to select it, you would not have to enter any network
information at all, because the configuration would be done for you.
4.
Enter the network settings
appropriate for your network, as shown in image, and then press F2.
5.
We will not configure DNS at this
time, so press F2.
6.
We will not set up a name service at
this time, so press F2.
7.
Select the time zone region
appropriate for your location, as shown in image, and press F2.
8.
Select the appropriate location, as
shown in image, and then press F2.
9.
Select the appropriate time zone, as
shown in image, and then press F2.
10. Complete your configuration by
entering a root password, your name, a user name, and a user password, as shown
in image. Then press F2.
11.
Verify that the configuration you
have chosen is correct and apply the settings by pressing F2.
The zone will continue booting and
soon you will see the console login, as shown in following.
SC profile successfully generated.
Exiting System Configuration Tool.
Log is available at:
/system/volatile/sysconfig/sysconfig.log.3786
[ system/system-log:default starting
(system log) ]
[ network/smtp:sendmail starting
(sendmail SMTP mail transfer agent) ]
[ system/auditd:default starting
(Solaris audit daemon) ]
[ network/sendmail-client:default
starting (sendmail SMTP client queue runner) ]
[ system/console-login:default
starting (Console login) ]
devzone console login:
The zone is now ready to be logged
into. For this example, we will now exit the console using the "~."
escape sequence.
You can check that your zone is
booted and running by using the zoneadm command:
[Connection
to zone 'devzone' console closed]
^[root@labsrv:~#
root@labsrv:~#
zoneadm list -v
ID NAME STATUS PATH BRAND IP
0 global running / solaris
shared
1 devzone running /zones/devzone solaris excl
As promised, a VNIC was
automatically created for us when the zone was booted. We can check this by
using the dladm command:
root@labsrv:~#
dladm show-link
LINK CLASS MTU
STATE OVER
net1 phys 1500
unknown --
net0 phys 1500
up --
devzone/net0 vnic 1500
up net0
We can see the VNIC listed as
devzone/net0.
Step 4: Log In to Your Zone
The last step is to log in to your
zone and have a look about. You can do this from the global zone using the
zlogin command, as shown in following.
root@labsrv:~#
zlogin devzone
[Connected
to zone 'devzone' pts/3]
root@devzone:~#
uname -a
SunOS
devzone 5.11 11.1 i86pc i386 i86pc
root@devzone:~#
ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok
127.0.0.1/8
net0/v4 static ok
172.22.2.11/24
lo0/v6 static ok
::1/128
net0/v6 addrconf ok fe80::8:20ff:fe2f:f01e/10
root@devzone:~#
dladm show-link
LINK CLASS MTU
STATE OVER
net0 vnic 1500
up ?
root@devzone:~#
zfs list
NAME USED AVAIL
REFER MOUNTPOINT
rpool 445M 73.8G
31K /rpool
rpool/ROOT 445M 73.8G
31K legacy
rpool/ROOT/solaris 445M
73.8G 416M /
rpool/ROOT/solaris/var 24.3M
73.8G 23.8M /var
rpool/VARSHARE 39K 73.8G
39K /var/share
rpool/export 96.5K 73.8G
32K /export
rpool/export/home 64.5K 73.8G
32K /export/home
rpool/export/home/muhammad 32.5K
73.8G 32.5K /export/home/Muhammad
root@devzone:~#
exit
logout
[Connection
to zone 'devzone' pts/3 closed]
Note: We did not
use the -C option for the zlogin command, which means we are not accessing the
zone via its console. This is why we can simply exit the shell at the end to leave
the zone.
Let's look at what we found:
- The uname command shows that we are running on Oracle Solaris 11.
- The ipadm command shows the IP addresses for devzone. There are four entries, two loopback devices (IPv4 and IPv6), our IPv4 net0 device with an IP address of 172.22.2.11, and finally an IPv6 net0 device.
- The dladm command shows our automatically created net0 VNIC.
- The zfs list command shows us our ZFS data set.
Note: From within devzone, we cannot see any information about
the global zone. We can see only the attributes of our own zone.
You have now verified that devzone
is up and running. You can give the user logins and passwords to the
development team's administrator, allowing that administrator to complete the
setup of the team's zone as if it were a single system.
Oracle Solaris Zones and Networking
New in Oracle Solaris 11, Oracle Solaris Zones are now automatically created with an exclusive IP network resource by default. This means that an Oracle Solaris Zone has access to a complete network stack, allowing zone administrators to do such things as set their own IP address and routing.
When we used zonecfg to create devzone
(in Step1: Configure an
Oracle Solaris Zone) using the default template, a
network resource called anet with the following properties was automatically
included in the zone configuration:
- linkname is net0
- lower-link is auto
- mac-address is random
- link-protection is mac-nospoof
We can see this by using the zonecfg
command, as shown in following.
root@labsrv:~#
zonecfg -z devzone info
zonename:
devzone
zonepath:
/zones/devzone
brand:
solaris
autoboot:
true
bootargs: -m verbose
file-mac-profile:
pool:
limitpriv:
scheduling-class:
ip-type:
exclusive
hostid:
fs-allowed:
anet:
linkname: net0
lower-link: auto
allowed-address not specified
configure-allowed-address: true
defrouter not specified
allowed-dhcp-cids not specified
link-protection: mac-nospoof
mac-address: random
auto-mac-address: 2:8:20:2f:f0:1e
mac-prefix not specified
mac-slot not specified
vlan-id not specified
priority not specified
rxrings not specified
txrings not specified
mtu not specified
maxbw not specified
rxfanout not specified
vsi-typeid not specified
vsi-vers not specified
vsi-mgrid not specified
etsbw-lcl not specified
cos not specified
pkey not specified
linkmode not specified
You can see that the anet network
device has been automatically configured. As discussed earlier, this resource
is created and destroyed automatically when the zone is booted and shut down,
respectively. You can see this as follows.
First, check the IP address of your
global zone:
root@labsrv:~#
ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok
127.0.0.1/8
net0/v4 static ok
172.22.2.10/24
Use
dladm
to look at the
data link status:
root@labsrv:~#
dladm show-link
LINK CLASS MTU
STATE OVER
net1 phys 1500
unknown --
net0 phys 1500
up --
devzone/net0 vnic 1500
up net0
Note how a VNIC attached to net0 (devzone/net0)
has been automatically created for devzone.
Log in to devzone, checking the link
status and IP address and then ping the global zone, as shown in following.
root@labsrv:~#
zlogin devzone
[Connected
to zone 'devzone' pts/3]
root@devzone:~#
dladm show-link
LINK CLASS MTU
STATE OVER
net0 vnic 1500
up ?
root@devzone:~#
ipadm show-addr
ADDROBJ TYPE STATE ADDR
lo0/v4 static ok
127.0.0.1/8
net0/v4 static ok
172.22.2.11/24
lo0/v6 static ok
::1/128
net0/v6 addrconf ok fe80::8:20ff:fe2f:f01e/10
root@devzone:~#
ping 172.22.2.10
172.22.2.10
is alive
root@devzone:~#
exit
logout
[Connection
to zone 'devzone' pts/3 closed]
Creating webappzone1
and
Adding an Application
Now let's create our second zone, webappzone1, for our Web applications and
add an application to it.
Step 1: Create webappzone1
with Minimum Information
Again we start by creating
webappzone1 using zonecfg. However, this time, to demonstrate how quick and
easy it is to set up a zone, we will supply the minimum required information,
the zonepath:
root@labsrv:~#
zonecfg -z webappzone1 "create ; set zonepath=/zones/webappzone1"
You can see the zone configuration
by using the zonecfg command, as shown in following.
root@labsrv:~#
zonecfg -z webappzone1 info
zonename:
webappzone1
zonepath:
/zones/webappzone1
brand:
solaris
autoboot:
false
bootargs:
file-mac-profile:
pool:
limitpriv:
scheduling-class:
ip-type:
exclusive
hostid:
fs-allowed:
anet:
linkname: net0
lower-link: auto
allowed-address not specified
configure-allowed-address: true
defrouter not specified
allowed-dhcp-cids not specified
link-protection: mac-nospoof
mac-address: random
mac-prefix not specified
mac-slot not specified
vlan-id not specified
priority not specified
rxrings not specified
txrings not specified
mtu not specified
maxbw not specified
rxfanout not specified
vsi-typeid not specified
vsi-vers not specified
vsi-mgrid not specified
etsbw-lcl not specified
cos not specified
pkey not specified
linkmode not specified
That's it. As far as configuration,
we are done.
Step 2: Install webappzone1
Next we install the zone, as shown in following.
root@labsrv:~#
zoneadm -z webappzone1 install
The
following ZFS file system(s) have been created:
rpool/zones/webappzone1
Progress
being logged to /var/log/zones/zoneadm.20130828T071920Z.webappzone1.install
Image: Preparing at
/zones/webappzone1/root.
AI Manifest: /tmp/manifest.xml.LGa4el
SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
Zonename: webappzone1
Installation:
Starting ...
Creating IPS image
Startup
linked: 1/1 done
Installing packages from:
solaris
origin: http://172.22.2.10/
DOWNLOAD PKGS FILES XFER (MB)
SPEED
Completed 183/183 33556/33556
222.2/222.2 741k/s
PHASE ITEMS
Installing
new actions 46825/46825
Updating
package state database
Done
Updating
image state
Done
Creating
fast lookup database
Done
Installation:
Succeeded
Note: Man pages can be obtained by
installing pkg:/system/manual
done.
Done: Installation completed in 160.257
seconds.
Next Steps: Boot the zone, then log into the
zone console (zlogin -C)
to complete the configuration
process.
Log
saved in non-global zone as /zones/webappzone1/root/var/log/zones/zoneadm.201
Step 3: Boot and Configure webappzone1
Boot webappzone1, log in to the
console, and enter the same settings as we did for devzone except for the IP
address. Set the IP address to 172.22.2.12.
root@labsrv:~# zoneadm -z webappzone1 boot; zlogin -C webappzone1
Refer back to Step 3: Boot and Complete the System Configuration if you are unsure of the steps. At the end, remember to
exit from the console using the "~." escape sequence.
Adding an Application to webappzone1
Now that we have a running zone that
is connected to the network, we want to put an application in it. In this case,
because this is going to be a zone that serves our Web content, let's add the
Apache Web server.
From the global zone, log in to
webappzone1 and check the status of the Apache Web server package:
root@labsrv:~#
zlogin webappzone1
[Connected
to zone 'webappzone1' pts/3]
Oracle
Corporation SunOS 5.11 11.1
September 2012
root@webappzone1:~#
pkg info /web/server/apache-22
pkg:
info: no packages matching the following patterns you specified are
installed
on the system. Try specifying -r to
query remotely:
/web/server/apache-22
The package is not installed. Let's
double-check by querying remotely against the IPS repository using the -r
option, as shown in following.
root@webappzone1:~#
pkg info -r /web/server/apache-22
Name: web/server/apache-22
Summary: Apache Web Server V2.2
Description: The Apache HTTP Server Version
2.2
Category: Web Services/Application and
Web Servers
State: Not installed
Publisher: solaris
Version: 2.2.22
Build Release: 5.11
Branch: 0.175.1.0.0.24.0
Packaging
Date: September 4, 2012 05:50:58 PM
Size: 9.15 MB
FMRI:
pkg://solaris/web/server/apache-22@2.2.22,5.11-0.175.1.0.0.24.0:20120904T175058Z
The state is shown as Not installed.
So let's install the Apache Web server into our zone, as shown in following.
Installing the Apache Web Server Package
root@webappzone1:~#
pkg install /web/server/apache-22
Packages to install: 7
Create boot environment: No
Create
backup boot environment: No
Services to change: 1
DOWNLOAD PKGS FILES XFER (MB)
SPEED
Completed 7/7 665/665 8.7/8.7 58.7k/s
PHASE ITEMS
Installing
new actions 916/916
Updating
package state database Done
Updating
image state
Done
Creating
fast lookup database
Done
We
see that IPS downloads all the related files we need. There is no need to
figure out the dependencies. In this case, three packages were installed. We
can check the status of the Apache Web server by using the pkg info command
again, as shown in following.
root@webappzone1:~# pkg info /web/server/apache-22
Name:
web/server/apache-22
Summary: Apache
Web Server V2.2
Description: The
Apache HTTP Server Version 2.2
Category: Web
Services/Application and Web Servers
State:
Installed
Publisher:
solaris
Version: 2.2.22
Build Release: 5.11
Branch:
0.175.1.0.0.24.0
Packaging Date: September
4, 2012 05:50:58 PM
Size: 9.15
MB
FMRI:
pkg://solaris/web/server/apache-22@2.2.22,5.11-0.175.1.0.0.24.0:20120904T175058Z
This
time, the state is shown as Installed. Congratulations; you have added your
first package to a zone.
Creating webappzone2
Using a Clone
Now let's create the final zone, webappzone2. We
could just repeat the process that we used to create the other zones, but in
this case, we simply want another Web server environment just like webappzone1.
Instead of having to duplicate the configuration process, let's make a clone of
webzoneapp1. We are effectively using webappzone1 as a global master for zone
creation.
Step 1: Create a Zone System Configuration Template
To avoid having to manually configure the system properties of our cloned zone, let's first create a system ID template for webappzone2. We can do this by using the sysconfig tool from within webappzone1:
root@labsrv:~# zlogin webappzone1
[Connected to zone 'webappzone1' pts/3]
root@webappzone1:~# sysconfig create-profile -o
/root/webappzone2-template.xml
SC profile successfully generated.
Exiting System Configuration Tool. Log is available at:
/system/volatile/sysconfig/sysconfig.log.8359
Note: When using the sysconfig tool to create a profile, make sure
you use the .xml extension in your output file name.
Go
through the screens entering the correct information for webappzone2 (remember
to use 172.22.2.13 as the IP address this time). As in the Step 3: Boot and Complete the System Configuration section, when the configuration has been completed, you will
see that your configuration file has been created. Finally, log out back to the
global zone.
root@webappzone1:~# ls
webappzone2-template.xml
root@webappzone1:~# exit
logout
[Connection to zone 'webappzone1' pts/3 closed]
Note: When using the sysconfig tool, you are not allowed to use
any existing user names in the user account section. In our case, we could not
use the user name jamal so we chose asif instead.
We'll copy this file to a more
convenient location in a later step.
Step 2: Create the Zone Profile File
From the global zone on our system, we first need to halt webappzone1, the zone we want to clone. (You should not clone a running zone.) We use zoneadm list to verify that the zone is shut down, as shown in followingVerifying the Zone is Shut Down.
root@labsrv:~# zoneadm list -iv
ID NAME STATUS PATH BRAND IP
0 global running / solaris shared
1 devzone running /zones/devzone solaris excl
2 webappzone1 running
/zones/webappzone1
solaris excl
root@labsrv:~# zoneadm -z webappzone1 shutdown
root@labsrv:~# zoneadm list -iv
ID NAME STATUS PATH BRAND IP
0 global running / solaris shared
1 devzone running /zones/devzone solaris excl
- webappzone1 installed
/zones/webappzone1
solaris excl
Now
let's capture the configuration of the zone and use it as a master profile
template for other zones we will create, in this case, webappzone2:
root@labsrv:~# zonecfg -z webappzone1 export -f /zones/webappzone2-profile
Using
your favorite editor, make the file read as shown in following. (You always
need to update the zonepath, but we have also chosen to update autoboot.)
Editing the Template
root@labsrv:~# cat /zones/webappzone2-profile
create -b
set brand=solaris
set zonepath=/zones/webappzone2
set autoboot=true
set ip-type=exclusive
add anet
set linkname=net0
set lower-link=auto
set configure-allowed-address=true
set link-protection=mac-nospoof
set mac-address=random
end
We now
want to place the system configuration template (webappzone2-template.xml) we
created earlier in a more convenient location. Fortunately, you can access a
zone's file system while it is shut down:
root@labsrv:~# pwd
/root
root@labsrv:~# cp /zones/webappzone1/root/root/webappzone2-template.xml
/zones
root@labsrv:~# ls /zones/webappzone2-template.xml
/zones/webappzone2-template.xml
Step 3: Create webappzone2
by Cloning webappzone1
Next create webappzone2 using the modified
configuration (by using zonecfg), and then perform the clone of webappzone1 (by
using zoneadm). Remember to add the full path to the system config template.
Note how quickly the clone is completed. (We can see this by prepending the time
command to our zonecfg clone command.)
root@labsrv:~# zonecfg -z webappzone2 -f
/zones/webappzone2-profile
root@labsrv:~# time zoneadm -z webappzone2 clone -c
/zones/webappzone2-template.xml webappzone1
The following ZFS file system(s) have been created:
rpool/zones/webappzone2
Progress being logged to /var/log/zones/zoneadm.20130828T081633Z.webappzone2.clone
Log saved in non-global zone as
/zones/webappzone2/root/var/log/zones/zoneadm.20130828T081633Z.webappzone2.clone
real 0m26.292s
user 0m4.122s
sys 0m7.142s
The
cloning of webappzone1 took only 26 seconds. In addition, because we used the
clone command, we took advantage of a ZFS snapshot. Let's check the disk space
taken by both webappzone1 and webappzone2, as shown in following.
Checking Disk Space
root@labsrv:/zones# zfs list | grep webappzone
rpool/zones/webappzone1 471M 73.4G
33K /zones/webappzone1
rpool/zones/webappzone1/rpool 470M 73.4G
31K /rpool
rpool/zones/webappzone1/rpool/ROOT 470M 73.4G
31K legacy
rpool/zones/webappzone1/rpool/ROOT/solaris 470M
73.4G 434M /zones/webappzone1/root
rpool/zones/webappzone1/rpool/ROOT/solaris/var 30.0M
73.4G 24.6M /zones/webappzone1/root/var
rpool/zones/webappzone1/rpool/VARSHARE 39K 73.4G
39K /var/share
rpool/zones/webappzone1/rpool/export 96.5K 73.4G
32K /export
rpool/zones/webappzone1/rpool/export/home 64.5K
73.4G 32K /export/home
rpool/zones/webappzone1/rpool/export/home/jamal 32.5K
73.4G 32.5K /export/home/jamal
rpool/zones/webappzone2 372K 73.4G
34K /zones/webappzone2
rpool/zones/webappzone2/rpool 338K 73.4G
31K /rpool
rpool/zones/webappzone2/rpool/ROOT 316K 73.4G
31K legacy
rpool/zones/webappzone2/rpool/ROOT/solaris-0 314K
73.4G 434M /zones/webappzone2/root
rpool/zones/webappzone2/rpool/ROOT/solaris-0/var 46.5K
73.4G 24.6M /zones/webappzone2/root/var
rpool/zones/webappzone2/rpool/VARSHARE 1K 73.4G
39K /var/share
rpool/zones/webappzone2/rpool/export 3K 73.4G
32K /export
rpool/zones/webappzone2/rpool/export/home 2K
73.4G 32K /export/home
rpool/zones/webappzone2/rpool/export/home/jamal 1K
73.4G 32.5K /export/home/jamal
Even
after we added the Apache Web server, webappzone1 is only 470 M. Even better,
webappzone2, an exact copy of webappzone1, is only 338 K, providing a great
savings on disk space.
Finally,
boot webappzone2 and watch the console. Occasionally, you will see the system
configuration being applied. You can see below that the host name has been set
for us from the template.
root@labsrv:/# zoneadm -z webappzone2 boot; zlogin -C
webappzone2
[Connected to zone 'webappzone2' console]
SunOS Release 5.11 Version 11.1 64-bit
Copyright (c) 1983, 2012, Oracle and/or its affiliates. All
rights reserved.
Hostname: unknown
Hostname: webappzone2
webappzone2 console login:
Note that we now have a .xml
template for webappzone2. We could very easily copy and edit this template to
allow us to deploy a whole set of other Web zones just as quickly.
Now log in to webappzone2 and look
for the Apache Web server package, as shown in following.
Looking for the Apache Web Server Package
root@labsrv:/# zlogin webappzone2
[Connected to zone 'webappzone2' pts/3]
Oracle Corporation
SunOS 5.11 11.1 September 2012
root@webappzone2:~# pkg info /web/server/apache-22
Name:
web/server/apache-22
Summary: Apache
Web Server V2.2
Description: The
Apache HTTP Server Version 2.2
Category: Web
Services/Application and Web Servers
State:
Installed
Publisher:
solaris
Version: 2.2.22
Build Release: 5.11
Branch:
0.175.1.0.0.24.0
Packaging Date: September
4, 2012 05:50:58 PM
Size: 9.15 MB
FMRI:
pkg://solaris/web/server/apache-22@2.2.22,5.11-0.175.1.0.0.24.0:20120904T175058Z
As
you can see, unlike before, when we created a zone from scratch, the Apache Web
server package that we had to add to webappzone1 is here already. This cloning
method is frequently used when a "master" zone is created with all
the additional packages and configuration in place. The master zone is then
simply cloned as new, similar environments are required.
We
can also check that the IP address was applied correctly:
root@webappzone2:~# ipadm show-addr
ADDROBJ
TYPE STATE ADDR
lo0/v4
static ok 127.0.0.1/8
net0/v4
static ok 172.22.2.13/24
lo0/v6
static ok ::1/128
net0/v6
addrconf ok
fe80::8:20ff:fee2:533d/10
Note: The Oracle Solaris Automated Installer also provides a
method for creating ready-made zones as part of the system install service.
I am new to Solaris and zones ,this helped however a question is that If I have Solaris 10 do I need to install ZFS initially during installation or UFS will work ?
ReplyDeleteBR
praveen
Well this guide is specifically for Solaris 11 but if you have Solaris 10 you can still configure zones on UFS but there is another article for Solaris 10 zone. You can search from search box or click on Solaris to see all Solaris related posts and then go for Solaris 10 zones.
Delete