Wednesday, June 20, 2012

Install SamplesGallery in IBM Websphere Application Server

Alright, the previous article discussed the steps to install an IBM WAS in silent mode. By default, the installed instance is without the sample applications.

(Update: To install a new instance of WAS that includes SamplesGallery, you can add -OPT feature="samplesSelected", into the response file, however, this also requires you to provide the -OPT samplesPassword="aPassword" option.)

To install the sample applications (referred to as SamplesGallery in the IBM documentation), we need to run the install script once again, this time with a set of different options in the response file.

Create the following response file in your /WAS folder of your un-tar'ed installation archive.

# cat > addSamples.resp << EOF
-OPT silentInstallLicenseAcceptance="true"
-OPT disableOSPrereqChecking="true"
-OPT installType="addFeature"
-OPT feature="samplesSelected"
-OPT installLocation="/opt/IBM/WebSphere/AppServer"
-OPT traceLevel="INFO"
EOF

Make sure you stop all servers before carry out the installation of samples.
Install the samples

# ./install -options addSamples.resp -silent

Check the log file to see if the installation is successful.

# cat /opt/IBM/WebSphere/AppServer/logs/install/log.txt

You should see these 2 lines ending the log file immediately after your installation exits.

(Jun 19, 2012 1:07:40 PM), Process, com.ibm.ws.install.ni.ismp.actions.SetExitCodeAction, msg1, CWUPI0000I: EXITCODE=0
(Jun 19, 2012 1:07:40 PM), Process, com.ibm.ws.install.ni.ismp.actions.ISMPLogSuccessMessageAction, msg1, INSTCONFSUCCESS

Inspect the directory where the samples are installed. It is located in [was_install_dir]/samples

root@ubuntu12svr01:/opt/IBM/WebSphere/AppServer/samples# ls
bin  javadoc  lib  src

As an exercise, cd into lib/ and look at all available ear's. They are all the samples you can deploy into your profiles. The SamplesGallery is of our particular interest because it is a 'Gallery' that introduces the apps and provides some basic instructions on how to install them.

Now we need to install SamplesGallery app into our server1 of appsvr01 profile (created in this article). Once installed, the 'Gallery' can be access via URL http://server:9080/WSsamples.

You can either do this using the install script under the bin/ folder of the samples directory, or do this using the web admin console of profile appsvr01. Lets use command line to install SamplesGallery and use the web admin console to install others.

Using the command line.

root@ubuntu12svr01:/opt/IBM/WebSphere/AppServer/samples/bin# ./install.sh -profileName appsvr01 -server server1 -samples SamplesGallery
WASX7357I: By request, this scripting client is not connected to any server process. Certain configuration and application operations will be available in local mode.
WASX7303I: The following options are passed to the scripting environment and are available as arguments that are stored in the argv variable: "[-server, server1, -samples, SamplesGallery]"

---------------------------------------------------------------
              Command parameters
---------------------------------------------------------------
 Command:
                        configure & install
 Scope:
    cell                ubuntu12svr01Node01Cell
    node                ubuntu12svr01Node01
    server              server1
 Samples:
                        SamplesGallery
---------------------------------------------------------------

SAMP INFO: SamplesGallery was not configured because it does not have resources to configure.

************* Install Samples Gallery *************************

---------------------------------------------------------------
              Install application
---------------------------------------------------------------
 Scope:
    node                ubuntu12svr01Node01
    server              server1
 EAR:
    name                /opt/IBM/WebSphere/AppServer/samples/lib/SamplesGallery/SamplesGallery.ear                                                                                            
    application         SamplesGallery
    destination         $(APP_INSTALL_ROOT)/$(CELL)
    usedefaultbindings  true
    noejbdeploy         true
---------------------------------------------------------------

ADMA0073W: Custom permissions are found in the [(com.ibm.websphere.security.WebSphereRuntimePermission AdminPermiss                                                                           ion)] policy file. Custom permissions can compromise the integrity of Java 2 Security.
WASX7327I: Contents of was.policy file:
 //
