Friday Mar 27, 2009

Configuring Sun Web Server 7 with PHP runtime in OpenSolaris

With upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 110 or above), PHP runtime has been updated to the latest 5.2.9 release. Also, we have integrated a configuration script to simplify the steps required to configure PHP runtime with Sun Java System Web Server 7 (formerly known as Sun ONE/iPlanet Enterprise Server). Thought, I would you walk through the steps involved here

Installing PHP 5.2.9 in OpenSolaris 2009.06 (preview build)

Check out my earlier blog on how to get PHP 5.2.9 runtime within OpenSolaris 2009.06 on your system.

Installing Sun Web Server 7

Now, if you are new to Sun Web Server 7 and wonder why you need this beast, please do check out our performance benchmarks. You can download and install the latest version of Sun Java System Web Server from here .

If you are adventurous, you can also build the open sourced version of this beast (available under BSD license) by following the instructions provided here

If you would like a little hand holding in installing our product, check out this nice demo . Hope, you are able to successfully install Sun Web Server 7 with the help of this demo. If not, you can always post your questions in our forums - where we developers will be happy to help you out !.

Note1: You will need to install Java development environment within your OpenSolaris before proceeding to install Sun Web Server 7 on OpenSolaris . You could do this by running the following command from the command line window

sriramn@sriramn:~> pfexec pkg install java-dev

Note2:  You will need to perform Web Server installation as 'root' (or use pfexec ./setup)  and choose Web Server runtime user as 'webservd'. Please check out this  blog   for more information on installing Web Server 7 on OpenSolaris.

Finally, let us hook up PHP runtime within Sun Web Server 7. To do this, run the following script (which is newly available from OpenSolaris 2009.06 preview build 110 or above)

sriramn@sriramn:~> pfexec /usr/php/5.2/samples/scripts/configure-sun-webserver --installroot=/sun/webserver7 --instancename=https-sriramn

  \* where /sun/webserver7 is the location of the Web Server 7 top level installation location. Provide the appropriate location as in your case.

  \* and https-sriramn -> is the instance created under this installation. The instance name is typically the name of your hostname. You need to provide the appropriate value here.

Now, you will need to restart the Web Server 7 instance by running these below commands so that the newly modified changes can be loaded.

sriramn@sriramn:~> /sun/webserver7/https-sriramn/bin/stopserv
sriramn@sriramn:~> /sun/webserver7/https-sriramn/bin/startserv

Sun Web Server 7 is now ready to serve any PHP pages within its document root. For example, to deploy Joomla or Drupal, all you need to do is unpack these application tar balls under  /sun/webserver7/https-sriramn/docs/ and point your browser to http://localhost/joomla etc.

Now, you could write few PHP script within Web Server document root directory (<install-root>/<instance-name>/docs) and test our your configurations. If you are satisfied then we now need to move to the final step.  Web Server 7 Administration server need to be told of what we just did. This is accomplished easily by running these following CLI commands

sriramn@sriramn:~> pfexec chown webservd:webservd /sun/webserver7/https-\*/config/\*obj.conf

sriramn@sriramn:~> /sun/webserver7/bin/wadm pull-config --user=admin --config=sriramn sriramn.sun.com

where --config=<sriramn> will typically be the hostname of your machine or whatever configuration name that you chose

and

sriramn.sun.com is the fully qualified hostname (hostname.domainname) of your machine. Provide your corresponding hostname here.

Note: Web Server 7 integrates a Java web container within its default server instance. Having an integrated web container will  allow you to deploy Java Web Applications like JSP, Servlet etc. Hence, Sun Web Server has to load Java runtime as part of server startup - eating your previous CPU and memory resource. Now, if you plan on using only PHP runtme, you can easily disable Java Web Container by running he following commands :

sriramn@sriramn:~> /sun/webserver7/bin/wadm disable-java --user=admin --config=sriramn sriramn.sun.com

sriramn@sriramn:~> /sun/webserver7/bin/wadm deploy-config --user=admin  sriramn.sun.com

again where --config=<sriramn> will typically be the hostname of your machine or whatever configuration name that you chose

and

sriramn.sun.com is the fully qualified hostname (hostname.domainname) of your machine. Provide your corresponding hostname here.

Hope you will like our simplified integration and let us know with your feedback at our forum.

Tuesday Mar 03, 2009

OpenSolaris 2008.11 based AMP stack is now available for Amazon EC2

