Skip navigation.
Downloads | Product Documentation | Support

Creating Templates and Domains Using the pack and unpack Commands

# How Do I...?

This section provides information and examples for creating templates and domains using `pack` and `unpack`:

- Creating and Starting a Managed Server on a Remote Machine: Main Steps
- How Do I: Use pack to Create a Managed Server Template
- How Do I: Use unpack to Create a Managed Server on a Remote Machine
- How Do I: Start Managed Servers on a Remote Machine

# Creating and Starting a Managed Server on a Remote Machine: Main Steps

In some domains, you may want to run a Managed Server on a machine that is remote from the Administration Server for the domain. You can do so by using the `pack` command to create a Managed Server template (a `.jar` file that, by default, contains only the files necessary to create a Managed Server domain directory), copying the template to the remote machine, and unpacking the template to create a domain directory customized for a Managed Server.

Note: You must create the Managed Server domain directory on the remote machine that matches the definition of the Managed Servers specified in the template.

The steps to create a Managed Server on a remote machine are as follows:

1. Create a Managed Server template using the `pack` command. A Managed Server template, by default, contains only those files necessary to create a Managed Server on a remote machine. For instructions, see How Do I: Use pack to Create a Managed Server Template.
2. Create a Managed Server by copying and unpacking the Managed Server template on a remote machine. For a detailed procedure, see How Do I: Use unpack to Create a Managed Server on a Remote Machine.
3. Start the Managed Server on the remote machine. For a detailed procedure, see How Do I: Start Managed Servers on a Remote Machine.

# How Do I: Use pack to Create a Managed Server Template

You create a Managed Server template by executing the `pack` command, with the `-managed=true` option, on an existing domain that already includes the definition of one or more Managed Servers. This domain must also contain Managed Server definitions in the `config.xml` file.

1. From the command line on the local machine (that is, the machine that contains the Administration Server and the definition of Managed Servers), navigate to the `WL_HOME``\common\bin` directory. In this pathname, `WL_HOME` is the product directory in which you installed WebLogic Server.
2. Execute the following command:

>     pack -managed=true -domain=full_path_to_domain
>     -template=full_path_to_template.jar -template_name="template_name"

In this command line:

- `full_path_to_domain`—The full path to the domain from which the template is to be created.
- `full_path_to_template``.jar`—The full path to the template, and the filename of the template to be created.
- `template_name`—Descriptive name for the template enclosed in quotes.

For example, executing the following command creates a Managed Server template named `mydomain_managed.jar` from a domain named `mydomain`.

>     pack -managed=true -domain=C:\bea\user_projects\domains\mydomain
>     -template=C:\bea\user_templates\mydomain_managed.jar
>     -template_name="My Managed Server Domain"

For a complete description of the `pack` command, see pack.

# How Do I: Use unpack to Create a Managed Server on a Remote Machine

1. Install WebLogic Server on each machine that you want to host a Managed Server for the domain.

Note: All WebLogic Server instances within a domain must run the same version of the WebLogic Server software. For more information about installing WebLogic Server, see the Installation Guide.

2. Establish a session with the remote machine that will host the Managed Server. You may use any valid method, such as telnet, to do so.

Note: The IP address and port number of the remote machine must match the definition of the Managed Servers specified in the Managed Server template.

3. Copy the Managed Server template to the remote machine. For details about how to create a Managed Server template, see How Do I: Use pack to Create a Managed Server Template.
4. On the remote machine, navigate to the `WL_HOME``\common\bin` directory. In this pathname, `WL_HOME` is the product directory in which you installed WebLogic Server.
5. Execute the following command, using the Managed Server template that you copied to the machine in Step 3.

>     unpack -domain=full_path_to_domain -template=full_path_to_template.jar

In this command line:

- `full_path_to_domain`—The full path to the domain to be created.
- `full_path_to_template``.jar`—The full path to the template from which the domain is to be created.

For example, executing the following command using a template named `mydomain_managed.jar` creates a domain named `myManagedDomain`.

>     unpack -domain=C:\bea\user_projects\domains\myManagedDomain
>     -template=C:\bea\user_templates\mydomain_managed.jar

# How Do I: Start Managed Servers on a Remote Machine

When you create a domain directory for Managed Servers using the `unpack` command, it contains a customized start script for each Managed Server targeted to the current remote machine. For example, if you create a domain that contains two Managed Servers, `my_managed_server1` and `my_managed_server2`, and you target the servers to machine `m1`, when you create the Managed Server domain directory on machine `m1`, four custom start scripts are created: `startmy_managed_server1.cmd`/`startmy_managed_server1.sh` and `startmy_managed_server2.cmd`/`startmy_managed_server2.sh`. You can use these scripts to start the corresponding Managed Servers. Alternatively, you can use the `startManagedWebLogic` script with the required parameters.

1. Start the Administration Server for the domain as described in "Starting and Stopping Servers" in Managing Server Startup and Shutdown at `http://e-docs.bea.com/wls/docs90/server_start/overview.html`
2. On the remote machine, navigate to the directory for the domain that you created in How Do I: Use unpack to Create a Managed Server on a Remote Machine.
3. Start the Managed Server on the remote machine by doing one of the following:

- On a Windows system, open an MS-DOS command prompt window and enter one of the following at the prompt:

`start` `my`_`managed_server`

`startManagedWebLogic` `my_managed_server``` `admin-url`

- On a UNIX system, enter one of the following at the prompt:

`./start` `my_managed_server``.sh`

`./startManagedWebLogic.sh` `my_managed_server``` `admin-url`

In these command lines, `my_managed_server` is the name of the Managed Server to be started and `admin-url` specifies the listen address (host name or IP address) and port number of the machine hosting the Administration Server. For your convenience, the `startManagedWebLogic_Readme.txt` file provides a list of all the Managed Servers and the `admin-url` for the domain.

Note: You can also start Managed Servers using the Node Manager. For details, see "Using Node Manager to Control Servers" in Managing Server Startup and Shutdown at `http://e-docs.bea.com/wls/docs90/server_start/nodemgr.html`.