Thursday Jul 03, 2008

With recently released  auto-deploy feature within Sun Web Server 7 Update 3 , deploying Java Web Applications has become a lot easier than ever. Now, you can do so by simply copying the war  files to auto-deploy directory within a server instance. I wanted to verify this with the latest version of Struts (2.0.11.2) and Web Server 7 Update 3 to see if it actually works and it did work seamlessly !!!.

Here is what I did :

- Install Sun Web Server 7 Update 3 (for free)

- Download the latest version of Struts from here  to your temporary location (say /tmp) .

- Copy the Struts sample war files to <install-root>/https-<hostname>/auto-deploy directory .You can try out by copying a sample war file  like struts2-showcase-2.0.11.2.war from your <download directory>/struts*/apps directory into <web server 7 install root>/https-<hostname>/auto-deploy directory as shown below


- Finally, start the Web Server 7 by doing some thing like <install-root>/https-<hostname>/bin/startserv

- Now, you can access your web application  by accessing http://<hostname>/struts2-showcase-2.0.11.2  in your browser


Wednesday Jul 02, 2008

One of the advantages of using  OpenSolaris 2008.05 based distribution is that  you can very easily upgrade to the latest bleeding edge changes that is happening within Open Solaris projects.  - thanks to IPS based repository updates. So, if you would like to try out these bleeding edge developments , then you might want to subscribe to opensolaris-announce  mailing alias to know about the latest OS updates available. Accordingly, this blog describes as to how simple is to upgrade to build 91 within OpenSolaris 2008.05.

So, what excites me with OpenSolaris 2008.05 (build 91) is that I can now mount an ISO image (DVD or CD) in a single command and the mount(1M) command will automatically figure out that it is an ISO image and will use lofiadm(1M) command in the back end and mount accordingly.

For example, I can now mount an ISO image in OpenSolaris by doing something like

pfexec pkg /usr/sbin/mount -F hsfs -o ro  /export/home/sriramn/solarisdvd.iso /mnt

Af course, for a Linux guy - he is used to ´loop'  mount options all along to mount stuffs like this. Finally, I am glad that now this is possible within  OpenSolaris as well.

Tuesday Jul 01, 2008

  Today, we will tackle the tricky thing on how to compile or build  SFW within OpenSolaris 2008.05 . Now, if you wonder as to what is SFW - SFW stands for  Sun Freeware components - mother of all third party open source components like Apache, PHP, MySQL, PostgreSQL currently available in OpenSolaris.

So, you might wonder as to why I need build the whole load rather than just building what I want like the way we used to do in Linux. Well, the way developers build open source components in Linux is

  • download the specific source rpm of the components that we are interested in
  • build them using 'rpm -b' .

Unfortunately, OpenSolaris build system has not been updated to do this yet. Hence, we are still struck with building a whole lot even if users just wanted to compile MySQL say - with a debug build. On the positive note, engineers working within OpenSolaris does seem to recognize the importance of this and hopefully a change can be seen very shortly.

Till then, hope, you would like my quick write up - that I had to on my system -  to get SFW build going. Building SFW components on OpenSolaris 2008.05 distribution - in my opinion - is a 2 step process

  • Download and install the necessary dependent components
  • Setup and configure your system so that SFW build can complete successfully.

