| h1. Sun
GlassFish
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.
|
|
{section}
|
|
{column:width=35%}
|
... {panel:borderColor=#236B8E|bgColor=#ffffff} {color:black}{*}Table of Contents{*}{color}
---- *Sun Web Stack Installation and Configuration Guide* {toc:outline=true|indent=20px|style=none|minLevel=2} {panel} {column} {column}
{panel:borderStyle=none|bgColor=#ffffff}
{panel} {column} {section}
[*Download the PDF*|http://dlc.sun.com/pdf/820-6719/820-6719.pdf]
h2. 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.
|
| h2. Understanding Sun
GlassFish
Web Stack |
Sun Web Stack can be deployed in many ways. Here is one example. !UnderStanding_WebStack.png|align=center!
|
| h3. Sun
GlassFish
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.11
2.2.9
| [http://httpd.apache.org/|http://httpd.apache.org/] | |
| | lighttpd | Solaris/OpenSolaris/Linux \\ | HTTP Server\\ |
1.4.21
1.4.19
| [http://www.lighttpd.net/|http://www.lighttpd.net/] | |
| | Squid\\ | Solaris/OpenSolaris/Linux \\ | Proxy Server\\ |
2.7.STABLE6\\
2.6.STABLE17 \\
| [http://www.squid-cache.org/|http://www.squid-cache.org/] | |
| | MySQL \\ | Solaris/OpenSolaris/Linux \\ | Database Server\\ |
5.1.30\\
5.0.67 \\
| [http://www.mysql.com/|http://www.mysql.com/] | |
| | PHP | Solaris/OpenSolaris/Linux \\ | Language \\ |
5.2.96
| [http://www.php.net/|http://www.php.net/] | |
| | Ruby | Solaris/OpenSolaris \\ | Language |
1.8.76
| [http://www.ruby-lang.org/en/|http://www.ruby-lang.org/en/] | |
| | Python | Solaris \\ | Language |
2.6.1
2.5.2
| [http://www.python.org/|http://www.python.org/] | |
| | memcached | Solaris/OpenSolaris/Linux \\ | Caching System\\ | 1.2.5 | [http://www.danga.com/memcached/|http://www.danga.com/memcached/] | |
| | Apache Tomcat\\ | Solaris/OpenSolaris/Linux \\ | Application Server\\ |
6.0.18
5.5.27
| [http://tomcat.apache.org/|http://tomcat.apache.org/] | |
| Sun GlassFish Web Stack Enterprise \\ Manager\\ | Solaris/Linux\\ | Administration Tool\\ | 1.5\\ | [http://www.sun.com/software/solaris/amp/|http://www.sun.com/software/solaris/amp/|http://www.sun.com/software/solaris/amp/]\\ | |
| |
| h3. Sun
GlassFish
Web Stack Default Network Ports |
| |
| Sun
GlassFish
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\\ |
h2. User Permissions
|
In order to install Sun Web Stack, the user must be logged in as system administrator or root.
|
| h2. Installing Sun
GlassFish
Web Stack |
| |
| This section discusses the installation of Sun
GlassFish
Web Stack on Solaris, OpenSolaris and Linux platforms. |
| |
| h3. Installing Sun
GlassFish
Web Stack on Solaris and Linux Platforms |
| |
| Perform following steps to install Sun
GlassFish
Web Stack |
| # Extract the tar.gz file containing the Sun
GlassFish
Web Stack installer. |
{code} gunzip -c xxx.tar.gz | tar xf - |
... {code} # 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 |
|
h4. 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
GlassFish
Web Stack components. |
{quote} This is not a complete dependency list. Only important packages are listed here. {quote} |
| || Sun
GlassFish
Web Stack Component \\ || Important Solaris Dependencies \\ || Important RedHat Linux Dependencies || |
| | Sun
GlassFish
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 \\ |
|
| h3. Installing Sun
GlassFish
Web Stack on OpenSolaris Platform |
| |
| For information on installing Sun
GlassFish
Web Stack on OpenSolaris platform, see [Web Stack Getting Started Guide for OpenSolaris 2008.11|Web Stack Getting Started Guide] |
| |
| h2. Sun
GlassFish
Web Stack File Layout |
| |
| This section discusses the file layout of Sun
GlassFish
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|http://wikis.sun.com/display/WebStack/Web+Stack+Getting+Started+Guide#WebStackGettingStartedGuide-FileLayoutofWebStackComponents] |
h3. 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 {{LoadModule{}}}directives 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]
h3. MySQL Database Files
|
The following list describes the file structure for the MySQL Database Server. || On Solaris\\ || On Linux \\ || Description || |
| |
/opt/webstack/mysql/5.10/bin
| /opt/sun/webstack/mysql/5.0/bin | Contains the binaries and scripts. | |
| |
/opt/webstack/mysql/5.10/lib
| /opt/sun/webstack/mysql/5.0/lib | Contains the libraries for the client API. | |
| |
/opt/webstack/mysql/5.10/include
| /opt/sun/webstack/mysql/5.0/include \\ | Contains the header files for the client API. | |
| |
/opt/webstack/mysql/5.10/man/man1
| /opt/sun/webstack/mysql/5.0/man/man1 | Manual pages for client programs. | |
| |
/opt/webstack/mysql/5.10/man/man8
| /opt/sun/webstack/mysql/5.0/man/man8 | Manual pages for server programs. | |
| |
/opt/webstack/mysql/5.10/share
| /opt/sun/webstack/mysql/5.0/share \\ | Shared data: locale, time zone. | |
| |
/opt/webstack/mysql/5.10/docs
| /opt/sun/webstack/mysql/5.0/docs | Contains HTML documentation. | |
| |
/opt/webstack/mysql/5.10/mysql-test
| /opt/sun/webstack/mysql/5.0/mysql-test | Contains MySQL test programs. | |
| |
/opt/webstack/mysql/5.10/sql-bench
| /opt/sun/webstack/mysql/5.0/sql-bench | SQL benchmark test. | |
| |
/opt/webstack/mysql/5.10/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.10/data
| /var/opt/sun/webstack/mysql/5.0/data | Default database data directory. | |
| |
/etc/opt/webstack/mysql/5.10
| /etc/opt/sun/webstack/mysql/5.0 | Contains the MySQL configuration file. | |
| |
/opt/webstack/mysql/5.10/bin/mysql
| /opt/sun/webstack/mysql/5.0/bin/mysql | Client executable. | |
| |
/opt/webstack/mysql/5.10/bin/mysqld
| /opt/sun/webstack/mysql/5.0/bin/mysqld \\ | Server executable. | |
h3. 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:title=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 the{{{}conf.d}} file. {note}
h3. 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}}. |
h3. 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. |
|
| h2. Extending Sun
GlassFish
Web Stack |
| |
| Sun
GlassFish
Web Stack can be easily extended using by using various third party extensions. This enables you to add new features to the existing software. |
h3. 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.
h4. 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/|http://developers.sun.com/sunstudio/].
After installing Sun Studio, run the following command to download, compile and install the PECL extension:
On Solaris: {code} # /opt/webstack/bin/pecl install <extension name> {code} On Linux: {code} # /opt/sun/webstack/bin/pecl install <extension name> {code} On OpenSolaris: {code} # /usr/bin/pecl install <extension name> {code} If you are not sure of the extension name, use the following command to get a list of all the available extensions:
On Solaris: {code} $ /opt/webstack/bin/pecl list-all {code} On Linux: {code} # /opt/sun/webstack/bin/pecl install <extension name> {code} On OpenSolaris: {code} $ /usr/bin/pecl list-all {code}
h4. Installing PEAR extensions
Run the following command to download and install the PEAR extension:
On Solaris: {code} # /opt/webstack/bin/pear install <extension name> {code} On Linux: {code} # /opt/sun/webstack/bin/pear install <extension name> {code} On OpenSolaris {code} # /usr/bin/pear install <extension name> {code}
h3. 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.
|
h4. 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
GlassFish
Web Stack location is present in the system PATH variable. This will avoid any conflict with the existing installation of python. |
# 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). # Run the following command to compile and install the setuptools package. |
... {code} # python setup.py install {code}
h4. Using easy_install
easy_install is very easy to use. Just use the following command to download and install the python extension. {code} # python easy_install.py <package name> {code} You can browse through the PyPI repository by visting [http://pypi.python.org/pypi|http://pypi.python.org/pypi]
h3. 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
GlassFish
Web Stack in PATH variable. |
{code} # gem install <gem name> |
... {code} If you are not sure of gem name, use the following command to get a list of all the available gems: {code} # gem list -r -d {code}
|
h2. Advanced Configuration
|
| Sun
GlassFish
Web Stack can take advantage of Solaris OS specific features like Solaris Zones and DTrace. For more information, see: |
| * [Using Memcached with Solaris Zones |http://wikis.sun.com/display/WebStack/Memcached+On+Zones] |
| * [DTrace and Sun
GlassFish
Web Stack |http://wikis.sun.com/display/WebStack/DTrace+and+Web+Stack] |