Sun Web Stack Installation and Configuration Guide

Sun Web Stack Installation and Configuration Guide

This document describes how to install and configure Sun Web Stack and its components on Solaris, OpenSolaris and Linux platforms.

                                        Table of Contents


Sun Web Stack Installation and Configuration Guide

Download the PDF

Introduction

Sun Web Stack is a complete open source web application platform consisting of Apache, Lighttpd, MySQL, PHP, Tomcat, Glassfish, Ruby and Python. It has robust support for B2B/B2C Applications, Web Services, CMS and Intranet applications. It also comes with support for Memory Caching framework (memcached), Dynamic Trace debugging (DTrace), Xdebug and advanced PHP security framework (Suhosin).

Sun Web Stack is available for Solaris, OpenSolaris and Red Hat Enterprise Linux.

Understanding Sun Web Stack

Sun Web Stack can be deployed in many ways. Here is one example.

Sun Web Stack Components

The table lists the primary components bundled with Sun Web Stack.

Component Name
Applicable Platform
Component Type
Component Version
Component Homepage
Apache Server
Solaris/OpenSolaris/Linux
HTTP Server
2.2.9 http://httpd.apache.org/
lighttpd Solaris/OpenSolaris/Linux 
HTTP Server
1.4.19 http://www.lighttpd.net/
Squid
Solaris/OpenSolaris/Linux 
Proxy Server
2.6.STABLE17
http://www.squid-cache.org/
MySQL
Solaris/OpenSolaris/Linux 
Database Server
5.0.67
http://www.mysql.com/
PHP Solaris/OpenSolaris/Linux 
Language
5.2.6 http://www.php.net/
Ruby Solaris/OpenSolaris
Language 1.8.6 http://www.ruby-lang.org/en/
Python Solaris
Language 2.5.2 http://www.python.org/
memcached Solaris/OpenSolaris/Linux 
Caching System
1.2.5 http://www.danga.com/memcached/
Apache Tomcat
Solaris/OpenSolaris/Linux 
Application Server
5.5.27 http://tomcat.apache.org/

Sun Web Stack Default Network Ports

Sun Web Stack utilizes several network ports by default for regular component operation. The following table lists the ports by component.

Component Default Port Number
Apache HTTP Server
80
lighttpd Web Server
80
MySQL Database Server
3306
Squid Proxy Server
3128
Apache Tomcat
8080
memcached 11211

User Permissions

In order to install Sun Web Stack, the user must be logged in as system administrator or root.

Installing Sun Web Stack

This section discusses the installation of Sun Web Stack on Solaris, OpenSolaris and Linux platforms.

Installing Sun Web Stack on Solaris and Linux Platforms

Perform following steps to install Sun Web Stack

  1. Extract the tar.gz file containing the Sun Web Stack installer.
    gunzip -c xxx.tar.gz | tar xf -
    
  2. Run the installation script to begin the installation. The list of available installer commands are shown in the following table.
Installer Commands
Description
Platform
./install -h
Displays the available options with the installer.
Solaris/Linux
./install amp
Installs the complete AMP stack, which includes Apache HTTP Server, PHP and MySQL.
Solaris/Linux
./install apache
Installs Apache HTTP Server.
Solaris/Linux
./install lighttpd
Installs lighttpd Web server.
Solaris/Linux 
./install memcached
Installs memcached memory caching system.
Solaris/Linux
./install mysql
Installs MySQL database server.
Solaris/Linux
./install php
Installs PHP language support.
Solaris/Linux
./install python
Installs Python language support.
Solaris
./install ruby
Installs Ruby language support
Solaris
./install squid
Installs Squid Proxy Server.
Solaris/Linux
./install tomcat
Installs Apache Tomcat Application Server.
Solaris/Linux

Additional Package Dependencies

Platform specific dependencies exist on Solaris and Red Hat Linux platforms. Install the dependent packages first. The following table summarize the dependencies for various Sun Web Stack components.

This is not a complete dependency list. Only important packages are listed here.