Download / Install dependent components:

  • If you haven't already, you might want to download and install OpenSolaris 2008.05 from LiveCD
  • Next, download and install the necessary  gcc and java packages from OpenSolaris pkg repository by doing something like
    •  pfexec pkg refresh --full
    • pfexec pkg install  pkg:/SUNWipkg-AT-0.5.11-0-DOT-91  -> this command is optional and will download the latest pkg - (something equivalent like apt-get or yum on Linux) updates from OpenSolaris repository. At the time of writing, build 91 is the latest. If you are already running on latest update , you can safely ignore this command.
    • Now, let us install the missing but necessary development tools like GCC, Java , bison, flex etc
    • pfexec pkg install  gcc-dev  amp-dev  java-dev
    • pfexec pkg install SUNWscp SUNWgnu-idn   SUNWlibevent  SUNWugenu
    • pfexec pkg install SUNWbison  SUNWflexruntime   SUNWflexlex  SUNWtoo 
    • pfexec pkg install SUNWgmake  SUNWaconf   SUNWlibtool
    • pfexec pkg install SUNWgm4  SUNWgnu-automake-110  
    • pfexec pkg install SUNWsqlite3 SUNWpysqlite
    • pfexec pkg install  SUNWlibopenusb
    • pfexec pkg install SUNWgnome-base-libs-java  SUNWgnome-common-devel 
    • pfexec pkg install SUNWxorg-headers SUNWGlib  SUNWxwinc 
  • Once, we have successfully downloaded all these binaries, we will need to install this manual hack (hopefully for time being)
    • pfexec ln -sf /usr/bin/automake-1.10 /usr/bin/automake
    • pfexec ln -sf /usr/jdk/instances/jdk1.6.0 /usr/jdk/instances/jdk1.5.0

  • SFW build process still requires Sun Studio 11. To simplify , we will simply download the  pre-install image of Sun Studio compiler rather than following another installation. the Note: You will need to provide a Sun developer user account to download this tar ball. Let us assume that you have downloaded to /tmp directory. Unpack the downloaded archive into the /opt directory as shown with the below commands:
    • cd /opt
    • bzcat /tmp/sunstudio11-ii-DATE-PLATFORM.tar.bz2 | pfexec /bin/tar -xf -
  • Now, we will need to download SUNWonbld package. Let us unpack this download ON specific build tool to /tmp and install as shown below
    • cd /tmp
    • bunzip2 -c SUNWonbld.i386.tar.bz2 | tar xf -
    • pfexec /usr/sbin/pkgadd -d onbld
  • Finally, let us download SFW source from here  and unpack into your home directory as shown below
    • mkdir -p ~/sfwnv
    • cd ~/sfwnv ; bunzip2 -c /tmp/<downloaded-sfw-source-tar-ball> | tar xf -
  • Now, you can setup your environment so that a build process can happen successfully.

Setup your system environment

  • Assuming that you have unpacked SFW source tar ball to your ´<home directory>/sfwnv´ , then you will need to do the following to set up your build environment
    • Copy sfwnv-opensolaris.sh setup script to your home directory
      • cp  ~/sfwnv/usr/src/tools/env/sfwnv-opensolaris.sh ~/
    • Edit ~/sfwnv-opensolaris.sh , using your favorite editor,to make the following changes and save the file.
      • GATE should point to the top of your SFW work space. If you have unpacked the SFW source tar ball to ´sfwnv´ directory, then you can leave this variable as such
      • CODEMGR_WS should provide an absolute path to your top build workspace (Example: CODEMGR_WS=/export/home/sriramn/sfwnv)
      • STAFFER  change this variable to reflect your current user name
      • MAILTO (Optional: valid email Id if you would like to receive an email once the build is completed or failed)
    • Setup your PATH , JAVA_ROOT and JDK_ROOT variable as shown below. For example, on bash (default shell in OpenSolaris 2008.05), you will do something like . Af course, if you have customized your OpenSolaris 2008.05 distribution to use other shells like csh then you will need to setup to export accordingly.
      • export PATH=/usr/bin:/usr/ccs/bin:/usr/sfw/bin:/opt/SUNWspro/bin:/opt/onbld/bin
      • export JDK_ROOT=/usr/jdk/latest
      • export JAVA_ROOT=/usr/jdk/latest
    • That is all there is to do. Now, you can trigger a full SFW build with all bundled open source components by running the following command:

      • /usr/bin/ksh93 /opt/onbld/bin/nightly -n ~/sfw-opensolaris.sh &

    • This above command takes a long (and very long time) to finish. So, you might better find something else to work on for a few hours. You can monitor the build's progress using ptree(1). nightly(1) will send mail (to $MAILTO variable in sfw-opensolaris.sh) when it is finished.

Note: If you are going to be developing or building / modifying SFW components using OpenSolaris 2008.05 distribution, I personally would encourage to first  image-update the system to latest Nevada build.  Check out opensolaris-announce to find out the latest update available and update your system accordingly to use the latest nevada build before building SFW. At the time of writing this blog, Nevada build 91 has been released for OpenSolaris 2008.05 distribution and you can update to this image as shown in this blog

Monday Jun 30, 2008

Large center deployments require the ability to simply layout the product binaries through automated data center tools like Sun N1 Service Provisioning System or  HP (formerly known as Opsware) Server Automation software . This allows server administrators managing large data center to replicate or provision new servers on need basis with very little overhead. 

Sun Java System Web Server 7 has always provided the ability to automate its installation through our silent state file mode. In this mode, web server 7 can non interactively layout the binaries as well as configure the installation in a single step. Sun N1 Service Provisioning System uses Web Server 7 silent state file based installation to provision servers in data centers.

