So you’ve downloaded Solaris 11 Express and you want to try out this awesome new Zones feature. Zones is Solaris’ powerful virtualization environment and it has been around since Solaris 10 but things change slightly between editions. In this tutorial we are going to create a very simple, basic zone and go from new install of Solaris 11 to a working Zone that you can access remotely via SSH. If you don’t have a dedicated machine on which to run Solaris 11, don’t fret, you can do Zones virtualization on top of another virtualization environment. In my case, I am running Solaris 11 on Oracle’s VirtualBox and then running Zones on top of there.
To get started, we need to create a ZFS mountpoint as Zones now relies on ZFS. I like using the /zones mountpoint as it is pretty common and very straightforward. You can, of course, use any mountpoint that you would like – /vm or /images are popular alternatives. You can use different features, such as compression and deduplication as you feel are applicable for you as well.
zfs create -o mountpoint=/zones -o compression=on -o dedup=on rpool/zones
This should create your mountpoint. Now we can begin configuring our first Zone. For our example, we will simply call it myzone. We will assume that we are on the 192.168.123.o/24 subnet and will add a single network interface that bridges onto this network. This is a very simple example. You could do many more advanced things with Zones.
zonecfg -z myzone
Once we run this command we will be dropped into the zonecfg configuration utility which we will use to set features for our zone. First we will configure the location where the Zone files will be stored. Generally we want to name this the same as our zone to avoid any confusion.
Now we can set our networking to share a connection with the base Solaris environment. This is the most common scenario.
Now we can add in a network connection. For this we will need to know the name of the physical connection used in the base Solaris installation. On my system this is called “e1000g0”. I will statically set this new server to be 192.168.123.5/24.
And that is all that we need for a basic configuration. Now we just need to verify and commit these settings and we are ready to being.
If all has gone well, we can now install and boot our new Zone for the very first time.
zoneadm -z myzone install
zoneadm -z myzone boot
Excellent, we already have a Zone up and running. Now to enable SSH so that we can reach the machine remotely.
zlogin myzone “svcadm enable ssh”
zlogin myzone “svcadm restart ssh”
To complete the setup of our Zone it will be necessary to log at the console. This will allow you to step through the setup process as well as to add a user with which you can connect over SSH since the root user is banned from logging in remotely.
zlogin -C myzone