This topic applies to WebSphere Application Server Liberty V8.5.5.9 and earlier. For the latest Liberty topics, see the WebSphere Application Server Liberty documentation.

Packaging a Liberty server from the command line

From the command line, you can create a compressed file that contains a Liberty runtime environment, the files in the shared resources directory, a specific server, and the applications that are embedded in the server. You can also choose to exclude the runtime binary files from the compressed file.

About this task

The Liberty server is lightweight, and therefore you can easily package a server installation in a compressed file. You can store this package, distribute it to colleagues, and then use it to deploy the installation to a different location or to another machine, or even embed the installation in a product distribution.

The server installation that you want to package cannot already be joined to a collective. You can only package a stand-alone server.

For distributed platformsNote: The resulting file is created by using UTF-8 encoding for entry names, so the tool that you use to open the file must be able to use UTF-8 encoding for entry names. The jar command in a Java™ SDK uses this format.

Procedure

To package a Liberty server from the command line, complete the following steps:

  1. Open a command line, then change directory to the wlp/bin directory.
  2. Stop the server.
  3. Run the package command to create a package.

    [8.5.5.5 or later]You can package the Liberty profile server or the runtime.

    • Package the Liberty server.

      [Updated in November 2013]The default archive format is .zip on all platforms apart from z/OS® where it is .pax. You can also generate a .jar archive. [Updated in November 2013]

      If you do not specify a server name, defaultServer is used. If you do not specify the --archive parameter, the value of server_name is used for package_file_name, and the compressed file is created in the ${server.output.dir} directory.

      Choose the correct command for your environment.

      • For distributed platformsFor IBM i platforms

        Use this command to generate a .zip archive.

        server package server_name --archive=package_file_name.zip --include=all

        where package_file_name.zip is a file name that you choose. This file name can include a full path name. If the full path is omitted, a compressed file called package_file_name.zip is created in the ${server.output.dir} directory.

      • For distributed platformsFor IBM i platforms

        Use this command to generate a .jar archive. The advantage of a .jar archive is that the scripts in the bin directory keep their permissions, so they are executable when the package is installed.

        server package server_name --archive=package_file_name.jar --include=all
        where package_file_name.jar is a file name that you choose.

        For more information about extraction options with this archive file, see Java archive file extraction options.

      You can also use the --include option with this command. For example, the --include=all option packages the runtime binaries and the relevant files in the ${WLP_USER_DIR} directory; the --include=usr option packages only relevant files in the ${WLP_USER_DIR} directory, effectively excluding the runtime binaries from the compressed file.

      [Updated in November 2013]The --include=usr option is not valid with an archive format of .jar.[Updated in November 2013]

      If you use the --include=minify option, the server command packages only those parts of the runtime environment, and files in the ${WLP_USER_DIR} directory, that are required to run the server. This option significantly reduces the size of the resulting archive.

      The parts of the runtime environment that are retained by the minify operation depend on the features that are configured in the server that you are packaging. Only those features that are required to run the server are retained, and the remaining features are removed. Therefore, you cannot later enable a feature that has been removed. For example, if only the servlet-3.0 feature is retained, you cannot later enable the jpa-2.0 feature.

      You can repeat the minify operation to further reduce the size of the archive if the configuration is changed. There is, however, no reverse operation for the minify operation, so if you later require one or more features that have been removed, you must begin again with a complete Liberty server.

      While the minify operation is running, the server is temporarily started, and you see the associated messages. For this reason, you cannot use the --include=minify option with a server that is not able to be started, but you can package it with the --include=all or --include=usr options.

      You can specify the operating systems that you want the packaged server to support by using the --os option with the --include=minify option.

      For example, to package a server with z/OS support removed, use the following command:
      server package --archive="nozos.zip" --include=minify --os=-z/OS
      To package a server with OS/400® support retained, but z/OS support removed, use the following command:
      server package --archive="small.zip" --include=minify --os=OS/400,-z/OS
      To package a server that supports only Linux, use the following command:
      server package --archive="linux.zip" --include=minify --os=Linux
    • [8.5.5.5 or later]Package the Liberty runtime.

      Create a runtime archive that contains the wlp directory, but does not contain the usr directory. The naming convention for a server package is package_name.zip; for example, CustomerPortalApp.zip. To create a runtime archive, run the package command without a server name and with the --include=wlp option:

      server package --include=wlp

      To specify a package file name and target location, add the --archive=package_path_name option; for example:

      server package --include=wlp --archive=c:\temp\myPackage.zip

      If you do not specify a valid package name or target location with the --archive option, then the command creates the wlp.zip runtime archive in the $WLP_OUTPUT_DIR location, which is the ${wlp.install.dir}/usr/servers directory by default. The target location must exist before running the command. Thus, if the target location is c:\temp, the C:\temp directory must exist and have write permission for the command to write the archive to the C:\temp directory.


Icon that indicates the type of topic Task topic



Timestamp icon Last updated: Tuesday, 12 December 2017
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-libcore-mp&topic=twlp_setup_package_server
File name: twlp_setup_package_server.html