However, some enterprise customers wanted the ability to simply layout Web Server 7 binaries and without actually configuring them. With  Web Server 7 Update 3, we have now provided the ability to simply layout our binaries - a typical requirement in data center based deployments using Opsware Server Automation center.  For this mode, a new state variable known as CONFIGURE_LATER  has been introduced. Now, once this variable is defined within the Web Server 7 state file , Web Server 7 installer will simply layout the binaries without configuring Web Server 7 administration server or an actual server instance. Customers will then need to run 'configureServer' to actually configure a server instance and administration server or node.

Here is a quick write up on how to do this.

  • Download Web Server 7 Update 3 from here and unpack the zip into a temporary location (say /tmp)
  • Now, you will need to create a state file as shown in our docs
  • Within this state file, also include another variable as 'CONFIGURE_LATER' and set it to True
  • Using this state file , you can now install to a given location without actually configuring an administration server or a server instance as shown below :
    • run ./setup -silent <statefile>  command from the command line
  • Once the installation is completed successfully, you can now non-interactively configure Web Server 7 with an administration node or server and a server instance. If you are confused as to what is this administration server or node, please check out this Understanding Web Server 7 guide for some back ground. 
  • Getting back to the topic on completing configuration for Web Server 7 , you can either choose to edit 'configureServer.properties' file found under under <install-root>/setup directory as shown in Configure Later  section. (Please remember to set WS_IS_JES to False ) . A sample configuration file is already created for you with all values filled within <install-root>/setup/configureServer.properties. You can feel free to customize this as well.
  • Finally, you can run the <install-root>/lib/configureServer script to complete the configuration as shown below
    • <install-root>/lib/configureServer -inputfile <config-file>
    • For example, if you installed non interactively under /sun/webserver7, then you would do something like below
      • /sun/webserver7/lib/configureServer -inputfile /sun/webserver7/setup/configureServer.properties -verbose -logfile /sun/webserver7/setup/configure.log

Note:  Please find attached a sample script for UNIX/Linux platforms to non interactively layout and configure the binaries . Feel free to download , read through and customize this script to suite your needs.

Sunday Jun 29, 2008

I was looking around for a good web site to refresh my PHP skills and I ran into this nice Practical PHP programming book . Found to be quite useful especially for some one who already is familiar with other programming languages. If you happen to know any other good PHP programming book - for experienced programmers , I would appreciate if you can share it with me..

Saturday Jun 28, 2008

Is it just me wondering as to why 'same sex marriage' issue is highlighted only on an election year and conveniently forgotten afterwards. We saw the same issue play it over during the last soap opera -  America Votes 2004 and we are seeing a season repeat with America Votes 2008. I wish, we as American - take this away from the hands of Politicians and decide for ourselves , as a society, on where we stand.

Statutory Signature : Any opinions , thoughts expressed herewith is my personal opinion and has nothing to do with my employer. 

Friday Jun 27, 2008

We just released another update within our Sun Java System Web Server 7 product train. Keeping up with our past release history, this release includes new features, more performance enhancements and as usual bug fixes - Ah, needless to say all these without loosing the focus on the reliability and scalability that customers have come to expect from us...

Here are few things to be proud of this release

  • Web Server 7 Update 3 implements the ability to auto deploy java web applications. If you want to quickly try out a given Web Application (war file) within Web Server 7, now you can simply drop the war file within autodeploy directory under a given web server 7 instance. This feature has been very frequently requested by lot of our customers and we are glad to be able to get this done in this update.
  • Sun Microsystems chose Web Server 7 Update 3 to demonstrate the ability of its Sun SPARC Enterprise T5220 Server hardware.and achieved another top spot SPECweb'2005 benchmark. Check out this link for a detailed coverage on this topic.
  • Web Server 7 Update 3 is now available on AIX 5.3 as well as on AIX 6.1. With this addition, we now support the following platforms - Solaris and Linux (both 32 as well as 64-bit) , Windows, AIX and HP-UX.


As usual, all these at no additional cost. Feel free to download Web Server 7 Update 3 (did I say for free !) from here and check out our Release Notes for a detailed information on this release and get back to us at our forum with your thoughts and questions .

Thursday Jun 26, 2008

Every few weeks, we keep getting questions like how to upgrade to install updates from Web Server 7 in Java ES 5 environment. Seems like, not lot of people probably know that Sun Java System Web Server 7 is available as OS native packages (SVR4 packages for Solaris, RPM for Linux) etc within Java Enterprise System 5 release.  Accordingly, with every update release, you can download and install patches from Sun Solve - place to download latest patches for Sun products.  So, check out our FAQ Wiki web page to find out the patch information for your respective OS.


Hope this helps




Wednesday Jun 25, 2008

