Today I setup a zone on my OpenSolaris box (snv_123) to host a webstack.
Apache2, MySql, PHP, are the applications which make up the "AMP" webstack.
AMP is installed on the global zone via the amp package (pkg:/amp@0.5.11-0.123).
Because sparse zones can share static program files such as /usr, /lib, etc (not /etc).
The zone will have its own /etc and /var where all the individualized configuration data is held.
Zones FAQ
zonecfg is used to configure a zone, then zoneadm to install, and zlogin to use it (initially):
Zones Setup
That blog covers that part fairly well.
The slightly tricky part was starting the servers. Although the server files are present in the /usr shared with the global zone, the SMF manifests are not imported like they were in the global zone during the pkg install.
Manifest files can be found in the global zone, in /var/svc/manifest/
The rest of the path corresponds with the service URI.
For example: Apache2 (v2.2) has a service URI of: svc:/network/http:apache22
It's manifest file is /var/svc/manifest/network/http-apache22.xml
MySQL has a service URI of svc:/application/database/mysql:version_51
It's manifest file is at /var/svc/manifest/application/database/mysql_51.xml
These are the 2 manifests needed for the AMP stack (the P, PHP is a module of apache, not an independent service so it doesn't have a service manifest).
From there;
svcadm enable mysql
svcadm enable http
There will be additional configuration required, but from there installing it in the zone is the same as if it were the global zone. You can google for instructions on configuring the servers, or better still, read the logs in /var/svc/logs to see what the problem is.
If you have already got AMP working in the global zone, you may save yourself some time copying
/etc/mysql/
/var/mysql/
/etc/apache2/
/var/apache2/
/etc/php
With all the configurations into the zone (at the same paths). Theres also some chowning involved for mysql. You can temporarily make a folder in the global zone's /usr as a stepping stone to transfer files into the zone. Its messy, to remember to delete the folder after, and nothing else.
Zones are cool. They have the security and separation of VMs, without all the overhead of another OS (disk usage of the image, processing and RAM usage at run time).
You need to be a member of Open Source University Meetup to add comments!
Join this social network