After a long time since my initial post on releasing the OpenSolaris based AMP stack for Amazon EC, Today, we announced the availability of Amazon Machine Image (AMI) for OpenSolaris 2008.11 based AMP (Apache 2.2, MySQL 5.0 and PHP 5.2) on Amazon EC2 envionment. So, if you want to try out Amazon based web services running on enterprise grade OpenSolaris, please check out this announcement for more information.



Monday Feb 09, 2009

Using PEAR/PECL extensions within OpenSolaris

I ran into couple of questions by OpenSolaris users (unfortunately posted at various different places) wondering as to how to use PHP extensions either PEAR or PECL based extensions within OpenSolaris. In OpenSolaris, say to download and install - say any PECL extension, one would do some thing like

 

sriramn@sriramn:$ pfexec /usr/php/bin/pecl install <extension name>

The downloaded and installed extensions will be available at /var/php/5.2/modules location. 

Note: If any PECL extension depends on any third party library to be available on the system, please make sure that those libraries first exist on OpenSolaris by searching OpenSolaris pkg database

Similarly, if you would like to the most popular XML Parser PEAR extension within your application, you could simply run the following command..

sriramn@sriramn:$ pfexec /usr/php/bin/pear install XML_Parser

Lessons learnt with OpenSolaris 2008.11

Couple of weeks back, for some weird reason my desktop (running on OpenSolaris 2008.11) failed to boot successfully.  After some digging into the boot log files, it turned out that hald daemon does not want to start and this failed service is causing other dependent services to fail as well. I was charging my Palm Treo cell phone through USB within my OpenSolaris 2008.11 based workstation before it happened. Not sure, if it had anything to do with it. Once I recover my system, I will need to try it again to see if that is what kept the system from booting up successfully..

Since, this is my primary workstation, I decided to quickly restore my workstation using some of the tools provided by OpenSolaris 2008.11. Hope, some one wanting to recover their installation finds this useful.