Thanks to Nick Kew , engineers involved within  Web Stack and Cool Stack projects are now hanging out  in #opensolaris-web  IRC channel on freenode.net . Feel free to drop by and participate ...

Now, if you wonder what the heck is this IRC - you are probably better of checking out this great Wikipedia link (where else would you go!).

To connect to #opensolaris-web , you can either

  • choose your favorite IRC client which will run on your machine. 
  • Use  Pidgin - an IRC-capable instant messaging client included within OpenSolaris distributions;
  • Use  Chatzilla add-on to Firefox, the above channel links should work just fine.

and check out this Using the network and How to participate in IRC communication to get you started.

Do drop a note, if you would appreciate a blog on how to get Pidgin (that is what I use) to connect to this channel.

See ya... 

Now that I am a proud OpenSolaris 2008.05 convert and have started using OpenSolaris both on my Toshiba Tecra M2 laptop as well as on my Sun Ultra-40 workstation (needless to say I am quite happy...) I realized that  the best way to learn a OS is use it for your every day task. You just run into some - that you wanted to work in a different way and google your way around until you get what you are looking for.. - no other best way to learn, IMO.

Today, I was looking around to see how I could get my set of applications to start automatically after a system restart - you need this when you are running stuffs on your laptop where you need to shut it down at the end of the day. Now, this feature would allow me to login to OpenSolaris desktop and have all these applications running automatically without any need to start them individually.

Ok, here we go... it seems that you will need to click on System->Preferences->Sessions . check out these below pictures to get a better grasp of how to get this done.

and then select the third tab to save all the currently running applications.


Af course, if you wanted to have one selected application to start automatically, then you could select the first tab and provide the command to get this application to run automatically every time you login to your laptop.

That's it. Now, your GNOME applications like Instant Messenger client like Pidgin can automatically start up and keep me online ...

Af course, if you like OpenSolaris 2008.05, feel free to subscribe to indiana-discuss mailing list and let us know how it works out for you.

Wednesday Jun 11, 2008

OpenSolaris 2008.05 has formally adopted Java 6 SE out of the box . That is a great news for most of us. Unfortunately, Sun Java System Web Server 7, is still bundling with Java 5 SE . So, if you tried to install this highly scalable Sun Web Server on OpenSolaris , you would see the following error

Now, what this error means that OpenSolaris 2008.05 does not have necessary compatible libraries bundled out of the box to support Java 5. Hmm.. why would they when Java SE 5 is way out of support life . It is time to move on to Java SE 6.

Anyway,  Web Server 7 installer does provide a way to use Java SE 6 runtime available within OpenSolaris. So, in this blog , I will walk you through the list of steps involved in getting Web Server 7 working within OpenSolaris 2008.05

 Note: Web Server 7 officially supports Java SE 6 as well as Java SE 5.

- Assuming, you have a valid internet connection, let us go ahead and install Java 6 SE development packages from OpenSolaris repository. Open a command line terminal window and download / install the development binaries by running the following command.

    pfexec pkg install java-dev


- If you haven't already, please visit Sun Java System Web Server 7 web page and download the binaries from here and unpack the downloaded tar ball to say /tmp

gunzip -c  <download file name> | tar xvf -

- Now, let us fire up Web Server 7 installer by pointing to the Java 6 SE runtime available within your OpenSolaris

        ./setup --javahome /usr/jdk/latest

- Follow through the installation screens like 'accepting the license, choosing an installation location etc.' . Now, when you got to choose between 'express' and 'custom' installation mode, you might want to choose the 'custom' installation mode as shown in the below image.  

Choosing 'Custom' installation mode, allows you to tell Web Server 7 installer to use Java SE 6 runtime bundled within OpenSolaris. The attached sample installation screen shot of this next window showing how to tell  Web Server 7 installer to use Java SE 6


Now, follow through the rest of the installation screens by choosing an administration password and completing the installation. That is about it. You are now ready to use Web Server 7 with Java SE 6


Note: Very shortly, we will also follow up with an IPS package of Sun Web Server 7 within OpenSolaris pkg repository making it lot more simpler to get Web Server 7 on your OpenSolaris .


As always, if run into any issues  , please feel free to visit our forum where product engineers and other smart minds lurk.

Hope this helps

Wednesday Jun 04, 2008

After a long delay, I am finally glad to announce that Sun Java System ASP 4.0.3 is finally available for download.  You can download it from here .  What's new in this release - ASP 4.0.3 addresses some security vulnerabilities besides supporting Web Server 7 as well as Apache 2.2. For more information on this release, check out the Release Notes


