All proceeds from Ad Clicks goes to the author of this site.

 

Saturday, February 19, 2005

Quick zone + webserver

The 5 step process to having a web server up in a zone. In less than 30 minutes.

Step 1: configure the zone Time 2 minutes.

# zonecfg -z 3

zonecfg:3> create

zonecfg:3> set zonepath=/opt/zones/3

zonecfg:3> add net

zonecfg:3:net> set physical=hme0

zonecfg:3:net> set address=192.168.2.153

zonecfg:3:net> end

zonecfg:3> add inherit-pkg-dir

zonecfg:3:inherit-pkg-dir> set dir=/opt

zonecfg:3:inherit-pkg-dir> end

zonecfg:3> verify

zonecfg:3> commit

zonecfg:3>

Step 2: install packages on the zone Time 24 minutes. On my ultra 2.

# zoneadm -z 3 install

Preparing to install zone <3>.

Creating list of files to copy from the global zone.

Copying <2416> files to the zone.

Initializing zone product registry.

Determining zone package initialization order.

Preparing to initialize <1324> packages on the zone.

Initialized <1324> packages on zone.

Zone <3> is initialized.

The file contains a log of the zone installation.

#

Step 3: Configure the locale and nameservice and timezone of the zone

Time 3 minutes.

#zoneadm –z 3 boot

#zlogin –C 3

[ install script enter data that suits your enviromemnt]

Step 4: Configure and turn on apache2 Time 1 minute

edit /etc/apache2/http.conf

# Solaris Quick Configuration Information

#

# 1. Set ServerName if necessary (default is 127.0.0.1)

# 2. Set ServerAdmin to a valid email address

turn on apache2

svcadm -v enable /network/http:apache2

Step 5... put your html files in /var/apache2/htdocs

Closing notes:

Who ever said that basic security is hard, never used Solaris 10, i'm sure some of the ipf gurus can give me a 5 lines that would add a firewall to the zone that would make it even more secure. But i will leave that as an exercise of the users.

If there is enough demand I will do a part two that covers enabling php and a firewall in the zone.

4 Comments:

Blogger Edward Salonia said...

A follow-up would be nice. Thanks for this article too.

1:13 AM  
Anonymous Fred S. said...

Thank you for writing this article,it's good.

I assume that subsequent boots of zone 3 have apache running within it and this happens because you're logged into zone 3 when the svcadm command is issued. Or,am I missing something here?

11:11 AM  
Blogger jamesd_wi said...

Yes the next time I boot zone 3 it will have apache2 running in it. I should have added the following to the zonecfg file.

set autoboot=true

then each time the OS is started it will automaticly boot zone 3.

SMF takes care of starting services you specify. And it will restart them should they die.

If you need a service that is not included in Solarsi 10 you can check out my Zone manifest repository

11:57 AM  
Anonymous Anonymous said...

Thanks for posting this how to document. This is great. -Bill

9:51 AM  

Post a Comment

<< Home