Installation
There are several ways to install the Liberty profile. In this chapter, we focus on the installation methods that are most commonly used for setting up a development environment.
The Liberty profile is designed for easy operation using the provided scripts and direct editing of the server configuration XML files. The development tools provide an integrated development environment (IDE) for application development with plenty of assistance and short-cuts to aid creating, modifying, and controlling Liberty profile servers. The development tools make development easier but are not strictly required, and if you prefer, you can just install the run time.
The chapter contains the following sections:
For more installation methods, including installation for production, refer to the following IBM Knowledge Center website:
2.1 Installing the WebSphere developer tools
WebSphere Application Server Developer Tools for Eclipse is a lightweight set of tools for developing, assembling, and deploying applications to the WebSphere Application Server Liberty profile. These tools should be installed into your Eclipse workbench. Additionally, you can use IBM Rational Application Developer V9, which has WebSphere Developer Tools integrated.
For supported Eclipse versions and more installation methods, refer to the following IBM Knowledge Center website:
There are a number of different ways to install the WebSphere Application Server Developer Tools for Eclipse into your development environment including:
Through the Eclipse Marketplace
Using the WASDev site
With a downloaded installation file
2.1.1 Installation from Eclipse Marketplace
You can install IBM WebSphere Application Server Liberty Profile Developer Tools for Luna directly from the Eclipse Marketplace by completing the following steps:
1. Start the Eclipse integrated development environment (IDE) for Java EE Developers workbench.
2. Click Help → Eclipse Marketplace (Figure 2-1).
Figure 2-1 Eclipse Marketplace menu item
3. In the Find field, type WebSphere liberty and then click Go.
4. In the list of results, locate IBM WebSphere Application Server Liberty Profile Developer Tools for Luna and then click Install (Figure 2-2).
Figure 2-2 Eclipse Marketplace search for WebSphere Liberty
5. On the Confirm Selected Features page, expand the parent nodes and select the features that you want to install. When you are finished, click Confirm (Figure 2-3).
The following features are available:
 – Open Services Gateway initiative (OSGi) Application Development Tools
 – Web Development Tools
 – Web Services Development Tools
 – WebSphere Application Server Liberty Profile Tools
Figure 2-3 Liberty features
6. On the Review Licenses page, review the license and if you agree to the terms, click I accept the terms of the license agreement. Then, click Finish. The installation process starts.
 
Tip: During the installation, a security warning dialog box might open and display the following warning:
“Warning: You are installing software that contains unsigned content. The authenticity or validity of this software cannot be established. Do you want to continue with the install?”
You can safely ignore the message and click OK to continue.
7. When the installation process completes, restart the workbench.
2.1.2 Installation from the WASdev community site
You can install the WebSphere developer tools by using the links that are provided on the WASdev community site if you are using Eclipse 3.7.2 or later. Use the following steps to download the toolset:
1. Start the Eclipse IDE for Java EE Developers workbench.
2. Open a web browser to http://wasdev.net and click the download tab.
3. Select the appropriate version of the WebSphere Application Server Developer Tools from the downloads page (Figure 2-4 on page 41).
Figure 2-4 IBM WebSphere Liberty Repository
4. Locate WebSphere Application Server Developer Tools for Eclipse and click Download for your version of Eclipse.
5. Locate the Install icon for WebSphere Application Server Liberty Profile (Figure 2-5).
Figure 2-5 WebSphere Developer Tools Install buttons
6. From the browser window, drag the Install icon to the toolbar of your Eclipse workbench. This starts the installation process and opens a dialog box.
7. On the Confirm Selected Features page, expand the parent node and select the features that you want to install.
The following features are available:
 – OSGi Application Development Tools
 – Web Development Tools
 – Web Services Development Tools
 – WebSphere Application Server Liberty Profile Tools
When you are finished, click Confirm (Figure 2-6).
Figure 2-6 Liberty features
8. On the Review Licenses page, review the license and if you agree to the terms, click I accept the terms of the license agreement. Then, click Finish. The installation process starts.
 