Thursday May 22, 2008

Recently, some one posted a question in a mailing list as to how to get phpMyAdmin working within OpenSolaris. So, here is a quick write up on how to get this done. Hope, you find this useful

Install and configure AMP stack within OpenSolaris

  • Install  OpenSolaris from LiveCD. You can download your copy from here
  • Install Web Stack components from OpenSolaris repository by doing something like
    • Open a command line terminal window and enter the below command . This will download components like Apache 2.2, MySQL 5.0 and PHP 5.2 from the repository.
      • pfexec pkg install amp
  • Let us register these downloaded packages with Solaris Service Management Framework (SMF) by doing something like
    • (from a command line terminal window)
      • pfexec /usr/sbin/svccfg -s /var/svc/manifest/network/http-apache22.xml
      • pfexec /usr/sbin/svccfg -s /var/svc/manifest/application/database/mysql.xml
      • pfexec /usr/sbin/svccfg -s /var/svc/manifest/application/database/memcached.xml
  • Finally, let us start Apache and MySQL services by doing something like
    • (from a command line terminal window)
      • pfexec /usr/sbin/svcadm enable http:apache22
      • pfexec /usr/sbin/svcadm enable mysql:version_50

 With this, you should have successfully configured an AMP stack for OpenSolaris. If you would like to try out some sample php pages, you could very well write these php pages under default apache document root directory ( /var/apache2/2.2/htdocs )

Note that within OpenSolaris the Apache document root directory - location in your hard disk where apache web server looks to serve incoming requests from your browser - needs special privilege to write to. Now, within OpenSolaris, you can get this privilege by prefixing with 'pfexec' command ahead.

For example, if I had to write a sample hello world php within OpenSolaris, I would do something like

pfexec vi /var/apache2/2.2/htdocs/hello.php

and save the following contents. Now, you should be able to access this page from http://localhost/hello.php

  <?php

   echo "Hello World";

  #Now, let us get the php server information

  echo phpinfo();

   ?>

Configuring phpMyAdmin within OpenSolaris 

Now, let us go ahead and download phpMyAdmin from here and unpack the downloaded tar ball to say /var/www. Again, from a command line terminal window, this is easily done - as shown below :

  •  Download phpMyAdmin to a local directory which is not accessible by every one to say /var/www
    • pfexec wget  phpmyadmin-2.11.6
    • pfexec mkdir -p /var/www
    • cd /var/www & pfexec gtar jxvfp ~/phpmyadmin-2.11*
    • pfexec mv /var/www/phpmyadmin-2.11* /var/www/phpmyadmin
  • Now, you might want to download this phpmyadmin.conf to Apache 2.2 configuration location and restart Apache Web Server. This configuration snippet instructs apache to to load phpMyAdmin from /var/www
    • wget phpmyadmin.conf
    • pfexec cp phpmyadmin.conf /etc/apache2/2.2/conf.d
    • pfexec /usr/sbin/svcadm restart http:apache22
  • Finally, you should be able to access phpMyAdmin from your browser by doing something like
    • http://localhost/myadmin


 

Saturday May 17, 2008

Well, most of the Linux and Solaris users should probably know that 'ifconfig' is the command to get and manage your network interfaces - something similar to 'ipconfig' on Windows but just more powerful. Anyway, what I didn't realize is that on OpenSolaris , you will need to run the ifconfig in the following way to get the MAC address .

pfexec /usr/sbin/ifconfig -a

Hope, some one finds this useful.

Friday May 16, 2008

As part of OpenSolaris 2008.05 installation, Caiman installer automatically configures your ethernet card  to provide a dynamic IP address. This is perfectly fine if you are working from your laptop.

However, if you, like me installed it on your workstation like Sun Ultra 40 then you might want to do necessary things like assigning a static IP address with NIS authentication enabled etc to transition the system as a developer workstation. Now that I have tried out OpenSolaris 2008.05 LiveCD for more than 2 weeks now, I guess I am now ready to make OpenSolaris 2008.05 as my default OS. If you haven't yet, you might wanna download a copy from here

So, here is how I went ahead with this transition

- Disable Network AutoMagic(NWAM) service and enable traditional networking service

svcadm enable physical:default 

svcadm disable physical:nwam

-  Now, you need to configure the static IP address for your ethernet interface. You could do this by using the network configuration GUI - 'System->Administration->Network GUI window to configure this as shown here

Note: I am assuming that you know the IP address and the default gateway that you need to provide here. If not, you might want to talk to your Network administrator before you attempt this.

