Wednesday Dec 10, 2008

OpenSolaris 2008.11: How to create a new zone for an Apache web server

For those of you that want to install a web server in an OpenSolaris 2008.11 zone (e.g. for separating a web server from a file server while using the same hardware), here's a short howto. The procedure is a bit different from previous OpenSolaris releases as the zone files are not immediately available after the zone is installed - might have something to do with the new ipkg zone brand. The zone installation is now much faster than before. Here's how I got it installed:

  1. Create a parent zfs filesystem for the zone's root, if it does not yet exist:
    $ zfs create -o mountpoint=/zones rpool/zones

  2. Create a zone configuration file:
    $ cat > /var/tmp/webserv-z.cfg
    create
    set zonepath=/zones/webserv-z
    set autoboot=true
    add net
    set address=192.168.0.20/24
    set physical=ADAPTER
    set defrouter=192.168.0.1
    end
    verify
    commit
    exit
    
    Please replace ADAPTER by the name of your network adapter (can be seen in the output of ifconfig -a | nawk '!/\^[\\t]/&&!/lo/{gsub (":", "");print $1}' or just ifconfig -a, for example). In my case, it was sfe0 on one system and bge0 on another.
    Then, configure the new zone:
    $ zonecfg -z webserv-z -f /var/tmp/webserv-z.cfg
  3. Install the new zone:
    $ zoneadm -z webserv-z install
    A ZFS file system has been created for this zone.
      Authority: Using http://pkg.opensolaris.org/release/.
          Image: Preparing at /zones/webserv-z/root ...
          Cache: Using /var/pkg/download.
     Installing: (output follows)
    Refreshing Catalog 1/1 opensolaris.org
    Creating Plan /                        
    DOWNLOAD                                    PKGS       FILES     XFER (MB)
    SUNWPython                                  6/52    213/7862    1.71/72.41 
    Completed                                  52/52   7862/7862   72.41/72.41 
    
    PHASE                                        ACTIONS
    Install Phase                             3637/12939 
    
    
  4. Wait! Before booting the zone, mount it first:
    zoneadm -z webserv-z mount

  5. Create a configuration file with the name sysidcfg (for sample files and a detailed explanation on the syntax, see: this link on http://docs.sun.com) in directory /zones/webserv-z/root/etc so you don't have to go through all the configuration screens after connecting to the new zone the first time:
    $ cat > /zones/webserv-z/root/etc/sysidcfg
    system_locale=C
    timezone=Europe/Berlin
    terminal=xterms
    security_policy=NONE
    timeserver=localhost
    root_password=PASSWD_STRING
    name_service=dns {domain_name=DOMAIN.TLD
       name_server=DNS_IP_ADDR_1,DNS_IP_ADDR_2
       search=DOMAIN.TLD
    }
    network_interface=primary {hostname=webserv-z
       ip_address=192.168.0.20
       netmask=255.255.255.0
       protocol_ipv6=yes
       default_route=192.168.0.1
    }
    nfs4_domain=dynamic
    

    Before proceeding, please replace the placeholders DOMAIN.TLD, DNS_IP_ADDR_1, and DNS_IP_ADDR_2 by the names or addresses of your choice! For PASSWD_STRING (root_password parameter), you may use the old (short) password string from a Solaris 10 /etc/shadow file. If you do not use the root_password parameter in the sysidcfg file, you will be asked for the root password during initial zone boot.

  6. Wait! Before booting the zone, unmount it first:
    zoneadm -z webserv-z unmount

  7. Now you can boot the zone:
    $ zoneadm -z webserv-z boot

  8. Log in to the zone:
    root@soly:/# zlogin -C webserv-z
    [Connected to zone 'webserv-z' console]
    Loading smf(5) service descriptions: 27/68
    ...
    68/68
    Reading ZFS config: done.
    Mounting ZFS filesystems: (5/5)
    Creating new rsa public/private host key pair
    Creating new dsa public/private host key pair
    Configuring network interface addresses: sfe0.
    
    After a while, a series of screens will be displayed which ask you to select missing system configuration information. Use the <F2> key or <esc> 2 to go from one screen to the next. After that, a login prompt will be displayed, and you can login to the newly created zone:
    webserv-z console login: root
    Password: 
    Dec  8 10:12:14 webserv-z login: ROOT LOGIN /dev/console
    Sun Microsystems Inc.   SunOS 5.11      snv_101b        November 2008
    
    The output of the df -k command should display the following file systems (probably with slightly different values in the "used" column and totally different values in the "avail" column (depends on your disk and swap space size):

    root@webserv-z:~# df -k
    Filesystem            kbytes    used   avail capacity  Mounted on
    /                          0  240451 186876163     1%    /
    /dev                       0       0       0     0%    /dev
    proc                       0       0       0     0%    /proc
    ctfs                       0       0       0     0%    /system/contract
    mnttab                     0       0       0     0%    /etc/mnttab
    objfs                      0       0       0     0%    /system/object
    swap                  775608     196  775412     1%    /etc/svc/volatile
    /usr/lib/libc/libc_hwcap1.so.1
                         187116614  240451 186876163     1%    /lib/libc.so.1
    fd                         0       0       0     0%    /dev/fd
    swap                  775412       0  775412     0%    /tmp
    swap                  775420       8  775412     1%    /var/run
    root@webserv-z:~# 
    
  9. Install Apache and prerequisites in the local zone:
    $ pkg install SUNWapch22
    root@webserv-z:~# pkg install SUNWapch22
    Refreshing Catalog 1/1 opensolaris.org
    Creating Plan \\                        
    DOWNLOAD                                    PKGS       FILES     XFER (MB)
    SUNWapch22                                   0/4      0/1342     0.00/5.85
    SUNWperl584core                              3/4    913/1342     4.21/5.85 
    
  10. Start the web server:
    root@webserv-z:~# svcadm enable apache22

  11. Point your browser to http://webserv-z or http://192.168.0.20 and see the first web page!
    Now you can change the file /var/apache2/2.2/htdocs/index.html according to your needs and watch the web page changing after reloading it in the browser!

Note: If you need to clean up the configuration, I suggest using the following commands:
$ zoneadm -z webserv-z uninstall -F
$ zonecfg -z webserv-z delete -F
$ zfs destroy -r rpool/zones

Be careful! These commands perform uninstall, delete or destroy actions without confirmation!. The zfs destroy command shown will also destroy all other zfs file systems that were created for other zones with zone root path starting with /zones!

OpenSolaris 2008.11 is out - try it!

Why? Because of: Security, Package Manager, ZFS Time Slider, ZFS, Zones, integrated CIFS and NFS file server, and more.

Who? Everyone that needs a robust and secure operating system with some really unique features and a growing community. For example: for safe web surfing without having to install a virus scanner, for creating office documents, for building a flexible multimedia file server or for programming.

Where to download? http://www.opensolaris.org/os/downloads/. On the right, under "Quick Download Links", click on OpenSolaris 2008.11 to download the image. You can then burn a bootable CD from it, install it on your internal or external hard disk or on a USB stick, or use it as a bootable image in VirtualBox.

What else?

OpenSolaris 2008.11 launch today - you will be surprised

Please read this and this page, and this and this after 09:00 PDT today...

Thursday Dec 04, 2008

Try out the new, improved DSC!

Those of you who have not yet loaded http://docs.sun.com into your browser, please do so now and I'm sure you'll notice many of the improvements since the the last version.

Navigation and loading of pages appears to be much faster than before, and I also like the layout better. Thanks to everyone who made that possible!

Tuesday Dec 02, 2008

Getting rid of "Close Firefox - Firefox is already running, but is not responding"

How to run several Firefox 3 instances on Solaris[Read More]

Friday Nov 28, 2008

Firefox for Solaris now directly available from the Free Download link!

Downloading Firefox for Solaris is now easier than ever before![Read More]

Thursday Nov 27, 2008

Firefox for Solaris - latest versions as of Nov. 2008

These are the direct links for downloading the latest versions of Firefox for Solaris:

Versionx86SPARC
Firefox 3.0.4 OpenSolaris pkg  |  tar pkg  |  tar
Firefox 3.0.4 Solaris 10 pkg  |  tar pkg  |  tar
Firefox 2.0.0.18 Solaris 10 pkg  |  tar pkg  |  tar
Firefox 2.0.0.18 Solaris 8 pkg  |  tar pkg  |  tar

Thursday Feb 07, 2008

Solaris Express Developer Edition 1/08 released!

Why to download and install the new SXDE 1/08[Read More]

Tuesday Jan 15, 2008

Creating (and deleting) a lot of zones

A sample session of the zone-clone and delete-cloned-zones scripts:[Read More]

How to create a lot of zones (and delete them afterwards)

Click here to see the full text:[Read More]

Tuesday Aug 28, 2007

Good news for Sun

Looks like more and more customers see Solaris and our T2000 and other Niagara Chip based systems as a real alternative to servers with high single thread performance running other operating systems for their web applications. This is where our Startup Essentials program can help a lot. Read this report about a company that had been using Linux only and now has successfully started using Solaris on T2000.

Solaris will make the transition from other operating systems even more easy in the future, with more GNU tools integrated, more hardware drivers, better installation and administration experience, and more. If you haven't tried it, just download and install it on one of your PCs at home!

Wednesday Apr 11, 2007

Solaris 10 How-To Guides!

See this for some very good how-to guides on various Solaris 10 administration topics.

Wednesday Apr 04, 2007

Thinking out of the box: Project EcoBox unveiled on April 1st, 2007!

Great news: Sun has unveiled Project EcoBox. A great place to work!


Details here:

http://www.openwork3.com
http://www.youtube.com/watch?v=iSuLMhTnuMc

Thursday Mar 15, 2007

Creating a bootable Solaris DVD with Solaris Nevada 59 on my old Dell GX110

How to create a bootable Solaris DVD using Solaris Nevada on a Dell GX110 PC[Read More]

Friday Mar 02, 2007

Firefox and the middle mouse button

How to disable the middle mouse button's contentLoadURL feature[Read More]

Thursday Dec 28, 2006

Multibooting Solaris, Ubuntu, and Windows XP

Short HOWTO on multibooting Solaris, Ubuntu Linux, and Windows XP, installed on one hard disk. Installation order was Solaris Express, Windows XP, and Ubuntu Linux.[Read More]
About

blogfinger

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today