Tip: During the installation, a security warning dialog box might open and display the following warning:
“Warning: You are installing software that contains unsigned content. The authenticity or validity of this software cannot be established. Do you want to continue with the install?”
You can safely ignore the message and click OK to continue.
9. When the installation process completes, restart the workbench.
2.1.3 Installation from downloaded installation files
You can install the IBM WebSphere Application Server Liberty Profile Developer Tools for Luna into an existing Eclipse workbench. This is facilitated by using the installation files that you download to your computer.
If you run the system disconnected from the Internet, Eclipse requires some prerequisite files. For detailed instructions about how to perform this installation and details about the additional prerequisite Eclipse files, refer to the following IBM Knowledge Center website:
2.2 Installing the Liberty profile
To serve your applications, you must install the Liberty profile runtime environment. The environment is the same whether you are using it for development, test, or production. The WebSphere developer tools integrate with the Liberty profile to give you a seamless, integrated development environment that can aid you in developing and testing your applications.
2.2.1 Installation using the Liberty profile developer tools
The Liberty profile runtime environment can be installed directly from within the Liberty profile developer tools. Installing in this manner also creates an initial server.
 
Tip: During the configuration of the run time and server, you are prompted to provide names for similar items, which can cause confusion. The following are the names that you will be asked to define, in the order you encounter them:
Server Host Name The name of the machine running the server or local host.
Server Name The name of the server as it will be known by Eclipse. This should not be confused with the actual server created in the Liberty profile.
Liberty Profile Server Name The name of the server that will be created in the Liberty profile runtime environment. This is your actual Liberty Profile Server.
The following steps for installing the Liberty profile and server assume that you have already installed the tools that are described in 2.1, “Installing the WebSphere developer tools” on page 38:
1. Start Eclipse with WebSphere developer tools installed (or Rational Application Developer V9).
2. Select File → New → Other.
3. In the Wizards text box, either browse to Server → Server or type server in the filter field. Select the Server icon and then click Next (Figure 2-7).
Figure 2-7 Selecting the server installation wizard
4. Expand IBM and select WebSphere Application Server Liberty Profile from the available server list, as shown in Figure 2-8. Provide the Server’s host name and the Server name that you want displayed in the workbench, and click Next.
Figure 2-8 Defining the Liberty profile for a new server
5. If you installed a Liberty profile runtime environment, you can select Choose an existing installation and browse to select the Liberty profile runtime installation location. This example does not have a Liberty runtime environment that is installed, so one needs to be installed. To do so, select Install from an archive or a repository and click Next (Figure 2-9).
Figure 2-9 Install from an archive or a repository
6. In the Install Runtime Environment, start by entering a path for where you would like the runtime installation.
7. If you previously downloaded a Liberty profile runtime archive file from IBM Passport Advantage® or WASdev.net, you can select the downloaded archive using the first option of Install a new runtime environment from an archive. In this example, we are downloading directly from the IBM website. Choose the second option Download and install a new runtime environment from ibm.com, select the wanted version of Liberty Profile Runtime, and click Next (Figure 2-10).
Figure 2-10 Select the Liberty runtime
8. On the Install Add-ons page, select any additional features that you want added to your server installation. The additional features include open source packages and the extended version of the Liberty profile, which adds extra capabilities, including JMS and Web Services. Click Next (Figure 2-11).
Figure 2-11 Install optional server add-ons
9. Accept the license agreements, and then click Next.
10. Enter the wanted Server name and click Finish (Figure 2-12).
Figure 2-12 Enter the Server name
11. The Liberty profile runtime environment is downloaded and installed.
12. When setup is complete, you see the new server and runtime environment displayed in the Servers view of your workbench. Figure 2-13 shows the newly created server that is expanded.
Figure 2-13 The new server shown in the Servers view
 
Tip: It is also possible to use the WebSphere Developer Tools to do debugging on remote Liberty servers. This requires additional configuration to define where the remote server is running.
2.2.2 Installation using the command line
If you have obtained the Liberty profile runtime environment from WASdev.net or through Passport Advantage, you have downloaded a JAR file. The JAR file has a name similar to wlp-runtime-8.5.5.6.jar.
Installing the runtime environment
To install the Liberty profile, you must extract the archive file by completing the following steps:
1. Run the following command to extract the contents of the Liberty archive:
java -jar wlp-runtime-8.5.5.6.jar
2. Press x to skip reading the license terms or press Enter to view them.
3. Press Enter to view the license agreement.
4. Press 1 if you agree to the license terms and are ready to proceed.
5. Provide the installation path for the Liberty profile, for example:
C:IBMWebSphere
6. Press Enter.
The server is installed into a wlp directory within the install directory that is specified in step 5. If you did not specify an installation location, it installs to the current directory.
Creating a server
The Liberty profile runtime environment does not come with a server defined. To create a server, you must run the following command (Figure 2-14) from the Liberty profile bin directory (wlp/bin):
server create <server name>
Figure 2-14 Create server command
This creates a server, with the provided name, in the usr/servers directory.
 