- Now, I will restart all network services by doing some thing like

 svcadm restart milestone/network


Now, I will move ahead and configure NIS for my system. Here is how it
worked for me

- Setup your domain name of your current network. NIS server need to reside within this domain as well.  So, let us save the current domain name of your network to /etc/defaultdomain file.

    pfexec domainname <name here> 

   pfexec domainname > /etc/defaultdomain

For example,

    pfexec domainname sfbay.sun.com

    pfexec domainname  > /etc/defaultdomain

- Copy /etc/nsswitch.nis to /etc/nsswitch.conf

    pfexec cp /etc/nsswitch.nis /etc/nsswitch.conf

- Configure NIS Services

    pfexec ypinit -c

This above command will walk you through and ask you to provide NIS server IP addresses etc. and then bind the configured NIS server.

    pfexec /usr/lib/netsvc/yp/ypbind -broadcast

- Finally, enable NIS service and restart all network services..

    svcadm enable nis/client

    svcadm restart milestone/network

- Now, you should be able to verify if NIS is working on your system by doing something like

    ypcat -k passwd -> should return a whole bunch of NIS user names within your domain.

That is all there to do to translate a OpenSolaris system running in DHCP to a static IP address with NIS enabled



Wednesday May 14, 2008

For the last week or so, I have been successfully using OpenSolaris 2008.05 on Tecra M2 laptop and I totally love it. 

 
Since the default installation of OpenSolaris 2008.05, I had to install few packages to make it a developer friendly. Here is the list that I have on my system. You could very well customize it - depending on your needs

Open a command line terminal window and run the following commands to get (you could go through the GUI route if you are GUI person)

    * GCC, Sun Studio, Netbeans (Compiler and Developer IDE)

           pfexec pkg install gcc-dev sunstudio netbeans

    * Apache, MySQL, PHP runtime

           pfexec pkg install amp

    * VNC Client RDesktop (Allows remote connectivity to other desktop. You need VNC Client to connect to other Linux desktop and RDesktop to connect to Windows XP etc)

           pfexec pkg install SUNWvncviewer SUNWrdesktop

Hope, you find this useful.

Friday May 09, 2008

If you had recently tried out OpenSolaris 2008.05 and are wondering, where to find Apache, MySQL or PHP components within this installation, please check out our Getting Started Guide . Originally, this guide is supposed to live under here - but for some reason it didn't happen. Hopefully, learn link within OpenSolaris will be updated soon to reflect this

Monday May 05, 2008

So, if I had to setup a blogging web site, where would I go other than the favorite - WordPress. I followed their famous 5 minute installation steps within OpenSolaris 2008.05 and here we go.

* OpenSolaris 2008.05 is a LiveCD based distribution . So, if you need a AMP stack, you can get this on demand by  running the following command

[sriramn@sriram-laptop]: pfexec pkg install amp

 

* Now, you can initialize and configure Apache and MySQL service by doing  something like

[sriramn@sriram-laptop]: pfexec /usr/sbin/svccfg import /var/svc/manifest/application/database/mysql.xml

[sriramn@sriram-laptop]: pfexec /usr/sbin/svccfg import /var/svc/manifest/network/http-apache22.xml 

[sriramn@sriram-laptop]: pfexec /usr/sbin/svcadm enable network/http:apache22

[sriramn@sriram-laptop]: pfexec /usr/sbin/svcadm enable database/mysql:version_50

 

* Now, let us configure a Wordpress database within MySQL database. So, let us do something like

[sriramn@sriram-laptop]: pfexec /usr/mysql/bin/mysql -u root
 

here is a sample output that you would expect to see...

 

[sriramn@sriram-laptop]: pfexec /usr/mysql/bin/mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Now , let us create a new database and assign a user to this.


  mysql> create database wordpress;

  mysql> grant all privileges on wordpress.* to wp@localhost identified by 'wp';

  mysql> flush privileges;

  mysql> quit;

 

 

* At this point, we have created a new database 'wordpress' with a user 'wp' and with password  'wp' assigned to manage this database. Well, not a whole lot secure but a good starting point though.

 

* Now, you can download WordPress 2.5.1 from here unpack it to /var/apache2/2.2/htdocs - default apache document root directory.

* Now, copy /var/apache2/2.2/htdocs/wordpress/wp-config-sample.php to /var/apache2/2.2/htdocs/wodpresswp-config.php and edit the first four lines of the file to reflect the just now configured database name , user name and password.

[sriramn@sriram-laptop]: cd /tmp

[sriramn@sriram-laptop]: wget http://wordpress.org/latest.zip 