One of the advantage(s) of OpenSolaris 2008.11 is that it uses the power of ZFS intrinsically to provide us with the ability to take a snapshot and rollback to the previous , if necessary. For example, OpenSolaris Boot Environment Manager (beadm(1M)Image Package Manager tool - pkg(1M) - instantly takes a ZFS snapshot of your boot environment and installation files after every successful operation. This allows us  to roll back to the snap shot if we screw some thing up and want to restore to previous state.

Now, in my case, I booted my system in single user mode and checked out the list of snapshots available for my boot environment by running the following command:

sriramn@sriramn:~$ pfexec beadm list -s

(-s informs beadm command to provide the list of snapshots)

(I was doing all this in single user mode. So, I haven't written down the output here.. )

Now, in my case, I was not able to use those snapshot(s) because I had upgraded my zpool to run on newer version of kernel. If I hand't upgraded my zpool , I could have simply done some thing like 

sriramn@sriramn:~$ pfexec beadm create -e opensolaris@install opensolaris-1

sriramn@sriramn:~$ pfexec beadm activate opensolaris-1

sriramn@sriramn:~$ pfexec init 6

Well, in any case, this is what I had to do to recover my system

  • Use OpenSolaris 2008.11 LiveCD to boot up my system. Unforuntately, OpenSolaris LiveCD based installer does not allow one to do reinstallation.So, I had to backup my home directory (using zfs send along with zfs receive ) before proceeding to install.
  • Opened a command line terminal window to back up my home directory to an external hard disk by doing some thing like

  • sriramn@sriramn:~$ pfexec zpool import -f rpool (this is where my corrupted opensolaris installation along with my home directory exists)

    sriramn@sriramn:~$ pfexec zfs list

    (above command should list all the dataset that is available in the pool. You could use this information to determine which one to be backed up). 

           NAME                               USED  AVAIL  REFER  MOUNTPOINT
           rpool/export                         69.9G   144G    19K  /export
           rpool/export/home                    69.9G   144G  2.22G  /export/home
           rpool/export/home/sriramn            67.7G   144G  66.6G  /export/home/sriramn

    sriramn@sriramn:~$ pfexec zfs snapshot rpool/export/home/sriramn@jan09

    sriramn@sriramn:~$ pfexec zfs send rpool/export/home/sriramn@jan09 | gzip > /mnt/backupfile.gz

  • Finally, I had to start a new installation by clicking on 'Install Now' icon. Once the system came up successfully, I simply recovered my old data by running the following command

<my external had disk is mounted as /mnt where I have saved a ZFS stream of my home directory to /mnt>
sriramn@sriramn:~$ gunzip -c /mnt/backupfile.gz | pfexec /usr/sbin/zfs recv rpool/export/home/sriramn@jan09


Thought, I would capture some of the lessons that I have learnt during this recovery experience...
  • Think twice before running 'zpool update' on your OpenSolaris 200[8-9].xx based desktop.  Why ?
    • Within OpenSolaris, invoking zpool upgrade command ensures that your disk pool is instantly converted to run on newer version of ZFS there by supporting the newer features of ZFS. However, older version of OpenSolaris kernel will not be able to read your data any more. 
    • If you would like to know what is in each version of ZFS, you could simply run the following command from the command line
      • pfexec /usr/sbin/zpool upgrade -v
    • For example, with OpenSolaris 2008.11 (build 101b), released version of ZFS is version 13 and with the latest released Nevada build 106, ZFS version is 14 !. Now, let us say, if you update your system to run on Nevada build 106, and then you explicitly invoked zpool upgrade , now you will not be able to use your OpenSolaris 2008.11 LiveCD and access your home directory !
  • Take regular snapshot of your file system as well as boot environment because unlike other platforms, snapshots on ZFS doesn't cost that much in space and the benefits are huge.. OpenSolaris installer automatically create a '@install' snapshot of the boot environment as well as the files created as part of an installation. This is very cool. This would allow us to revert back to this snapshot any time some thing gets messed up.

Monday Jan 12, 2009

What's new with AMP stack in OpenSolaris 2008.11

If you are new to OpenSolaris, please check out this blog on how to get the AMP stack for this platform. 

Since the initial release of OpenSolaris 2008.05 - in the last 4-5 months -  our Web Stack project team has been busy revving up AMP (Apache, MySQL and PHP) stack specific bugs for OpenSolaris 2008.11 as well as porting this stack on Solaris 10 and RedHat Enterprise Linux 5 platforms as part of Sun Web Stack 1.4 release. For more information on this Sun Web Stack 1.4 release, check out this blog from my colleague - Jyri Virkki.

Now, in this blog, I thought I will write some of the important technical issues that has been addressed within AMP stack  for OpenSolaris 2008.11 release.

  1. General version update of AMP components like Apache = 2.2.9, PHP = 5.2.6 and MySQL = 5.0.67.
  2. Apache and PHP configuration files have been updated to provide better performance out of the box.
  3. Apache 2.2.9 now includes additional modules like Perl, FastCGI, DTrace etc
  4. Apache now provides various sample configurations like SSL configuration within /etc/apache2/2.2/samples-conf.d directory. 
  5. MySQL 5.0 server (64-bit) is also now available . However, MySQL server defaults to 32-bit by default. If you would like to run MySQL server as 64-bit, please refer to Administering MySQL server documentation within our wiki.
  6. Experimental MySQL 5.1 server is now available within webstack repository. However, to use MySQL 5.1 within OpenSolaris 2008.11, you will need to explicitly point to Web Stack repository to download and install this server. I guess, more on this in a separate blog !
  7. PHP file layout has been modified to be more in synchronization with the rest of the components. New PHP 5.2.6 file layout within OpenSolaris 2008.11 is /usr/php/5.2 - for all standard binaries, /etc/php/5.2 - for all configuration and /var/php/5.2 - for all data, pecl / pear modules and session specific contents. Also, at the time of startup , PHP engine will look and load all the INI files found under /etc/php/5.2/conf.d directory.
  8. PHP extensions like APC, DTrace is now enabled by default. Also, PECL extensions like XDebug, Memcache, Suhosin, idn and tcpwrap is bundled within OpenSolaris 2008.11. However, they are disabled by default. These extensions are bundled as individual ini files within /etc/php/5.2/conf.d directory.
  9. Individual PHP extensions can be either enabled or disabled by editing their corresponding ini files within /etc/php/5.2/conf.d directory and then restarting Apache SMF service. For more information on restarting Apache SMF service, please visit our Administering Apache Server documentation within our Web Stack Wiki.
  10. PHP extension now includes PEAR / PECL support as well. So, now it should be easy for developers to now download and install their favorite extensions. So, if you wonder as to how to use PEAR or PECL within OpenSolaris, you could do some thing like below
    1. /usr/php/bin/pear install XML_Parser
    2. /usr/php/bin/pecl install inclued

Now, if you install these PECL extensions as shown above, please remember to enable them by editing the php.ini found within /etc/php/5.2/php.ini  location.

You can load any of these PECL php extensions by editing php.ini and adding the following line at the end of the file

extension = [extension name].so

Note: Please note that unlike Linux or other platforms, Solaris engineering folks would like to avoid writing any user data (like data not provided by OS) within /usr location. So, we don't write any dynamic data into /usr. So, what this means is - PEAR or PECL will now install modules under /var/php/5.2/modules directory. However, PHP engine has been patched to look for modules both under /usr/php/5.2/modules as well as /var/php/5.2/modules directory

Hopefully, this acts as a good starting point on what to expect with AMP stack in OpenSolaris 2008.11. For more comprehensive information, please visit our Getting Started Guide or please visit your feedback within our OpenSolaris Web Stack forum .

Setting up AMP Stack within OpenSolaris

With the first release of OpenSolaris - OpenSolaris 2008.05 -  I wrote this and this and this blog on how to use AMP stack for this platform. Well, these blogs very much holds true for the latest release of OpenSolaris - OpenSolaris 2008.11 .

However, OpenSolaris 2008.11 includes a nice GUI application known as Package Manager  is available which further simplifies the process of downloading and configuring software applications that are available within its software repository.  

Let us use this application in this blog to see how easy it is to get an AMP (Apache, PHP and MySQL) stack going on your OpenSolaris 2008.11.

Assuming you have successfully installed opensolaris , let us start Package Manager as shown here

Now, you will need to choose whether you need either 

  • amp -  only the Apache 2.2.8 2.2.9, PHP 5.2.6 and MySQL 5.0.65 5.0.67 runtime
  • amp-dev  -  complete development environment and its tools like cvs, subversion, netbeans along with amp runtime

 and any other software packages that you are interested and click on Install / Update. 

Before Package Manager actually installs the packages on your system, you will get another chance to review your selection like below.

Now, click on Next should start the installation process. That should all be required to complete the installation of AMP runtime stack for OpenSolaris.  

Finally, if you are a GUI person and would prefer a GUI way to start/stop Apache and MySQL services as well as to edit your Apache configuration files then you might want to initialize the Web Stack environment as shown below

 and will need to enter your 'root' password for the initialization to complete. 

Now, if you are a command line person - like myself, you can manage your Apache and MySQL SMF service as below

  • For starting Apache and MySQL service, open a command line window and run the following command

    pfexec /usr/sbin/svcadm enable http:apache22

    pfexec /usr/sbin/svcadm enable mysql:version_50

  • Similarly, for stopping these services, run the following command:

    pfexec /usr/sbin/svcadm disable http:apache22

    pfexec /usr/sbin/svcadm disable mysql:version_50

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.  

Finally, if you run into any issues, you can check out our  Getting Started Guide or our Web Stack wiki or  feel free to post your issues at our  Web Stack forum page. 


Tuesday Jul 01, 2008

What I like with OpenSolaris 2008.05 (build 91)

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.

How to build sfwnv consolidation within OpenSolaris 2008.05

  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

Sunday Jun 29, 2008

Check out this PHP programming book..

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..

Wednesday Jun 25, 2008

Catch us at #opensolaris-web IRC channel

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... 

How to automatically start my applications within OpenSolaris 2008.05

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

Installing Web Server 7 in OpenSolaris 2008.05

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

Thursday May 22, 2008

Setting up phpMyAdmin in OpenSolaris

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

How to find Ethernet (MAC) address in OpenSolaris 2008.05

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

Setting up Static IP and NIS for OpenSolaris 2008.05

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



Tuesday May 13, 2008

Taking OpenSolaris 2008.05 to a developer workstation

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

Web Stack - Apache, MySQL, PHP and Ruby - Getting Started Guide on Open Solaris

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

Famous 5 minute installation of Wordpress with OpenSolaris 2008.05

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

Getting Ruby or AMP (Apache, MySQL and PHP) on OpenSolaris 2008.05

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

 



 

Monday Feb 18, 2008

Drupal on Open Solaris

In my previous blog, I mentioned the availability of components like Apache, PHP and MySQL/PostgreSQL within Open Solaris and also how to setup a wiki site like Media Wiki on Open Solaris . So, here is a very much related one - setting up a content management site like Drupal on Open Solaris.

Installing / Configuring Web Stack within Open Solaris

If you haven't already, you might want to download and install Open Solaris Developer Express 01/08

To simplify the initialization and configuration steps required for Apache and MySQL within Open Solaris, engineers within Web Stack project like Ludovic Champenois have done an amazing job of creating a a 'initialize' script so as to successfully setup the Web Stack Environment within couple of minutes. Here is a screen snap shot of the Web Stack Initialize 'script' posted in Ludovic Champenois's Blog

Once the Web Stack 'initialize' script completes successfully, you are now ready to start Web Stack Apache 2 and MySQL service as shown here . This is pretty much all is needed to host your web site and start developing and deploying PHP scripts.

However, to use PHP 5.2.4 database shipped within Open Solaris, we will need this below temporary work around to force PHP runtime to use MySQL 5.0 based client library.

        Open a terminal and become root from your Open Solaris box and run the following command (as a temporary work around)

 

root> ln -sf /usr/mysql/5.0/lib/mysql/libmysqlclient.so.15.0.0  /usr/mysql/5.0/lib/mysql/libmysqlclient.so.12


Note: The above mentioned work around is needed only for Open Solaris Developer Express and Open Solaris Developer Preview 2. This issue has been resolved in recent builds of Open Solaris and this temporary work around is not needed if you are using Nevada build 83 or above.

Installing Drupal

Now, you might want to download the latest version of Drupal from their web site and unpack the downloaded tar ball to Apache 2.2 document root location.

These below commands show how to unpack and set up under Apache 2.2's document root.

root> cd /var/apache2/2.2/htdocs

root> /usr/sfw/bin/gtar zxvf  <location of the downloaded tar ball>

Let us go ahead and create a symbolic link of the unzipped drupal tar ball to a valid name

root> ln -sf drupal-6.0 drupal


Configuring Apache for Drupal

Drupal actively uses '.htaccess' file within its installation. However, default apache configuration file, as part of security measure, has disabled the '.htaccess' file support. So, let us go ahead and create a drupal specific configuration.
   
    Note: We will need to create a drupal specific apache configuration file at '/etc/apache2/2.2/conf.d/drupal.conf' so that Apache can load Drupal specific configuration after system restart as well. So, using a command line terminal window become root so as to save the below contents into /etc/apache2/2.2/conf.d/drupal.conf' as shown here.



root> cat > /etc/apache2/2.2/conf.d/drupal.conf

<Directory /var/apache2/2.2/htdocs/drupal>
   AllowOverride All
   RewriteEngine on
   RewriteBase /drupal
</Directory>

<After pasting the above lines into your terminal window, press CTRL-D to save the above contents into drupal.conf>


Configuring PHP for Drupal

Drupal requires PHP configuration to have support to include the current directory in the include path. So, let us edit the default /etc/php5/5.2.4/php.ini and make the following change

    Open a command line terminal window and edit /etc/php5/5.2.4/php.ini file. Note: You will need to either edit this file as 'root' or use 'pfexec' command to ensure that you have the privilege to edit this file

     Now search for 'include_path = ' in this file and edit this line to reflect like below.  Note: This should be the line that doesn't have ';' in the front.

                include_path = "./:/usr/php5/5.2.4/include/php" 

Finally, restart Apache Service from the command line. This ensures that PHP runtime, loaded within Apache, is now aware of the changes that we just did within the 'php.ini' and 'drupal.conf' file.

 

root> /usr/apache2/2.2/bin/apachectl restart

Configuring MySQL for Drupal

Drupal requires a separate database to be created and available for its use. For more information on how to configure this database, please check out the INSTALL.mysql.txt file found under <drupal installation location> (For example, in our case, the file is under /var/apache2/2.2/htdocs/drupal-6.0/INSTALL.mysql.txt). 

Please note that within Open Solaris, MySQL 5 is located under /usr/mysql/5.0/bin/ directory. You will need to be either as root as login as 'mysql' user to successfully create this database.

Configuring Drupal 

Finally, proceed to configuring Drupal and complete the rest of the Drupal configuration by visiting http://localhost/drupal . For more information on this configuration, also refer to 'INSTALL.txt' file found under /var/apache2/2.2/htdocs/drupal directory. 



Technorati Tags: , , ,
About

Sharing what little I know

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