Thursday Jul 30, 2009

Installing AMP stack within GlassFish Web Stack 1.5...

Now that  Sun GlassFish Web Stack 1.5 release is done, let me walk you through the steps involved in setting up your AMP (Apache 2.2, MySQL 5.1 and PHP 5.2) stack working together. One of the other cool features of Sun GlassFish Web Stack 1.5 release , besides Web Stack Enterprise Manager, is its ability to support

  • installation via native packages (SVR4 Packages for Solaris 10 and RPM for RHEL5.2). This is typically the preferred way in large enterprises. This installation will require root privileges and provides integration with Solaris 10 SMF etc.
  • installation via IPS (Image Packaging System). This installation is typically preferred by developers and in enterprises where you have access to internet to download and install binaries from internet on your production machine !. This installation does not require 'root' privileges and all files (including web server document root and MySQL data directory) is configured under your installation directory. So, you might find it very intuitive to install, use , develop and even take it with you.

 Installing Web Stack 1.5 as a native package / rpm

  • Visit our Sun Web Stack 1.5 download page and 'click on Native components (does not include java component)' link to download our native packages. If you wonder, what is "java components" in this above link . Well, we refer "java components" as components like Tomcat, Hudson, GlassFish 2.1. Since, this blog is about setting up a PHP/MySQL based web site, you can reduce your carbon foot print by avoiding those extra bulky downloads..
  • unzip the downloaded tar ball and install by running the following command (you will need root privileges)

sriramn@sriramn:~$ sudo ./install amp

Now, if you are running on Solaris 10 and don't want to install on all local zones, then you could even do some thing like

sriramn@sriramn:~#  ./install -XG amp

For more information with related to this installation, please check out our Installation Guide. Once you have completed this installation, you might want to refer to our Getting Started Guide as to how to survive with our stack. This guide should help you with basic information like where to find our configuration files, how to start/stop servers etc.

Installing Web Stack 1.5 as IPS (Update Center)

IPS (Image Packaging System) is an open source technology built on Python and is the core underlying framework on how packages are delivered within OpenSolaris. This work was initially done for OpenSolaris.  Now, as with any open source projects, another open source project - Update Center has successfully ported this work for platforms like Solaris 10 and Linux.

Now, GlassFish Web Stack 1.5 release uses this Update Center open source project to deliver a minimal Python runtime and Update Center technology as part of initial download. Then you will need to fire up the Update tool GUI to download and install components that interests you.

Unlike OS native packages, Update Center technology does not verify or warn if you do not have installed any underlying dependent libraries that Web Stack 1.5 stack requires. So, we strongly recommend you to visit our System Package dependency link to ensure that you have these packages installed on your system.

Here is a quick walk through on how to get your AMP stack up and running with this: 

  • Visit our Sun Web Stack 1.5 download web page and download 'click on IPS based Packaging' link
  • Now, you will need to unzip the downloaded tar ball and fire up the update tool GUI. You will need to download some thing like

sriramn@sriramn:~$ unzip

sriramn@sriramn:~$ cd webstack1.5

sriramn@sriramn:~/webstack1.5$ ./bin/updatetool 

(Note: You will need GUI configured or DISPLAY set properly to successfully run the above command.)

(Note: If you do not have GUI/X11 configured on your Solaris / Linux machine, then you can do some thing like below to install

from command line.)

sriramn@sriramn:~/webstack$ ./pkg/bin/pkg list  -> to list all the component available

Now, firing up the GUI, will welcome you with a nice GUI like this below

Now, you will need to click on 'Available Add-ons' to see all the Web Stack components listed (as shown below).

Note: If your company requires HTTP Proxy to be configured to access the internet, you will need to click on 'Preferences' windows and appropriately configure proxy information before proceeding any further.

Now, select Apache HTTP Server, PHP , PHP MySQL Connector, PHP APC and MySQL Community Server(5.1.30 version) components from this above list  and click on Install . You should see a confirmation window like below and if you see all the components that you need, click on 'Install' again. 

If you do not have GUI / X11 configured on your Solaris / Linux machine, then you could very well do some thing like below to install AMP stack from command line. 

sriramn@sriramn:~/webstack1.5$ ./pkg/bin/pkg list -a  -> to list all the component available

sriramn@sriramn:~/webstack1.5$ ./pkg/bin/pkg install sun-apache22 sun-php52 sun-php52-apc sun-mysql51 sun-php52-mysql -> to install and configure Apache, PHP and MySQL within your home directory.

sriramn@sriramn:~/webstack1.5$ ./bin/setup-webstack

At the end of this installation, you should have a fully configured Apache , PHP and MySQL runtime within your home directory/webstack1.5 directory.

You can now start the Apache and MySQL server by running the following command from your command line:

  sriramn@sriramn:~/webstack1.5$ ./bin/sun-apache22 start -> by default Apache should now run at port 10080

  sriramn@sriramn:~/webstack1.5$ ./bin/sun-mysql51 start -> by default MySQL server should now run at port 13306

Now, you should be able to install applications like Joomla, Drupal, MediaWiki by simply unzipping these applications under Apache document root (~/webstack1.5/var/apache2/2.2/htdocs) directory

 For example, installing applications like Joomla / Drupal or MediaWiki should simply involve going to Apache document root and unzipping the application and following through the installation process within your browser (http://localhost:10080/joomla etc)

  sriramn@sriramn:~/webstack1.5$ cd var/apache2/2.2/htdocs

  sriramn@sriramn:~/webstack1.5/var/apache2/2.2/htdocs$tar zxvf ~/tmp/joomla\*.gz

Most of the open source components are designed to be built and installed on the same machine. So, building a stack and making it run on different machine takes a bit of work but getting the same stack to be installed at multiple locations takes lots and lots of work. Well, we are doing this release for the first time and would love to hear your feedback and this took us lots and lots of effort to get it right.

You will find all our start/stop scripts under ~/webstack1.5/bin/sun-\* (or wherever you installed /bin). Similarly, you will find all the configuration files under ~/webstack1.5/etc/\* (or wherever you installed /etc). 

Hope you like what you see . If you run into issues, we encourage you to write back to us at our Forum.


Sharing what little I know


« February 2017