[sriramn@sriram-laptop]: cd /var/apache2/2.2/htdocs/w 

[sriramn@sriram-laptop]: pfexec  unzip /tmp/wordpress-2.5.1.zip

[sriramn@sriram-laptop]: pfexec cp wordpress/wp-config-sample.php wordpress/wp-config.php

pfexec vi wordpress/wp-config.php and edit this file - first four lines and provide your database name, user name and password . In my case, wordpress/wp-config.php file looks something like 

 
<?php
// ** MySQL settings ** //
define('DB_NAME', 'wordpress');    // The name of the database
define('DB_USER', 'wp');     // Your MySQL username
define('DB_PASSWORD', 'wp'); // ...and password
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
 

* That's it . you are now ready to host your blog site . You should be able to reach your blog site by accessing http://localhost/wordpress

Simple, huh . Ah , one last thing - If you would like to take this site into production, you might want to enable to APC cache - which is integrated within OpenSolaris Web(AMP) Stack but not enabled as default. You could do this by editing /etc/php5/5.2.4/conf.d/apc.ini and for more APC related settings , please refer here. 

 

Note: Once you enable APC, please remember to  restart Apache service for this change to take into effect

[sriramn@sriram-laptop]: pfexec /usr/sbin/svcadm restart network/http:apache22


Hope, you find this useful. Feel free to ping me back if you have any suggestions or issues. Alternatively, you could visit OpenSolaris forum

Today, Sun officially released a distribution - OpenSolaris 2008.05 based on a 3 year long open source effort happening with Solaris at  Open Solaris web site. You can catch more on this release from here.

Now, if you are web developer interested in figuring out how it is useful to you, here is what you might like

* Ruby binaries can be downloaded and installed with the single command

   Open a command line terminal window and run the following command

    pfexec pkg install ruby

   Now, you can Ruby specific components by doing some thing like

    pfexec /usr/ruby/1.8/bin/gem install <component name>
 

* MySQL or PHP developers can get their binaries (again from a command line window) by doing some thing like

    pfexec pkg install amp

    The Apache, PHP and MySQL binaries are available under /usr/apache2 , /usr/php5 and /usr/mysql directories respectively.  The corresponding configuration files are found under /etc/apache2 , /etc/mysql and /etc/php5 directories respectively.

* Once you have successfully install MySQL or Apache , you will need to initialize the SMF service.  The following command does the initialization job for you. 

    pfexec /usr/sbin/svccfg import /var/svc/manifest/network/http-apache22.xml

    pfexec /usr/sbin/svccfg import /var/svc/manifest/application/database/mysql.xml

If in case, you wonder what is SMF - you might wanna check out Service Management Facility project page for more information on how this is useful to you. 

* Now, you can start these Apache and MySQL services by doing something like

    pfexec /usr/sbin/svcadm enable network/http:apache22

    pfexec /usr/sbin/svcadm enable database/mysql:version_50 

 

Similarly, the way to stop these services, if you need to , you would do 

pfexec /usr/sbin/svcadm disable network/http:apache22

pfexec /usr/sbin/svcadm disable database/mysql:version_50 

 

 * PHP runtime is configured by default within default Apache Service. So, you should be able to deploy PHP applications by simply writing a PHP application within Web Server document root directory - /var/apache2/2.2/htdocs.

That is all you need to do to get your web site up and running. If you want to do Joomla or MediaWiki, you can simply unpack these tar ball within the web server document root directory (/var/apache2/2.2/htdocs) and hit their index page . This is all you need to get them up and running.

Does this sound simple enough for you to try it out ?

Now, if you need to read more information on this , please check out the Getting Starting Guide from here . Kindly, give OpenSolaris 2008.05 a spin and let us as to what you think and how we can improve it

 



 

Wednesday Mar 26, 2008

Typically, businesses have always simply used multiple virtual servers within web servers like Apache or iPlanet / Sun Java System Web Server to host their web sites. However, within Sun Java System Web Server 7, you do have a choice of deciding as to

  • when to create multiple configurations and use one ore more virtual servers within each configuration OR
  • when to use one or more virtual servers within a single configuration and

 

