Creating New Zones in Solaris 10⚓︎
- Login and sudo to system
-
list the zones :
Bash 1
zoneadm list –vc
-
Create the new directory under /zones and give the same name of the new zone and change permissions to root access only.
Bash 1 2 3
cd /zones mkdir testZone2 chmod 700
-
Now configure and create new Zone.
Bash Session 1 2 3 4 5 6 7 8
zonecfg -z testZone2 zonecfg:testZone2> create zonecfg:testZone2> set zonepath=/zones/testZone2 zonecfg:testZone2> set autoboot=false zonecfg:testZone2> add net zonecfg:testZone2:net> set address=172.1.1.1/24 zonecfg:testZone2:net> set physical=bge0 zonecfg:testZone2:net> end
-
Modify the inherit-pkg-dir
Add inherited directories as needed, may not be needed.
Bash Session 1 2 3
zonecfg:testZone2> add inherit-pkg-dir zonecfg:testZone2:inherit-pkg-dir> set dir=/usr/local/bin zonecfg:testZone2:inherit-pkg-dir> end
-
Check the configuration
Bash Session 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
zonecfg:testZone2> info zonename: testZone2 zonepath: /zones/testZone2 brand: native autoboot: false bootargs: pool: limitpriv: scheduling-class: ip-type: shared inherit-pkg-dir: dir: /lib inherit-pkg-dir: dir: /platform inherit-pkg-dir: dir: /sbin inherit-pkg-dir: dir: /usr inherit-pkg-dir: dir: /usr/local/bin net: address: 172.18.177.228 physical: bge0
-
Verify the configuration
Bash Session 1
zonecfg:testZone2> verify
-
Commit the configuration
Bash Session 1 2
zonecfg:testZone2>commit zonecfg:testZone2>exit
-
Check the Zone is configured.
Bash 1
zoneadm list –vc
-
Create Zone.
Bash 1
zoneadm -z testZone2 install
-
Before boot the new Zone make sure to copy the sysidcfg file from jumphost.company.com
- scp the file from jumphost.company.com:/ jumpstart/OS/Solaris_10_u5/sysidcfg
- mv the file sysidcfg to /zones/testZone2/root/etc
-
Boot the newZone
Bash 1
zoneadm -z testZone2 boot
-
Login into Zone Console
Bash 1
zlogin -C -e \@ testZone2
This screen asks a few questions. 1. Setup hostname, and asks for confirmation. 2. Name Service information. Select the name service that will be used by this system. 3. Rebooting system to allow for changes to apply. 4. Login in as root and check the zone.
-
Exit out of Console
Text Only 1
@.
-
Check the zone is running
Bash 1
zoneadm list –vc
-
Halting the Zone
Bash 1
zoneadm -z testZone2 halt
-
Set up DNS for the Zone
Bash 1 2 3
cd /etc vi resolv.conf cp nsswitch.dns nsswitch.conf
-
Copy passwd, shadow, and groups files as needed
-
Copy home directories, you may need to create /home
Bash 1
mkdir –p /home
-
Create any application specific annotations and adjustments to the zone.
-
As root, turn off unneeded services:
Bash 1 2 3 4
svcadm disable finger svcadm disable telnet svcadm disable rlogin svcadm disable /network/shell:default