Sun Web Stack Component
Important Solaris Dependencies
Important RedHat Linux Dependencies
Sun Web Stack Installer 
SUNWPython
Python version 2.4 or higher
Apache HTTP Server
SUNWlexpt, SUNWpr, SUNWtls, SUNWlibsasl, SUNWcry, SUNWpostgr-82-libs
OpenSSL 0.9.8b or higher, OpenLDAP 2.3.27 or higher, sqlite 3.3.6 or higher, postgresql-libs 8.1.11 or higher  
lighttpd

pcre 3.1 or higher
Squid Proxy Server
SUNWgss, SUNWkrbu, SUNWlibsasl, SUNWopenssl-libraries, SUNWpr, SUNWtls, SUNWperl584core OpenSSL 0.9.8b or higher, OpenLDAP 2.3.27 or higher
MySQL
SUNWperl584core, SUNWopenssl-libraries
OpenSSL 0.9.8b or higher
PHP
SUNWpostgr-82-libs, SUNWopenssl-libraries 
OpenSSL 0.9.8b or higher, OpenLDAP 2.3.27, postgresql-libs 8.1.11 or higher, pcre 6.6 or higher, gmp    
memcached
None 
None
Apache Tomcat Server
SUNWj5rt, SUNWj5dev 
JDK 5.0 or higher

Installing Sun Web Stack on OpenSolaris Platform

For information on installing Sun Web Stack on OpenSolaris platform, see Web Stack Getting Started Guide for OpenSolaris 2008.11

Sun Web Stack File Layout

This section discusses the file layout of Sun Web Stack components on Solaris and Linux platforms. For information on the file layout on OpenSolaris, see Web Stack Getting Started Guide for OpenSolaris 2008.11 

Apache HTTP Server Files

The following list describes the file structure for Apache HTTP Server:

On Solaris
On Linux
Description
/etc/opt/webstack/apache2/2.2/httpd.conf /etc/opt/sun/webstack/apache2/2.2/httpd.conf Contains server configuration files. A newly-installed server contains a default httpd.conf file. This is the main configuration file.  
/etc/opt/webstack/apache2/2.2/conf.d /etc/opt/sun/webstack/apache2/2.2/conf.d Contains additional server configuration files. By default, server will load all the.conf files placed under this directory. It also has 2 additional.load configuration files-modules-32.load and modules-64.load which contain LoadModuledirectives for loading the 32 and 64-bit bundled apache modules respectively. All the.conf files in this directory are included by the following line in httpd.conf:
Include /etc/opt/webstack/apache2/2.2/conf.d/*.conf.
You can add the additional configuration here.
 
/etc/opt/webstack/apache2/2.2/envvars /etc/opt/sun/webstack/apache2/2.2/envvars Contains the environment settings that the server uses at startup.
When the /usr is mounted as read-only, you will not be able to modify the envvars file present in /opt/webstack/apache2/2.2/envvars. To modify the environment settings you need to edit the envvars file present in the path /etc/opt/webstack/apache2/2.2/envvars.
 
/etc/opt/webstack/apache2/2.2/magic /etc/opt/sun/webstack/apache2/2.2/magic Magic data for mod_mime_magic Apache module as documented in the /opt/webstack/apache2/2.2/manual/mod/mod_mime_magic.html file. Editing this file is not recommended.  
/etc/opt/webstack/apache2/2.2/mime.types /etc/opt/sun/webstack/apache2/2.2/mime.types Default MIME types file. This file sets the default list of mappings from filename extensions to content types, changing this file is not recommended. Use the AddType directive instead.  
/etc/opt/webstack/apache2/2.2/original/ /etc/opt/sun/webstack/apache2/2.2/original/ Contents under this directory are delivered as-is from the apache distribution and these files are not meant to be read by the server.  
/etc/opt/webstack/apache2/2.2/sample-conf.d /etc/opt/sun/webstack/apache2/2.2/sample-conf.d Contains sample .conf files. These are not included in the main configuration file. To use the sample file, copy the file to conf.d directory and modify as per the need.  
/opt/webstack/apache2/2.2/bin /opt/sun/webstack/apache2/2.2/bin Contains the 32-bit httpd(Pre-fork MPM) and httpd.worker(Worker MPM) executables as well as other utility programs.  
/opt/webstack/apache2/2.2/bin/[isainfo] /opt/sun/webstack/apache2/2.2/bin/[isainfo] Contains the 64-bit httpd (Prefork MPM) and httpd.worker (Worker MPM) executables as well as other utility programs.  
/opt/webstack/apache2/2.2/manual /opt/sun/webstack/apache2/2.2/manual Contains the Apache HTTP Server manual in HTML format.  
/opt/webstackapache2/2.2/include /opt/sun/webstackapache2/2.2/include Contains the Apache HTTP Server header files, which are needed for building various optional server extensions with apxs(8).  
/opt/webstack/apache2/2.2/libexec /opt/sun/webstack/apache2/2.2/libexec Contains 32-bit loadable modules (DSOs) supplied with the server.  
/opt/webstack/apache2/2.2/libexec/[isainfo] /opt/sun/webstack/apache2/2.2/libexec/[isainfo] Contains 64-bit loadable modules (DSOs) supplied with the server.  
/opt/webstack/apache2/2.2/man /opt/sun/webstack/apache2/2.2/man Contains man pages for the server, utility programs, and mod_perl. Add this directory to your MANPATH to read the Apache HTTP Server man pages.  
/opt/webstack/apache2/2.2/lib /opt/sun/webstack/apache2/2.2/lib Contains the 32-bit apache2 core libraries.  
/opt/webstack/apache2/2.2/lib/[isainfo] /opt/sun/webstack/apache2/2.2/lib/[isainfo] Contains the 64-bit Apache 2 core libraries.  
/opt/webstack/apache2/2.2/lib/perl /opt/sun/webstack/apache2/2.2/lib/perl Contains the 32-bit modules and library files used by the mod_perl extension to Apache HTTP Server.  
/var/opt/webstack/apache2/2.2/cgi-bin /var/opt/sun/webstack/apache2/2.2/cgi-bin Default location for the CGI scripts. This can be changed by altering the httpd.conf file and restarting the server.  
/var/opt/webstack/apache2/2.2/htdocs /var/opt/sun/webstack/apache2/2.2/htdocs Default document root. This can be changed by altering the httpd.conf file and restarting the server.  
/var/opt/webstack/apache2/2.2/icons /var/opt/sun/webstack/apache2/2.2/icons Icons used by the server.This should not be changed.  
/var/opt/webstack/apache2/2.2/libexec /var/opt/sun/webstack/apache2/2.2/libexec Place holder for 32-bit user apache modules. Any 32-bit modules which are added using apxs(8)are copied into this directory.  
/var/opt/webstack/apache2/2.2/libexec/[isainfo] /var/opt/sun/webstack/apache2/2.2/libexec/[isainfo] Place holder for 64-bit user Apache 2 modules. Any 64-bit modules which are added usingapxs(8) are copied into this directory.  
/var/opt/webstack/apache2/2.2/logs /var/opt/sun/webstack/apache2/2.2/logs Contains server log files. The formats, names, and locations of the files in this directory can be altered by various configuration directives in the httpd.conf file.  
/var/opt/webstack/apache2/2.2/proxy /var/opt/sun/webstack/apache2/2.2/proxy Directory used to cache pages if the caching feature of mod_proxy is enabled in the httpd.conf file. The location of the cache can also be changed by changing the proxy configuration in the httpd.conf file.  

Modules mod_fcgid, mod_jk,mod_security, and mod_dtrace are integrated to Apache 2. For more information about these modules, see http://fastcgi.coremail.cn/doc.htm, http://tomcat.apache.org/connectors-doc/generic_howto/quick.html, http://www.modsecurity.org/documentation/index.html, and http://prefetch.net/projects/apache_modtrace/mod_dtrace.c

MySQL Database Files

The following list describes the file structure for the MySQL Database Server.

On Solaris
On Linux
Description
/opt/webstack/mysql/5.0/bin /opt/sun/webstack/mysql/5.0/bin Contains the binaries and scripts.
/opt/webstack/mysql/5.0/lib /opt/sun/webstack/mysql/5.0/lib Contains the libraries for the client API.
/opt/webstack/mysql/5.0/include /opt/sun/webstack/mysql/5.0/include 
Contains the header files for the client API.
/opt/webstack/mysql/5.0/man/man1 /opt/sun/webstack/mysql/5.0/man/man1 Manual pages for client programs.
/opt/webstack/mysql/5.0/man/man8 /opt/sun/webstack/mysql/5.0/man/man8 Manual pages for server programs.
/opt/webstack/mysql/5.0/share /opt/sun/webstack/mysql/5.0/share 
Shared data: locale, time zone.
/opt/webstack/mysql/5.0/docs /opt/sun/webstack/mysql/5.0/docs Contains HTML documentation.
/opt/webstack/mysql/5.0/mysql-test /opt/sun/webstack/mysql/5.0/mysql-test Contains MySQL test programs.
/opt/webstack/mysql/5.0/sql-bench /opt/sun/webstack/mysql/5.0/sql-bench SQL benchmark test.
/opt/webstack/mysql/5.0/share/mysql /opt/sun/webstack/mysql/5.0/share/mysql Contains internationalization (I18N) files, sample configuration files, and utility scripts.
/var/opt/webstack/mysql/5.0/data /var/opt/sun/webstack/mysql/5.0/data Default database data directory.
/etc/opt/webstack/mysql/5.0 /etc/opt/sun/webstack/mysql/5.0 Contains the MySQL configuration file.
/opt/webstack/mysql/5.0/bin/mysql /opt/sun/webstack/mysql/5.0/bin/mysql Client executable.
/opt/webstack/mysql/5.0/bin/mysqld /opt/sun/webstack/mysql/5.0/bin/mysqld
Server executable.

PHP Files

The following list describes the file structure for PHP:

On Solaris
On Linux
Description
/opt/webstack/php5/5.2/bin /opt/sun/webstack/php/5.2/bin Contains the PHP configuration executables.
/opt/webstack/php5/5.2/lib /opt/sun/webstack/php/5.2/lib Contains PHP library files.
/opt/webstack/php5/5.2/modules /opt/sun/webstack/php/5.2/modules Contains PHP modules for PHP extensions.
/opt/webstack/apache2/2.2/libexec /opt/sun/webstack/apache2/2.2/libexec Contains the PHP module for Apache 2 (32-bit) prefork MPM and the module name ismod_php5.so.
/opt/webstack/php/5.2 /opt/sun/webstack/php/5.2 Contains the default configuration file (php.ini).
/etc/opt/webstack/php/5.2/conf.d /etc/opt/sun/webstack/php/5.2/conf.d Contains extension specific INI files for each PHP extension . Here, you can enable or disable various extensions that are integrated with the package.
Note
The PHP extensions like APC, DTrace, XDebug, suhosin, and{{ tcpwrap}} are disabled by default. To enable these extensions, you need to uncomment the respective line (extensions=<module-name>.so) in theconf.d file.

Ruby Files

The following list describes the file structure for Ruby:

On Solaris
On Linux
Description
/var/opt/webstack/ruby/1.8/gem_home /var/opt/sun/webstack/ruby/1.8/gem_home Contains the Ruby gems repository.
/opt/webstack/ruby/1.8/bin /opt/sun/webstack/ruby/1.8/bin Contains the Ruby executable as well as other utility programs, and Ruby gems programs. These programs are linked from /usr/bin

Squid Proxy Server Files

The following list describes the file structure for Squid Proxy Server:

On Solaris
On Linux
Description
/opt/webstack/squid/bin /opt/sun/webstack/squid/bin Contains the executable for the Squid Proxy Server client and to run the cache.
/opt/webstack/squid/libexec /opt/sun/webstack/squid/libexec Contains the libraries.
/etc/opt/webstack/squid/squid.conf /etc/opt/sun/webstack/squid/squid.conf The main configuration file. Modify this file for Squid Proxy Server to work.

Extending Sun Web Stack

Sun Web Stack can be easily extended using by using various third party extensions. This enables you to add new features to the existing software.

Installing PHP extensions

PHP extensions are available in two forms, PECL (PHP Extension Community Library) and PEAR (PHP Extension and Application Repository). PECL extensions are shipped as C source code. PECL extensions are compiled C language extensions linked to the PHP core. As C programs , PECL extensions run more efficiently than PEAR packages. PECL includes modules for XML-parsing, access to additional databases, mail-parsing, embedding Perl or Python in PHP scripts.

A PEAR package is distributed as a gzipped tar file. Each archive consists of source code written in PHP, usually in an object-oriented style. Many PEAR packages can readily be used by developers as ordinary third party code via simple include statements in PHP.

Installing PECL extensions

The PECL extensions need to be compiled to shared object files (.so) before they can be used with PHP. To compile PECL extensions you need to have mandatory development packages installed on your system. You can install Sun Studio for this purpose. Sun Studio software delivers a optimizing C and C++ developer toolchain for Solaris, OpenSolaris and Linux platforms. More information on Sun Studio is available at http://developers.sun.com/sunstudio/.

After installing Sun Studio, run the following command to download, compile and install the PECL extension:

On Solaris:

 # /opt/webstack/bin/pecl install <extension name>

On Linux:

 # /opt/sun/webstack/bin/pecl install <extension name>

On OpenSolaris:

#  /usr/bin/pecl install <extension name>

If you are not sure of the extension name, use the following command to get a list of all the available extensions:

On Solaris:

$  /opt/webstack/bin/pecl list-all

On Linux:

 # /opt/sun/webstack/bin/pecl install <extension name>

On OpenSolaris:

$ /usr/bin/pecl list-all

Installing PEAR extensions

Run the following command to download and install the PEAR extension:

On Solaris:

# /opt/webstack/bin/pear install <extension name>

On Linux:

 # /opt/sun/webstack/bin/pear install <extension name>

On OpenSolaris

# /usr/bin/pear install <extension name>

Installing Python extensions

Python extensions are supported through Easy Install. Easy Install is a python module (easy_install) bundled with setuptools that lets you automatically download, build, install, and manage Python packages. easy_install is capable of downloading and installing python extensions from PyPI (Python Package Index) repository.

Installing setuptools (easy_install)

Use the following commands to download and install setuptools. You need have Sun Studio installed in your system to compile setuptools package. Also, verify that Sun Web Stack location is present in the system PATH variable. This will avoid any conflict with the existing installation of python.

  1. Download and extract the python setuptools source package from http://pypi.python.org/pypi/setuptools#downloads. Download the tar.gz file (setuptools-0.6c9.tar.gz).
  2. Run the following command to compile and install the setuptools package. 
# python setup.py install

Using easy_install

easy_install is very easy to use. Just use the following command to download and install the python extension.

# python easy_install.py <package name>

You can browse through the PyPI repository by visting http://pypi.python.org/pypi 

Installing Ruby extensions (RubyGems)

Ruby extensions are supported by RubyGems. RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them.

Use the following command to install the ruby extension (gem). Make sure that you have Sun Web Stack in PATH variable.

# gem install <gem name>

If you are not sure of gem name, use the following command to get a list of all the available gems:

# gem list -r -d

Advanced Configuration

Sun Web Stack can take advantage of Solaris OS specific features like Solaris Zones and DTrace. For more information, see:

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Dec 16, 2008

    not-me-guv says:

    Suggestion: a section 6.4 on installing Apache extensions. "Apache extensions a...

    Suggestion: a section 6.4 on installing Apache extensions.

    "Apache extensions are called modules, and a wide range of third-party modules are available, in addition to those included in the web stack. Some modules may be packaged for installation, but many supply source code only. The apxs tool will compile and install the latter:

    Compile source:
    # apxs -cia mod_foo.c

    Here the c flag compiles the source, the i flag installs it, and the a flag adds it to your configuration, so the new module will be activated next time you restart apache. For more details, see http://httpd.apache.org/docs/2.2/programs/apxs.html.

    You can check what modules are active using "httpd -M".

    1. Dec 17, 2008

      kunaldeo says:

      Yeah that would be nice. I will add that one.

      Yeah that would be nice. I will add that one.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Sun Microsystems community and they might not be employed or in any way formally affiliated with Sun Microsystems. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Sun nor any other party necessarily agrees with them.

Copyright 1994-2009 Sun Microsystems, Inc.
Powered by Atlassian Confluence
Sun Guidelines on Public Discourse Privacy Policy Terms of Use Trademarks Site Map Employment Investor Relations Contact