Tip: A Liberty profile runtime environment can contain multiple servers. You do not need to install multiple run times onto a machine to run multiple servers.
Server name is an optional parameter. If you do not specify a server name, defaultServer is used.
Adding the new server and runtime environment into the tools
To use the Liberty profile developer tools with your new runtime and server, you must add them into the tools. This can be done by following the instructions in 2.2.1, “Installation using the Liberty profile developer tools” on page 43. Then, select your run time and server at the relevant steps.
Installing using a compressed file
It is also possible to install the runtime using a compressed file. In this example, version 7 of the web profile has been extracted to the local file system using a compressed utility. Other compressed distributions include the javaee7 and osgi bundles.
The example in Figure 2-15 shows the creation of a test server and the feature list for the expanded environment.
Figure 2-15 Web profile feature list
2.2.3 Installation on z/OS
IBM Installation Manager is used to install the Liberty profile on z/OS using a part of the com.ibm.websphere.liberty.zOS.v85 package offering. Use the latest version of IBM Installation Manager that is supported by your Liberty profile distribution. For more information about installing IBM Installation Manager on z/OS, refer to the following website:
To install the Liberty profile, install the package with the Liberty feature by running the following imcl command of IBM Installation Manager (Example 2-1).
Example 2-1 Installing Liberty profile using IBM Installation Manager on z/OS
MTRES1 @ SC49:/u/mtres1/IIM/tools>./imcl install com.ibm.websphere.liberty.zOS.v85 -installationDirectory -repositories /u/mtres1/kits/8556/repository/ -acceptLicense
Installed com.ibm.websphere.liberty.zOS.v85_8.5.5006.20150425_1310 to the /u/mtres1/IBM directory.
MTRES1 @ SC49:/u/mtres1/IIM/tools>
The following folders are created during the installation process:
bin
java64
lib
wlp
java
lafiles
properties
 
If only core.feature is selected, which is the default, the Liberty profile is not installed. If core.feature is selected along with the Liberty profile feature, both WebSphere Application Server and Liberty profile are installed. To view the version of the server you are using, run the server version command and to view the list of features you are using.
After the WebSphere Application Server is installed without Liberty, it is not possible to add the Liberty profile feature. You get an exception, shown in Example 2-2.
Example 2-2 Error adding Liberty profile to existing WebSphere Application Server installation on z/OS
CRIMA1155E ERROR: Error modifying.
ERROR: The WebSphere Application Server and WebSphere Application Server Liberty Profile features cannot be added to or removed from an existing package group after installation.
Installation Manager cannot modify the application server features of an existing package group. To add features, use Install and include them in a new package group. To remove features, use Uninstall to completely remove the entire package group.
 
Note: On z/OS, create your Liberty server configurations in a location independent of the installed Liberty profile. Do not use the usr subdirectory (wlp/usr).
2.2.4 The Liberty profile runtime environment and server directory structure
The location of the various files and directories that make up the Liberty profile runtime environment and server are important. You must become familiar with these files to configure and deploy applications to the server.
Runtime directory structure
Figure 2-16 provides an overview of the directory structure that is used by the Liberty profile runtime environment. The directory structure and location of files are essential for the healthy running of your servers.
Figure 2-16 The Liberty runtime directory structure
Here are the most important Liberty runtime directories:
bin
This directory contains scripts that are used to manage the Liberty profile server and server instances.
etc
This directory is optional. It can be used for customization of the whole Liberty profile installation. The configurations that are defined by files in this directory apply to all Liberty profile servers.
lib
This directory contains the Liberty runtime libraries.
templates
This directory contains sample configuration files and a sample server.xml file for the Liberty profile.
usr
This directory contains the server instances with their configuration and applications and any resources that can be shared between servers. The usr directory is user-owned and as such is not modified by any service releases.
Server directory structure
Similar to the runtime directory structure, it is essential that you become familiar with the location and layout of the Liberty profile server files and directories (Figure 2-17).
Figure 2-17 The Liberty server directory structure
Here are the most important Liberty profile server directories:
apps
This directory is optional. It can contain deployed applications or application descriptors if they are deployed using the WebSphere developer tools.
dropins
Applications can be added and removed to the liberty server simply by dropping them into this folder. This directory is constantly monitored by the server to identify any changes and add or remove an application when the changes occur.
logs
Contains the logs that are produced by the Liberty profile server. By default, this is the place where the trace or message logs are written. It also contains the first-failure data captures (FFDCs).
resources
Contains additional resources for the Liberty profile server instance. For example, keystores that are generated by the Liberty profile server are in this directory.
tranlog
Contains the transactional logs that are produced by the server run time and the applications. The transactional logs are used to commit or roll back transactional resources if there is a server failure.
workarea
Contains the Liberty profile server operational files; is created during the first server run.
2.3 Configuring the server runtime JDK
The Liberty profile requires a Java Runtime Environment (JRE) to run in. The Liberty profile server runs on Java version 6 or above provided by any vendor. A full list of supported Java versions is noted in the following System Requirements document:
The following sections describe the ways that you can define which JRE is used.
2.3.1 Defining the JRE from within workbench
When running a server through the workbench, the JRE to be used is defined in the server properties. When you created the server in Eclipse, you could define the JRE. To change the JRE, complete the following steps:
1. Switch to the Servers view in the workbench.
2. Right-click your server and select Open (Figure 2-18).
Figure 2-18 Opening a Server Properties window
3. Select the Runtime Environment link (Figure 2-19).
Figure 2-19 Opening the Runtime Environment properties
4. A window is displayed allowing you to change the runtime environment, including changing your JRE (Figure 2-20). After you are satisfied with your changes, click Finish.
Figure 2-20 Edit Server Runtime Environment window
5. Save the changes to the Server properties. The new settings are used when you next start the server.
 