If in case, you wonder as to what is a 'configuration' , check out our 'Understanding Web Server 7 ' link for basic overview on this subject. If in case, you are new to Web Server 7 , here is a thousand feet view on these Web Server 7 terminologies :

 

  • Configuration - Collection of configuration information to host your web site and are managed within Administration Server configuration repository. A 'configuration' can be deployed as an 'instance' to one or more host using Administration Server.  If you deploy this configuration to more than one host, you are asking Web Server 7 Administration Server to manage a cluster for you. These configurations can be edited either through Web Server 7 Administration CLI or GUI. Some of the information contained within a configuration are
    • Information related to site resource information like - number of server threads, I/O buffer size etc
    • Information related to site configuration(s) like - one or more Virtual Server configured within , SSL/non SSL port information etc
    • Information related to site content management like - Web Application(s), WebDAV , ACL, Reverse Proxy etc

 

  • Instance - A configuration when deployed to a host using Administration Server ends up as a physical directory (https-<config>) under your Web Server 7 installation location. This directory becomes the physical representation of your configuration and contain several sub directories ( like 'config' - which holds the actual configuration information for hosting your web site).  Web Server 7 can be started and stopped from this instance. An actual Web Server process (webservd) is associated with every instance.

 

  • Virtual Server - Each virtual server  configured within a configuration need to contain at the minimum a 'site name' and one or more 'port' (default is 80 for non SSL and 443 for SSL) . Sun Java System Web Server 7 requires at least one virtual server to be configured while setting up a web site and supports site content management like Java Web Application or WebDAV to be configured separately for every virtual server. This allows customers to use a single 'configuration' and still have separate 'virtual servers' for their different customers.  

                          For example, a typical hosting company wanting to host multiple web sites within Sun Java System Web Server 7 can simply create multiple virtual servers where in each virtual server is listening in its own IP/Port (both SSL/non SSL) combination and can handle requests from one ore more web sites. For more information , on how to create multiple virtual servers check out 'create-http-listener' and 'create-virtual-server' CLI command and corresponding Using Virtual Servers link within docs. Most of the site content management information (like Java Web Application, Web DAV) is also configurable for every virtual server. This is very straight forward and a very common deployment scenario.

 

Assuming, you now got a whim of these terminologies, here are few issues to consider while hosting multiple web sites within Web Server 7. 

  • Stability - As I mentioned earlier, a single Web Server process for every deployed configuration reads the configuration information and load all the virtual server(s) configured within. This does provide significant savings on your resource. However, if a rogue customer application running within a site (aka 'virtual server' ) can bring down other virtual server(s) as well. So, in that case, you might want to separating these rogue customer applications or web site(s) within their separate configuration. However, Web Server 7 can be configured in run in Multi Process / Multi Threaded mode (on UNIX platforms) and still provide you the stability along with resource savings.

 

  • Resource sharing - As you know by now, Web Server 7 includes an optimized web container for serving any Servlet and JSP based web applications configured within every virtual server. Accordingly, JVM is the heaviest resource within Web Server 7 . Fortunately, this resource is shared across all virtual server(s) configured thus providing a significant savings on your memory foot print . So, if your multiple web site(s) does include / support Java Web Applications (and JDBC resources) , you can share these multiple web site(s) within a single configuration.  On the contrary, if you are running a non Java application (say PHP) within Web Server 7, it might make sense to create a separate configuration and disable Java for this configuration to provide you with resource savings.

 

  • Performance -  Most of the performance optimization procedures mentioned in our Tuning Guide  applies to a configuration and hence applies to all virtual server(s) configured within. However, it is possible that some web site(s) have different load requirements. For example, if a web site does lot of heavy I/O traffic (say huge amount of POST data) and tuning requirement for this web site will be different compared to a typical J2EE shopping web site.  So, if all the web site(s) configured within a configuration share a typical load requirements then you can use multiple virtual server(s) or simply use multiple configuration(s) for sites that has different load requirements.

 

  • Administration - Web Server 7 Administration Server supports clustering out of the box for every configuration created within. So, based on your load, you can leverage the clustering support and scale horizontally. Here are couple of related links on this topic - Clustering in Web Server 7 and Server Farms and Clusters on this topic that you might find it useful. In order to support this feature, Administration Server does maintain its own internal repository of site configuration and content information for every configuration created. So, if you have hundred(s) of virtual server(s) configured thus making the size of "configuration" considerably huge. This might end up in slowing down the time it takes to deploy any configuration changes into one or more hosts. 

 

  • Security - Most of the security topics like Access Control Lists, Request Limiting , DoS Prevention , Authentication  does include support for sharing across entire configurations or few virtual server(s) within a configuration. However, if you have multiple configurations created, you will need to track or implement these security features individually for every configuration / virtual server within.

 

So, If you haven't already , do try out Sun Web Server 7 (free) for your hosting needs and let us know as to what you think. You can always talk to us on our forum (free) or Sun support for any issues or suggestions.

 

 

 

This blog copyright 2008 by natarajan