// WebSphere Application Security Policy for SamplesGallery.ear
//

// Required to access the WAS Admin API's.
grant codeBase "file:${application}" {
  permission java.io.FilePermission "${/}QIBM/ProdData${/}Java400${/}SamplesProperties.xml", "read";
  permission java.io.FilePermission "${was.install.root}${/}samples${/}config", "read";
  permission java.io.FilePermission "${was.install.root}${/}samples${/}config${/}*", "read";
  permission java.io.FilePermission "${was.install.root}${/}properties${/}*", "read";
  permission com.ibm.websphere.security.WebSphereRuntimePermission "AdminPermission";
  permission javax.management.MBeanPermission "*", "queryNames,getMBeanInfo,invoke";
};

ADMA5016I: Installation of SamplesGallery started.
ADMA5058I: Application and module versions are validated with versions of deployment targets.
ADMA5005I: The application SamplesGallery is configured in the WebSphere Application Server repository.
ADMA5053I: The library references for the installed optional package are created.
ADMA5005I: The application SamplesGallery is configured in the WebSphere Application Server repository.
ADMA5001I: The application binaries are saved in /opt/IBM/WebSphere/AppServer/profiles/appsvr01/wstemp/Script13804e                                                                           cf838/workspace/cells/ubuntu12svr01Node01Cell/applications/SamplesGallery.ear/SamplesGallery.ear
ADMA5005I: The application SamplesGallery is configured in the WebSphere Application Server repository.
SECJ0400I: Successfully updated the application SamplesGallery with the appContextIDForSecurity information.
ADMA5005I: The application SamplesGallery is configured in the WebSphere Application Server repository.
CWSAD0040I: The application SamplesGallery is configured in the Application Server repository.
ADMA5113I: Activation plan created successfully.
ADMA5011I: The cleanup of the temp directory for application SamplesGallery is complete.
ADMA5013I: Application SamplesGallery installed successfully.

SAMP INFO: The install command for SamplesGallery completed successfully.

---------------------------------------------------------------
              Save
---------------------------------------------------------------

SAMP INFO: The save command for SamplesGallery completed successfully.

---------------------------------------------------------------
              Summary
---------------------------------------------------------------
 The following samples were configured and installed successfully:

    SamplesGallery

---------------------------------------------------------------
root@ubuntu12svr01:/opt/IBM/WebSphere/AppServer/samples/bin#

There you have it, the SamplesGallery application was installed successfully. Lets fire up the web browser and inspect the installed application at http://server-ip:9080/WSsamples you should see something like this.


As you can see, the 'gallery' provides command line instructions to install the app. We will install Plants By WebSphere using admin console.

Steps:
1) Log in to the web console, browse to the 'Application' section on the left hand menu, click on 'New Application then 'New Enterprise Application' on the right hand pane.


2) Browse to the path for 'Plants By WebSphere' ear file.


3) Select and click ok


4) Click 'Next' and choose 'Fast path'. Leave everything else to default.



5) Click 'Next'. Select all modules to map to the 'server1'


6) Click 'Next'. Select all modules to map to the default virtual host. We have only one virtual host here because we haven't created any other.


7) Click 'Next'. Review the summary and click 'Finish'.


8) Click 'Save' link in the resultant page to save the new server configuration. The is the last step of the installation of the application.



9) Locate the newly install application in the application list. Start the application.


10) Point your browser to http://server-ip:9080/PlantsByWebSphere, you should be presented with this page.


Unfortunately, the installation of PlantsByWebSphere using web console is far from complete as we are still missing whole other resources such as mail provider, authentication provider, JDBC provider, data source, so don't expect this app to fully work until we configured those. It is probably much easier to install the PlantsByWebSphere by command line.


# sh /opt/IBM/WebSphere/AppServer/samples/bin/install.sh -samples PlantsByWebSphere

I thought this article would be a short one, but look what I have done...

Cheers,

No comments:

Post a Comment