Caution: If you created a server.env file that defines the JRE (either for the server or for the run time), this takes preference over the Eclipse setting. You must remove this file in order for the Eclipse setting to work.
2.3.2 Configuring the system JRE
When starting the Liberty server using the command line, the server must know where to find its JRE. In the absence of any server or runtime configuration files that define the JRE, the system JRE is used.
On Windows systems, you can use Example 2-3 to set the JAVA_HOME property, so the Liberty server uses your own JRE installation directory.
Example 2-3 Setting the JRE for Liberty on Windows
set JAVA_HOME=C:IBMjre6
set PATH=%JAVA_HOME%in;%PATH%
On Linux Systems, you can use Example 2-4 to set the JAVA_HOME property.
Example 2-4 Setting the JRE for Liberty on Linux
export JAVA_HOME=/opt/IBM/jre6
export PATH=$JAVA_HOME:$PATH
The Liberty profile runtime environment searches for the Java command in the following order of properties: JAVA_HOME, JRE_HOME, and PATH.
2.3.3 Using server.env to define the JRE
The server.env file is a Liberty profile-specific configuration file that can be used to define the JRE for the servers to use. When you install the Liberty profile this configuration file does not exist, so you must create it. Create the file in one of the following locations:
${wlp.install.dir}/etc/server.env
The settings here apply to all servers in the runtime environment.
${server.config.dir}/server.env
These settings are specific to the server containing the file. This server.env is used in preference to the runtime level when both exist.
To define the JRE, add the following line into the server.env file:
JAVA_HOME=<path to your JRE>
You can use the server.env file to provide any other additional environment variables that your server might need.
 
Caution: The server.env files support only key=value pairs. Variable expansion is not supported.
2.3.4 Specifying JVM properties
You can use the jvm.options files at the runtime and server levels to specify jvm-specific start options, for example, -X arguments. The options are applied when you start, run, or debug the server. Be sure to specify only one option per line.
When you install the Liberty profile, this configuration file does not exist, so you must create it. Create the file in one of the following locations:
${wlp.install.dir}/etc/jvm.options
The settings here apply to all servers in the run time.
${server.config.dir}/jvm.options
These settings are specific to the server containing the file. This jvm.options file is used in preference to one at the runtime level when both exist.
2.4 Starting and stopping a Liberty profile server
You can control the state of the Liberty profile server either from the command line or through the workbench. We describe the two methods in this section.
2.4.1 Starting and stopping the server by using the command line
The server can be controlled from a single server command that is in the ${wlp.install.dir}/bin directory. The following commands can be used to start and stop the server:
server start <servername>
Starts the server running in the background
server run <servername>
Starts the server running in the foreground and writes the console output to the window. To stop the Liberty profile server in this mode, press Ctrl+c or kill its process or run server stop from another command window.
server debug <servername>
Starts the server in debug mode.
server stop <servername>
Stops the server.
server status <servername>
Displays the current state of the server.
 
Hint: If the workbench is open and it has the Liberty profile server already defined, it automatically updates. Updates reflect the status of the server and show the output from the server in the console window.
2.4.2 Starting and stopping the server from the workbench
You can control the state of the Liberty profile server from directly within the workbench. This can be done from the Server view. Either right-click the server and select the required option, or click the icons that are attached to the Server view, as shown in Figure 2-21.
Figure 2-21 Starting the server by using the start button
The following buttons are available to control the server:
Starts the server in debug mode.
Starts the server.
Stops the server.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset