Wa2097 Rel 1 0 Eval Labguide
Wa2097 Rel 1 0 Eval Labguide
Wa2097 Rel 1 0 Eval Labguide
EV
AL
U
AT
I
LY
Table of Contents
EV
AL
U
AT
I
LY
LY
<WAS_SOFTWARE_DIR>: /root/Software/WAS-ND-85
<LABFILES_DIR>: /root/LabFiles
AL
U
<MQ_ROOT>: /opt/mqm
AT
I
<DB2_ROOT>: /opt/ibm/db2/V9.5
EV
<JMETER_ROOT>: /root/Software/jakarta-jmeter-2.3.4
Directories created during labs:
<IM_ROOT>:
<WAS_ROOT>:
<IHS_ROOT>:
<PLUGIN_ROOT>:
Copyright 2013 Web Age Solutions Inc.
Lab Notes
This section has notes that will be referred to throughout the labs. Various labs will have
you write down information in this section to document important settings or to use in
later labs.
LY
AT
I
AL
U
EV
root
password:
CentOS
LY
AT
I
AL
U
EV
The first step in installing WebSphere is to install the 'Installation Manager' software. In
this section you will use a custom script to install the 'Installation Manager' software
silently. This is a common approach to installing software instead of the graphical wizard
you could also run.
__1. Make sure that you are logged in as the administrative user listed above. If you are
not, log off and log back on as the user root above.
Note: You can install and run a WebSphere server as a non-root user. Search the
InfoCenter with the phrase non-root to find many topics about how to accomplish this.
In the labs, you will remain logged in as the root user to simplify the labs.
Be sure to check the platform specific installation instructions before installing
WebSphere on your own machines. The details about disk space and other requirements
will be detailed there. This lab should not be used as the only resource in preparing for
your WebSphere installation.
__2. Open a terminal window. You can do this by selecting 'Applications -> Accessories
-> Terminal'.
__5. Open a File Browser window. You can do this by selecting 'Applications -> System
Tools -> File Browser'.
LY
__7. Using the tools of the File Browser create the following new directory. Notice there
is an 'ITM' directory that already exists as part of the DB2 install but you are creating a
separate directory as shown below.
EV
AL
U
AT
I
/opt/IBM/IM
Note: This will make sure you can write to this directory which will be important later.
If for some reason you can't create this directory inform your instructor as you will need
to alter the 'IM_LOCATION' variable in the script that is run later.
__8. In the File Browser window navigate to the <LABFILES_DIR>/InstallWAS
directory substituting the value of the <LABFILES_DIR> variable with the location
mentioned in the list of directory paths at the beginning of these labs.
__9. Copy the 'custom_install_im.sh' file from this folder. Only copy this file. This file
is a custom file that will run the Installation Manager install process silently. The file is
customized already to help reduce install errors.
LY
__13. Use the following command to show the content of the file you copied.
# cat custom_install_im.sh
EV
AL
U
AT
I
__14. Notice the main line in this file calls the 'imcl' program. Although there are various
ways to install the Installation Manager this method is the easiest to customize the
installation directory. We are also installing with 'nonAdmin' access rights which will
help avoid some potential security issues. Your needs for installing the Installation
Manager may be slightly different so refer to the Installation Manager documentation for
the difference in installation methods.
Note: One important option is the -installationDirectory option. By default for the
"nonadmin" installation it would be in the user home directory so we are setting a more
visible directory for this setting.
__15. Issue the following command to start the execution of the custom silent install.
You will not be immediately returned to the command prompt which indicates the silent
installation is proceeding. Leave the command prompt open.
# ./custom_install_im.sh
AT
I
LY
__16. After a few minutes check that you are returned to the command prompt with a
message about something being installed and without any errors being displayed.
EV
AL
U
__17. In a File Browser window navigate to the '/opt/IBM/IM' directory and verify you
see files installed as shown below.
__18. Write down this installation directory as the value of the <IM_ROOT> variable in
the list of directory paths at the beginning of these labs.
LY
__3. Copy the 'custom_im_record.sh' file from this folder. Only copy this file. This file
is a custom file that will run the Installation Manager to record a response file. This can
only be done by supplying command line parameters when starting the Installation
Manager which is why this file is supplied for you.
AT
I
__4. Navigate to the <IM_ROOT> directory substituting the value of the <IM_ROOT>
variable with the location you wrote down in the list of directory paths at the beginning of
these labs.
EV
AL
U
__6. In a terminal window, use the 'cd' command to navigate to the <IM_ROOT>
directory.
__7. Use the following command to show the content of the file you copied.
# cat custom_im_record.sh
__8. Notice the key options of -skipInstall which will prevent the Installation Manager
from actually installing anything and -record with the file to be created with the recorded
response file.
LY
EV
AL
U
# ./custom_im_record.sh
AT
I
__9. Issue the following command to start the Installation Manager. Leave the command
prompt open.
__10. From the Installation Manager window that appears select 'File Preferences'.
__11. Next to what should be an empty list of repositories click the 'Add Repository'
button.
10
LY
__13. Select the 'repository.config' file in this location as shown below and click the OK
button to select the file.
EV
AL
U
AT
I
__14. Back in the Installation Manager, make sure the proper location for the repository
configuration file is listed and click the OK button.
__15. Make sure the repository is listed and click the OK button to close the preferences.
11
__16. Back in the Installation Manager select 'File Open Install Packages'.
LY
__17. On the Install Packages screen check the box next to 'IBM WebSphere
Application Server Network Deployment' which should be listed and click the Next
button.
Note: If you see any issue with prerequisites check with your instructor.
AT
I
__18. After a few seconds the license screen should be shown. Accept the license and
click the Next button.
EV
AL
U
Note: You could install into the default which is in the user home directory which could
avoid issues with file permissions. We are using a different directory here to install
everything under '/opt/IBM'.
__20. Click the Next button once your shared resources directory is modified.
12
LY
__22. Write down the installation directory for the <WAS_ROOT> variable in the list of
directory paths at the beginning of these labs. This directory will be used later in the labs.
__23. Click the Next button once your WebSphere installation directory is modified.
__24. Leave the default options for installed languages and click the Next button.
EV
AL
U
AT
I
__25. Leave the default features selected and click the Next button.
Note: On 64-bit systems you would see a choice for the JDK version to install. On
systems that support it, you might normally select the 64-bit JDK, especially in
production.
13
LY
__26. Verify that the options are configured as below and click the 'Install' button.
AT
I
Note: This does not actually install anything but creates a response file with the
appropriate settings you configured going through the process.
EV
AL
U
__27. After just a few seconds you should see a message that the "installation" was
successful. Click the Finish button.
14
LY
__29. Check in your <LABFILES_DIR> folder that you see the XML response file that
was recorded.
AL
U
AT
I
Now that you have recorded a response file, it can be used to install the WebSphere
software. If you were installing WebSphere on several machines you might only need to
record the response file once and on each machine you could install the Installation
Manager and the WebSphere software.
__1. Open a File Browser window.
EV
15
__6. In a terminal window, use the 'cd' command to navigate to the <IM_ROOT>
directory.
LY
__7. Use the following command to show the content of the file you copied.
# cat custom_install_WAS.sh
EV
AL
U
AT
I
__8. Notice the key option of 'input' which will point to the custom response file you
recorded.
Note: It is also important that you are using the 'imcl' from within the '/eclipse/tools'
subdirectory of the Installation Manager install. Even though this was the same thing
you used to install the Installation Manager, you should use the version from within the
Installation Manager once it is installed.
16
__9. Issue the following command to start the installation of WAS. You will not be
immediately returned to the command prompt which indicates the silent installation is
proceeding. Leave the command prompt open. You might want to take a quick break at
this point.
# ./custom_install_WAS.sh
LY
__10. After several minutes check that you are returned to the command prompt with a
message about WebSphere being installed and without any errors being displayed.
EV
AL
U
AT
I
__11. In a File Browser window navigate to the '/opt/IBM/' directory and verify you see
files installed as shown below. You should see the 'IMShared' and 'WebSphere' folders
that were not there before.
17
LY
__3. Copy the 'custom_create_profile.sh' file from this folder. Only copy this file. This
file is a custom file that will run the profile management tool with a few options. This
file is simply being provided to help prevent typos when running the profile management
tool.
EV
AL
U
AT
I
__6. In a terminal window, use the 'cd' command to navigate to the <WAS_ROOT>/bin
directory.
__7. Use the following command to show the content of the file you copied.
# cat custom_create_profile.sh
18
__8. Notice the key options of -create and -templatePath which are the minimum options
needed when using the "default" profile as this command does. Some additional options
are provided to configure administrative security also.
LY
Note: Although there are a lot of options you can provide when creating a profile, the
"default" profile can provide defaults for all of them. It is a very useful template for a
quick profile configuration. The only reason you were provided a script file to run
instead of typing the command directly is to enable administrative security which would
require quite a bit of typing. By default administrative security is disabled so you will
enable it with this command.
EV
AL
U
AT
I
# ./custom_create_profile.sh
__9. Issue the following command to start the profile creation. Leave the command
prompt open. You might want to take a quick break at this point.
__10. After several minutes the command should complete and return to the command
prompt without errors. Make sure you get a message about 'INSTCONFSUCCESS' as
shown below.
19
AL
U
AT
I
LY
__13. In the file that is opened, note the Profile name, Node name, and Host name.
Write these values down in the Lab Notes section at the beginning of the lab guide.
EV
20
LY
Note: Get familiar with opening a terminal window in this directory and running this
command as this will be the default way used to start the server.
EV
AL
U
AT
I
__2. Verify that you get a message that the server is "open for e-business". Leave the
terminal window open.
21
__3. Once the server is started, open a web browser and type the URL
'http://localhost:9080/snoop' into the address bar. You should see the output below.
__4. Close the web browser used to test the Application Server.
LY
__5. Stop the Application Server. Do this by following the set of steps below:
Open a terminal window. You can do this by selecting 'Applications ->
Accessories -> Terminal'.
AL
U
AT
I
EV
Note: In the future, when you are asked to start and stop the server you will use the steps
outlined in this section.
You can also issue the following command to stop the server to avoid getting prompted
for security information each time:
./stopServer.sh server1 -username wasadmin -password wasadmin
The issue with supplying the user and password in the command is that these would be
visible to the 'ps' process listing command. This can be viewed as a security risk.
22
LY
__2. Navigate to the <WAS_ROOT> directory you wrote down in the notes at the
beginning of these labs. This should be the main installation directory for WebSphere.
EV
AL
U
AT
I
__4. Look at some of the log files created during the installation and verification:
23
Part 7 - Review
In this lab you installed the WebSphere Application Server. You also ran some basics
tests of the server and familiarized yourself with some basic commands. You are now
able to start and stop the server and can identify some of the major directories in the
WebSphere installation.
One of the key things to take away from this lab is the role of the 'Installation Manager'
software. Even though we just saw this a little it will be a primary tool used to manage
WebSphere software installations.
EV
AL
U
AT
I
LY
Even though you installed the Network Deployment software, the profile that you created
is exactly what you would have after installing the Base edition of WebSphere. The
only difference is that when you install the Base edition you only get one option for the
type of environment to create.
24
LY
In this section you will use the Admin Console to control applications deployed to the
server. You will also see an example of the response returned if a deployed application is
stopped.
__1. Start the Application Server. Do this by following the set of steps below:
Open a terminal window. You can do this by selecting 'Applications ->
Accessories -> Terminal'.
AL
U
AT
I
EV
__2. Start the Admin Console by opening a Web browser and entering the URL
http://localhost:9060/ibm/console/
25
__3. Since security is enabled you will get a warning about the server certificate. Accept
the certificate or continue to the website depending on the browser you are using.
Note: You will get this warning every time you access the Admin Console. You could
also Install the certificate in your web browser to indicate you trust the site to prevent
the warning.
AL
U
AT
I
LY
EV
__4. Enter a user ID and password of wasadmin and click Log in on the Login screen
of the Console.
26
LY
__5. Expand the Applications group in the Navigation tree, expand Application Types
and click on the link for WebSphere enterprise applications.
__6. Check the checkbox next to the DefaultApplication and press the Stop button. You
should get a message that the application was stopped and a red X in the status column.
__7. Open a separate Web browser and try to access the Snoop Servlet as in the last lab.
The URL is http://localhost:9080/snoop. You should get an error. This is because it is
part of the DefaultApplication which is stopped.
AL
U
AT
I
__8. In the Admin Console, check the checkbox next to the DefaultApplication and
press the Start button. You should get a message that the application was started and a
green arrow in the status column.
EV
__9. In the Web browser you used to access the Snoop Servlet, hit the refresh button.
You should see the normal output of the Snoop Servlet.
__10. Close the extra Web browser you were using to test the Snoop application.
27
AL
U
AT
I
LY
EV
__7. Check the option for Detailed installation. This will show all steps.
__8. Once you have the options specified as below, press the Next button.
28
Note: The next sequence of steps will vary depending on the application you are
installing. Since this application is fairly simple there are only a few steps and a
summary. There would be fewer steps if we had not checked the option for showing all
options.
__9. On step 1, check the Precompile JavaServer Pages files option and click Next.
LY
__10. Accept the default values on steps 2-14 by pressing the Next button on each step.
Some of these steps will only appear once you go through other steps. You should end up
at step 15 which is the summary. Some of the intermediate steps are explained below:
Step 2: Map modules to servers - This step would be more important in a multi-server
environment. This step will also be more important with web servers later.
AL
U
AT
I
Step 3: Provide options to compile JSPs - This step appears because of the option you
selected to precompile JSPs. Most of the time the code needed to compile JSPs is in the
application itself but if it is not you may need to supply additional options here.
EV
Step 4: Provide JSP reloading options for Web modules - This service can
automatically check if a new version of a JSP file has been deployed to the application
without restarting the entire application. Most of the time you would leave this service
on but you could increase the time interval in production.
Steps 5 & 6: Shared libraries - Shared libraries are shared code that is required by an
application but is not packaged with the application itself. If you have previously
configured a shared library you can map it to an application module with these steps.
Step 7: Provide JNDI names for beans & Step 8: Bind EJB Business These steps
are presented if the application includes EJBs. The JNDI name can be used by EJB
clients to locate the EJB. Some EJB clients can also obtain a reference to the EJB using
Java EE injection where the JNDI name may not be required. If your developers are
using Rational software this value may be filled in already. It would be important to
coordinate the values of these properties with developers.
29
Step 9: Map EJB references to beans An EJB reference is another way for an EJB
client to be linked to a target EJB. Again, this value may not be required if an application
uses Java EE injection.
Step 10: Map virtual hosts for Web modules - Virtual hosts affect the URL that is used
to access the application. This will be discussed more later.
Step 11: Map context roots for Web modules - The context root also makes up part of
the application URL. You could change it here if you wish. This will be discussed more
later.
Step 12: Map JASPI Provider Java EE 6 defined a way to integrate an external web
application security authentication mechanism. If you were using this feature here is
where you could provide those options for this application.
LY
Step 13: Metadata for modules Deployment information for applications can be
provided by XML deployment descriptors or through annotations in the code itself. If
you check the 'metadata-complete attribute' in this step for a module of the application,
any deployment information provided in code annotations is ignored. Developers may be
counting on some of these annotations being applied to configure an application so this is
another aspect to coordinate with developers.
AT
I
Step 14: Display module build Ids If installing modules with a build ID in the
MANIFEST.MF file of the module that value will be displayed here. It can't be changed
though and is only displayed. This is often used if using some of the automated build
tools available from IBM as part of the Rational family.
AL
U
__11. On step 15, the Summary, click the Finish button. Wait for it to complete the
installation and be sure you get a message that says Application HitCount installed
successfully.
EV
__12. Click the link to Review changes to the master configuration below the message
about the successful installation.
30
__13. On the Save screen, click the '+' sign to expand the list of changes that will be
made.
Note: The number of changed documents you see may be slightly different.
LY
__14. Click the Save button at the bottom of the page to save the master configuration.
__15. In the Applications group in the navigation, expand the Application Types section
and click the link for WebSphere enterprise applications.
EV
AL
U
AT
I
__16. Start the HitCount application by checking the checkbox next to it and clicking the
Start button.
Note: Sometimes you may see that the red 'X' doesn't turn to a green arrow after starting
an application until you hover your mouse over it.
31
EV
AL
U
AT
I
LY
__3. From the list of Detail Properties associated with the HitCount application click the
link for View Deployment Descriptor.
32
LY
__4. In the text of the Deployment Descriptor find the value of the context-root. This is
what you can add to the host name and port of the server to access the application.
EV
AL
U
AT
I
__5. Open a new web browser and enter the URL http://localhost:9080/HitCountWeb.
Notice this URL ends in the context-root of the web application. You should see the
following page.
__6. Click the link of the home page of the application. You should get an initial count of
'1'.
__7. Refresh the page several times to see the count increase.
__8. Leave the web browser open that you are using to test the application.
33
__9. Return to your Admin Console web browser. If you closed it, open a new window to
the URL http://localhost:9060/ibm/console/. Make sure you leave the web browser
running the HitCount application open.
__10. Expand the 'Applications Application Types' group in the navigation and click
the link for 'WebSphere enterprise applications'.
__11. Check the checkbox next to the HitCount application and press the Stop button.
__12. Once the application is stopped, check the checkbox next to the HitCount
application again and press the Start button.
__13. Return to the web browser you were using to test the application and refresh the
page. The count should return to 1 even though you are using the same web browser.
The state of the stateful session EJB has been lost by restarting the application.
__14. Close the web browser you used to test the new application.
LY
WebSphere Application Server 8.0 added a new way to deploy applications. The server
can be configured to monitor a directory and deploy applications copied into that
directory. This feature is disabled by default and must be enabled.
AT
I
__1. Return to your Admin Console web browser. If you closed it, open a new window to
the URL http://localhost:9060/ibm/console/. Make sure you leave the web browser
running the HitCount application open.
AL
U
__2. Expand the 'Applications Application Types' group in the navigation and click
the link for 'WebSphere enterprise applications'.
__3. Check the checkbox next to the HitCount application and press the Stop button.
EV
__4. Once the application is stopped, check the checkbox next to the HitCount
application again and press the Uninstall button.
__5. Click the OK button to confirm you want to uninstall the application.
__6. In the messages that display at the top of the browser click the Save link.
34
__7. In the Applications group in the navigation, click the link for Global deployment
settings.
LY
__8. Check the box for the 'Monitor directory to automatically deploy applications'
and press the the Apply button. You can leave the default settings.
__9. In the messages that display at the top of the browser click the Save link.
__10. In the web browser showing the Admin Console click the Logout link near the top
of the Console. If you have unsaved changes save them before logging out.
AT
I
__11. Stop the Application Server. Do this by following the set of steps below:
Open a terminal window. You can do this by selecting 'Applications ->
Accessories -> Terminal'.
EV
AL
U
__12. Once the server has stopped issue the command './startserver.sh server1' to restart
it. The server must be restarted after enabling monitored directory deployment.
35
LY
__18. Return to your Admin Console web browser. If you closed it, open a new window
to the URL http://localhost:9060/ibm/console/.
AT
I
__19. Login to the Admin Console with a user and password of 'wasadmin'.
AL
U
__20. Expand the 'Applications Application Types' group in the navigation and click
the link for 'WebSphere enterprise applications'.
EV
__21. Check that you see the HitCount application installed and running.
__22. Open a new web browser and enter the URL http://localhost:9080/HitCountWeb.
__23. Test the application as you did before and make sure it works.
36
__24. Close the web browser you used to test the new application.
__25. In the web browser showing the Admin Console click the Logout link near the top
of the Console.
__26. Close the web browser you were using for the Admin Console.
__27. Stop the application server. Do this with the './stopserver.sh server1' command in
a terminal command prompt in the <WAS_ROOT>/profiles/AppSrv01/bin directory.
Remember that you can use the command with credentials as './stopserver.sh server1
-user wasadmin -password wasadmin'.
__28. Close all open windows.
Part 5 - Review
LY
In this lab you installed a simple application and saw the main steps of installing an
application. Even though most applications will be much more complex and require
more steps during the installation the same basic process will be followed.
You also used the "monitored directory" deployment technique to deploy an application
to the server. This is often used most in development or test servers and is most useful if
the application doesn't need additional configuration during installation. If additional
configuration is needed it might be more desirable to develop a script to deploy the
application instead.
EV
AL
U
AT
I
You also saw how to access properties for installed applications to find out how to submit
web requests for testing. There are many other properties associated with applications
and you only saw a few but others are accessed in the same way, by clicking the name of
the application in the list of applications. In fact all configuration properties and options
available in the Admin Console are accessed in a similar fashion. When you click a link
on one page it displays another page with properties for that item.
37
AT
I
LY
You will be installing the IBM HTTP Server and Web Server Plug-in using the local
configuration which is shown below. In this configuration the web server, plug-in, and
WebSphere server are all on the same machine. Much of the plug-in configuration within
the WebSphere configuration will be done for you using a batch command generated
during the web server installation.
AL
U
EV
3. Route requests for this new host name back to your own machine.
4. Configure applications in the WebSphere Application Server to use this host
name.
38
__2. Open a terminal window. You can do this by selecting 'Applications -> Accessories
-> Terminal'.
__3. In a terminal window, use the 'cd' command to navigate to the <IM_ROOT>
directory.
__4. Issue the following command to start the Installation Manager. Leave the command
prompt open.
# ./eclipse/IBMIM &
LY
Note: We are benefiting from the fact that the Installation Manager was already installed
when WebSphere Application Server was installed. If you were installing the web
server and plugin on a different machine you would also have to install Installation
Manager as well.
You could also record a response file and then install from this as you did with
WebSphere Application Server. We will simply install directly from the Installation
Manager GUI.
AT
I
__5. From the Installation Manager window that appears select 'File Preferences'.
EV
AL
U
__6. Next to the list of repositories click the 'Add Repository' button.
39
LY
__8. Select the 'repository.config' file in this location as shown below and click the OK
button to select the file.
EV
AL
U
AT
I
__9. Back in the Installation Manager, make sure the proper location for the repository
configuration file is listed and click the OK button.
40
__10. Make sure the repository is listed and click the OK button to close the preferences.
LY
__11. Back in the Installation Manager select 'File Open Install Packages'.
__12. On the Install Packages screen check the box next to the following options:
IBM HTTP Server for WebSphere Application Server
EV
AL
U
AT
I
41
__13. Once the above options are selected click the Next button.
__14. After a few seconds the license screen should be shown. Accept the license and
click the Next button.
__15. From the list shown select each package that will be installed and Change the
installation directory so they will be installed to a subdirectory of the '/opt/IBM'
directory. The installation directories should be:
/opt/IBM/HTTPServer
/opt/IBM/WebSphere/Plugins
Customization Toolbox
/opt/IBM/WebSphere/Toolbox
AT
I
LY
EV
AL
U
__16. Write down the installation directory for the HTTP Server as the <IHS_ROOT>
variable in the list of directory paths at the beginning of these labs. Also write down the
Web Server Plug-ins installation directory as the <PLUGIN_ROOT> variable. These
directories will be used later in the labs.
__17. Once your installation directories are configured as shown above click the Next
button.
42
__18. Leave the default features to install and click the Next button.
LY
__19. Check that your Web Server Configuration options show using port 80.
AT
I
__20. Once you have confirmed you see the proper web server configuration options,
leave the default settings and click the Next button.
EV
AL
U
__21. Verify that the options are configured as below and click the 'Install' button.
43
__22. After several minutes installing software you should see a success message. Leave
the option to launch the 'WebSphere Customization Toolbox' selected and click the
Finish button.
__23. Leave the 'WebSphere Customization Toolbox' open for the next section.
__24. Close the Installation Manager by selecting File Exit from the appropriate
window.
LY
After the web server and plug-in software is installed it needs to be configured to link the
web server to the WebSphere Application Server configuration. This is done differently
in WebSphere 8.5 with the 'Web Server Plug-ins Configuration Tool'.
EV
AL
U
AT
I
__1. In the 'WebSphere Customization Toolbox' tool that appeared from the last section,
select the 'Web Server Plug-ins Configuration Tool' and click the Launch Selected
Tool button.
44
Note: If you do not have the WebSphere Customization Toolbox open you can run:
/opt/IBM/WebSphere/Toolbox/WCT/wct.sh
__2. In the tool that appears, next to the empty list of 'Web Server Plug-in Runtime
Locations' click the Add button.
AL
U
AT
I
LY
__3. Fill in a 'Name' value of 'Main Plugin' and use the Browse button to select the
<PLUGIN_ROOT> directory written down in the directory paths from early in this lab.
EV
__4. Once you settings appear as shown above click the Finish button.
45
LY
__5. With the new entry for the plug-in location selected above, click the Create button
next to the empty lower list of 'Web Server Plug-in Configurations'.
EV
AL
U
AT
I
__6. Leave the default option of IBM HTTP Server 8.5 selected and click the Next
button.
46
__7. In the options for the web server configuration file use the Browse button to select
the <IHS_ROOT>/conf/httpd.conf file if it is not already selected and click OK.
EV
AL
U
AT
I
LY
__8. Back in the wizard, make sure that you have the correct configuration file listed and
there is no error in the top margin. Also leave the default port of 80 and click the Next
button.
47
EV
AL
U
AT
I
LY
__9. In the options for the 'Setup IBM HTTP Server Administration Server' fill in a
userid, password and password confirmation of 'ihsadmin'. You may need to manually
expand the window size to see all fields. Leave the other default options and click the
Next button.
Note: This user and password is different than the WebSphere user so that it will be
clear of the difference between them in various situations. This step runs the 'htpasswd'
command from the IBM HTTP Server to configure a user and password that can be used
to remotely administer the web server.
This is also not a user for the operating system but for authentication with the
administration service.
48
LY
__10. On the next page, fill in a 'User ID' and 'Group' of 'ihsadmin'. Leave the option
checked to create a new unique system user ID and click the Next button.
AT
I
Note: This step runs the 'setupadm' command from the IBM HTTP Server to configure
what id will be used to run the HTTP Administration service. This will also change
permissions of various web server configuration directories. This user does have to be a
user on the operating system. If you do not already have a user you would like to use
you can leave the option checked, as we are doing and one will be created.
AL
U
The user from the previous step and this step do not need to be the same ID. This is
done in the labs to keep things simple.
EV
You can also run the htpasswd command from the previous step and the setupadm
command from this step manually. Doing this as part of the plug-in configuration can
be easier as the configuration wizard already knows what directories and files would
need to be modified. If you do not run these commands as part of the installation the
remote administration ability will be disabled until you run the commands manually.
__11. Leave the default value of the web server name and click the Next button.
Note: This is the name that you will see later in the WebSphere Admin Console.
49
LY
__12. Leave the default option of a "remote" scenario and fill in the value for the
<hostname> variable you wrote down in the lab notes section for the WebSphere
installation. You can also open a command prompt and run the 'hostname' command to
get the value. Click the Next button when you have configured the settings on this page.
EV
AL
U
AT
I
Note: Even though the web server and WebSphere server are on the same machine we
are choosing the "remote" scenario here because this will more accurately represent a
configuration where they are on different machines. This way, the steps you use when
they are on different machines will be similar to those done here.
50
LY
__13. Make sure that your settings match those shown below and click the Configure
button.
EV
AL
U
AT
I
__14. Make sure that you get a success message, uncheck the 'Launch the plug-in
configuration roadmap', and then click the Finish button. The roadmap could normally
be used to verify the next steps in the configuration of the web server and plug-in.
Note: Also notice there is a script that was created to configure the web server. This will
be used to configure WebSphere.
51
__15. Check that your new plug-in configuration is listed and select 'File Exit' to exit
the Customization Toolbox.
LY
__20. Change directories using the 'cd' command to the <IHS_ROOT>/bin directory.
Be sure to substitute the value of <IHS_ROOT> from the Directory Paths page at the
beginning of the lab instructions.
AT
I
EV
AL
U
# ./apachectl start
__22. Execute the following command to start the HTTP administration service.
# ./adminctl start
52
Note: Although it is possible to register the IBM HTTP Server and HTTP administration
service to start automatically if the system reboots, we have not done this. If you restart
your machine you will need to execute these commands to be sure the web server and
the HTTP administration service are running. Generally they should remain running
unless you are told to stop or restart it.
__23. Open a File Browser window or use one you already have open.
__24. Navigate to the directory <PLUGIN_ROOT>/bin where the <PLUGIN_ROOT>
is the variable you wrote down from the IBM HTTP Server and Plugin installation in the
previous section.
EV
AL
U
AT
I
LY
__25. Find the file 'configurewebserver1.sh' in the directory. Check that you find the
correct file as there are several that start with 'configure...'.
__26. Copy the 'configurewebserver1.sh' file by right clicking and selecting Copy from
the popup menu.
__27. Open another File Browser and navigate to the directory <WAS_ROOT>/bin
where the <WAS_ROOT> is the variable you wrote down from the WebSphere
installation lab.
__28. Paste the 'configurewebserver1.sh' file into this directory by selecting Edit ->
Paste from the menus.
53
__29. Be sure you see the 'configurewebserver1.sh' file in the list of files.
LY
__30. Make sure you have logged out of any previously open Admin Console browser
windows.
AL
U
AT
I
Note: It is important to logout because you will run a script in the next few steps as the
same user you used in the Admin Console. The script seems to have conflicts in this
situation.
__31. Open a terminal window.
EV
__32. Change directories using the 'cd' command to the <WAS_ROOT>/bin directory.
Be sure to substitute the value of <WAS_ROOT> from the Directory Paths page at the
beginning of the lab instructions.
54
__33. Enter the following command to check that the WebSphere server is started:
# ./serverStatus.sh -all -username wasadmin -password wasadmin
LY
__34. Enter the following command to configure the web server definition in the
WebSphere configuration. The command should all be entered on the same line even
though it wraps to a second line below.
EV
AL
U
AT
I
__35. Scroll back through the messages that were output and be sure you do not see any
errors.
__36. Close any extra command prompts or File Browser windows.
55
EV
AL
U
AT
I
LY
__3. Navigate to the Servers Server Types Web Servers section of the admin
console. Notice there is now a configuration for 'webserver1' which the script you ran
added.
__5. Under the Additional Properties click the link for Configuration File. If you get
an error displaying the configuration file let your instructor know as this likely means
there is a problem with your IHS administration password.
__6. Scroll to the very end of the file and add a few blank lines. It may be a little difficult
to scroll as you will have a scrollbar for the whole page in the browser as well as for the
configuration file itself.
56
__7. Add the following text exactly as it appears below at the end of the configuration
file.
<VirtualHost was.myhost.com>
ServerName was.myhost.com
ErrorLog logs/was.myhost.com-error_log
CustomLog logs/was.myhost.com-access_log common
</VirtualHost>
LY
__8. Check that your configuration appears as below and press the OK button.
__9. Go back to the list of web servers by navigating to the Servers Server Types
Web Servers section of the admin console.
EV
AL
U
AT
I
__10. Check the box next to the webserver1 entry and click the Stop button. Make sure
you get a message about the server stopping.
__11. Check the box next to webserver1 and click the Start button. If you have trouble
starting the web server check your configuration file syntax.
__12. Logout of the Admin Console.
57
LY
__6. If you do not already have a line that starts with the IP address 127.0.0.1 add it.
AL
U
AT
I
__7. Add to this line 'was.myhost.com' with spaces between the IP address and each of
the hostnames. Make sure to add any entries AFTER the real hostname as shown below.
The file should be similar to this:
EV
58
__10. Be sure you can ping the new host name. Enter the command below. Be sure you
dont get an unknown host or request timed out error message.
# ping -c 4 was.myhost.com
LY
EV
AL
U
AT
I
__13. Enter the URL http://was.myhost.com in the address bar of the browser and hit
Return. You should see the homepage of the IBM HTTP Server running on your machine.
If you do not see this screen contact your instructor.
__14. Close out any extra terminal windows, web browsers, or File Browser windows
you may have open.
59
LY
__3. Enter the URL http://localhost/HitCountWeb into the address bar of the web
browser and hit Return. You should see the same application. If you get any errors check
that your web server is running.
AL
U
AT
I
Note: The difference is that the URL above does not list the 9080 port. Because there is
no port listed it sends the request to the default HTTP port which is port 80. This is the
port the web server is listening on. The fact that you got the normal response proves that
the web server can forward requests for the HitCount application to WebSphere through
the Plug-in.
EV
__4. Test the application again to be sure the same behavior is shown even though the
requests are now being forwarded through the Plug-in.
__5. Enter the URL http://was.myhost.com/HitCountWeb/ into the address bar of the
web browser and hit Return. Again you should see the same HitCount application. This
is because you have configured the web server to respond to the host name
was.myhost.com. It can also forward requests for this host name to WebSphere.
Note: The hit count will be reset because it was associated with your web session that
was linked to the 'localhost' hostname. When you use a new hostname of
was.myhost.com the browser starts a new web session.
__6. Close the web browser you have been using to test.
60
EV
AL
U
AT
I
LY
__6. Press the View button next to the Plug-in configuration file name.
__7. Search through the configuration for the VirtualHostGroup element. This has the
definition of several VirtualHosts. These are the host name and port combinations the
Plug-in can expect to receive requests for. The host name is listed as an asterisk (*) right
now which means the Plug-in will accept requests for any host name the web server
responds to.
61
__8. Search through the configuration for the Server element. Within this element you
will see Transports which have values for the host name and port numbers of the
Application Server. This is how the Plug-in knows what host name and port to use to
forward requests to the Application Server.
LY
Note: The syntax for the server section in the Plug-in configuration can be confusing.
The parent tag in the configuration is ServerCluster. You do not have a cluster of
servers right now. This term is only used so that if you did have a cluster of servers in a
Network Deployment Cell the syntax of the Plug-in configuration would be the same.
Right now your Plug-in is configured as if you have a cluster with only one server in
it.
AL
U
AT
I
__9. Search through the configuration for the UriGroup element. Within this element
you should see an entry for '/HitCountWeb/*'. This is the entry that indicates the Plugin can forward requests to the HitCount application.
EV
__10. Search through the configuration for the Route entry. This links together the three
other parts of the Plug-in configuration you have looked at so far.
Note: The Route is probably the most important part of the configuration. This is
what the Plug-in uses to make decisions about what requests to forward and how. The
Route indicates that if a request comes in for a host name and port listed by the
VirtualHostGroup and for an application listed in the UriGroup that the request should
be forwarded to a server in the ServerCluster.
__11. Click the OK button on the bottom of the Plug-in configuration to close the view of
the configuration file.
62
AL
U
AT
I
LY
__2. Notice that right now there are only two virtual hosts. One is the default_host
that you saw in the Plug-in configuration. The other is an admin_host that is used
only for the Admin Console.
__3. Click the New button above the list of virtual hosts.
EV
__4. Fill in a Name of myhost for the new virtual host and press the Apply button. Make
sure you hit the Apply button as the OK button will not keep you on the same screen.
63
__5. To the right under Additional Properties, click the link for Host Aliases.
__6. Right now there are no host aliases. Click the New button above the empty list of
host aliases.
__7. Change the Host Name to was.myhost.com and leave the default port of 80. Click
the OK button when you have the properties filled in as below.
AT
I
LY
__8. The new host alias now appears in the list. This is now the ONLY host name and
port that applications mapped to this virtual host will recognize.
EV
AL
U
__9. Click on the Save link in the list of messages near the top of the main Console area.
__10. In the navigation area of the Console expand the Applications Application
Types group and click the link for WebSphere enterprise applications.
__11. Click the link for the HitCount application.
64
__12. In the list of Web Module Properties on the right click the link for Virtual hosts.
__13. Use the drop down next to the HitCountWeb Web module to select the myhost
Virtual host from the list. Press the OK button when you have the properties set as
below.
__14. Back on the screen for the HitCount application, click the link for Manage
Modules in the Modules section of properties.
AL
U
AT
I
LY
__15. Notice that the Web module is already mapped to the webserver1 web server AND
the server1 Application Server. This indicates that requests for that application will pass
through the webserver1 web server on the way to server1. This is a critical setting for
configuring the web server Plug-in configuration for webserver1.
EV
Note: This mapping was already done for you even though you did not do it. This was
done by the script that you ran to configure the web server in the WebSphere
configuration. The script automatically mapped all of the applications that were
currently installed to the web server definition that it created for the Plug-in.
In the future, when you install applications that have Web modules, mapping them to a
web server will be an important step.
__16. Click on the Save link in the list of messages near the top of the main Console area.
65
__17. In the navigation panel on the left expand the Servers Server Types group and
click the link for Web Servers.
__18. Check the checkbox next to webserver1 and click the Generate Plug-in button.
AL
U
AT
I
LY
__19. Check the checkbox next to webserver1 and click the Propagate Plug-in button.
EV
66
LY
.............
AT
I
__24. When you are done looking at the new Plug-in configuration, click the Logout link
in the Admin Console.
AL
U
EV
Now that you have configured a new virtual host with only one host name and port
combination and associated the HitCount application with it you will want to see how this
affects the behavior of the application. No longer will you be able to send requests using
any host name or port besides was.myhost.com on port 80.
__1. Open a terminal window.
__2. Use the 'cd' command to change to the <WAS_ROOT>/profiles/AppSrv01/bin
directory. Be sure to substitute the value of <WAS_ROOT> from the Directory Paths
page at the beginning of the lab instructions.
67
Note: You need to restart the Application Server because some of the configuration
changes you just made are only read when the server starts.
__5. Open a web browser and enter the URL http://was.myhost.com/HitCountWeb/
into the address bar of the web browser and hit Return. You will see the normal output of
the HitCount application. This is expected since the application is still registered to
respond to this host name and port combination.
LY
__7. Notice the URL that appears in the browser for the page that displays the messages.
It is:
EV
AL
U
AT
I
http://was.myhost.com/HitCountWeb/HitCountServlet
68
__8. Enter the following URLs into the web browser that have worked before:
http://localhost/HitCountWeb
http://localhost:9080/HitCountWeb
http://was.myhost.com:9080/HitCountWeb
LY
Notice that all of these URLs now generate various page cannot be found 404 errors.
This is because these host name and port combinations are not listed as host aliases of the
virtual host that the HitCount application is mapped to. This is true even for URLs that
use the direct WebSphere port of 9080 and do not try to go through the web server.
AL
U
AT
I
Note: Using the 'Virtual Host' configuration in WebSphere is one way to control exactly
how clients can access an application. If web applications are configured to be available
through web servers and/or proxy servers for security reasons this configuration will
prevent users from bypassing that route to the application, even for "internal" users.
EV
__9. Close the web browser you were using for testing.
69
__3. In the navigation area of the Console expand the Applications Application
Types group and click the link for WebSphere enterprise applications.
__4. Click the link for the HitCount application.
__5. Under the Detail Properties section, click the link for View Deployment Descriptor.
LY
__6. Make sure all the entries are expanded and locate the 'context-root' element. This
forms the first part of the URL that comes after the host name and port. Notice this also
mentions a 'HitCountWeb.war' module for the application.
EV
AL
U
AT
I
__7. In the breadcrumb trail at the top of the page click the link for the HitCount
application. This will take you back to the properties of the application configuration.
__8. At the top of the page of properties for the HitCount application click the link for
Manage Modules under the Modules section of properties.
70
__9. In the list of modules click the link for the HitCountWeb module.
__10. On the right side, click the link for View Deployment Descriptor.
AT
I
LY
__11. Make sure all the entries are expanded and locate the 'servlet-mapping' element.
This links the servlet in the application to the URL suffix '/HitCountServlet'.
__12. Logout of the Admin Console and close the web browser.
EV
AL
U
__13. Stop the Application Server using the './stopServer.sh server1' command in a
command prompt in the <WAS_ROOT>/profiles/AppSrv01/bin directory. Remember
that you can use the command with credentials as './stopServer.sh server1 -user
wasadmin -password wasadmin'.
Note: You now know how to read the URLs used to access application components.
These are of the form:
<protocol>://<hostname>:<port>/<context root>/<URL mapping>
Applying this to the HitCountServlet URL:
http://was.myhost.com/HitCountWeb/HitCountServlet
<protocol> - HTTP
<hostname> - was.myhost.com
<port> - 80, this is the default HTTP port if none is listed
<context root> - HitCountWeb
<URL mapping> - /HitCountServlet
71
Part 10 - Review
This lab showed several different aspects of using web servers with WebSphere. The first
sections involved installing and configuring the IBM HTTP Server. This included
configuring the web server to respond to a virtual host which was different than the
actual host name of your machine. You also had to modify the network setup of your
machine to be sure that the requests for this host name would be routed back to your
machine and not sent out to the network.
The next sections tested the web server Plug-in. Because most of the initial setup of the
Plug-in was done by the plug-in customization and the script you ran there was not much
to do immediately after the script to get it to work. You also became familiar with how to
read the Plug-in configuration and discovered how the Plug-in will forward requests for
applications.
LY
In the last set of sections you reconfigured the HitCount application so it would only
respond to requests sent to the was.myhost.com host name on port 80. This may be
required when you need to have more control over how applications respond to requests.
The first step in this was to create a new virtual host and host alias that only included the
desired host name and port. You then changed the configuration of the HitCount
application to use this new virtual host. After restarting the servers you saw how these
settings restrict the host name and ports that you can use to submit requests.
EV
AL
U
AT
I
You also saw how to obtain some basic information about the internal settings of an
application using the Admin Console to view the deployment descriptors.
72