Tutorial: Manually install WebLogic Server on Azure Virtual Machines (VMs)

This tutorial shows the steps to install Oracle WebLogic Server (WLS) and configure a WebLogic cluster on Azure Virtual Machines (VMs), on Windows or GNU/Linux.

In this tutorial, you learn how to:

  • Create a custom virtual network and create the VMs within the network.
  • Provision VMs with desired Java Development Kit (JDK) and WLS installed.
  • Configure a WebLogic Server domain and a WebLogic Server cluster using the Oracle Configuration Wizard.
  • Deploy and run a Java application in the cluster.
  • Expose the application to the public internet via Azure Application Gateway.
  • Validate the successful configuration.

If you prefer a fully automated solution that does all of these steps on your behalf on GNU/Linux VMs, directly from the Azure portal, see Quickstart: Deploy WebLogic Server on Azure Virtual Machine using the Azure portal.

If you're interested in providing feedback or working closely on your migration scenarios with the engineering team developing WebLogic on Azure solutions, fill out this short survey on WebLogic migration and include your contact information. The team of program managers, architects, and engineers will promptly get in touch with you to initiate close collaboration.

Prerequisites

  • A local machine with a Unix-like operating system installed - for example, Ubuntu, macOS, or Windows Subsystem for Linux.
  • An Azure subscription. If you don't have an Azure subscription, create a free account before you begin.
  • Install Azure CLI version 2.46.0 or higher to run Azure CLI commands.
    • When prompted, install Azure CLI extensions on first use. For more information about extensions, see Use extensions with Azure CLI.
    • Run az version to find the version and dependent libraries that are installed. To upgrade to the latest version, run az upgrade.
  • You must have an Oracle account. To create an Oracle account and accept the license agreement for WebLogic Server images, follow the steps in Oracle Container Registry. Make note of your Oracle Account password and email.

Prepare the environment

In this section, you set up the infrastructure within which you install the JDK and WebLogic Server.

Assumptions

In this tutorial, you configure a WebLogic Server cluster with an administration server and two managed servers on a total of three VMs. To configure the cluster, you need to create the following three Azure VMs within the same availability set:

  • The admin VM (VM name adminVM) has the administration server running.
  • The managed VMs (VM names mspVM1 and mspVM2) have two managed servers running.

Sign in to Azure

If you haven't done so already, sign in to your Azure subscription by using the az login command and follow the on-screen directions.

az login

Note

If multiple Azure tenants are associated with your Azure credentials, you must specify which tenant you want to sign in to. You can do this by using the --tenant option. For example: az login --tenant contoso.onmicrosoft.com.

Create a resource group

Create a resource group with az group create. Resource group names must be globally unique within a subscription. For this reason, consider prepending some unique identifier to any names you create that must be unique. A useful technique is to use your initials followed by today's date in mmdd format. This example creates a resource group named abc1110rg in the eastus location:

export RESOURCE_GROUP_NAME=abc1110rg

az group create \
    --name ${RESOURCE_GROUP_NAME} \
    --location eastus

Create a virtual network

The resources comprising your WebLogic Server cluster must communicate with each other, and the public internet, using a virtual network. For a complete guide to planning your virtual network, see the Cloud Adoption Framework for Azure guide Plan virtual networks. For more information, see Azure Virtual Network frequently asked questions.

The example in this section creates a virtual network with address space 192.168.0.0/16 and creates a subnet used for VMs.

First, create a virtual network by using az network vnet create. The following example creates a network named myVNet:

az network vnet create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name myVNet \
    --address-prefixes 192.168.0.0/24

Create a subnet for the WebLogic Server cluster by using az network vnet subnet create. The following example creates a subnet named mySubnet:

az network vnet subnet create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name mySubnet \
    --vnet-name myVNet \
    --address-prefixes 192.168.0.0/25

Create a subnet for Application Gateway by using az network vnet subnet create. The following example creates a subnet named wlsVMGateway:

az network vnet subnet create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name wlsVMGateway \
    --vnet-name myVNet \
    --address-prefixes 192.168.0.128/25

Create an availability set

Create an availability set by using az vm availability-set create, as shown in the following example. Creating an availability set is optional, but we recommend it. For more information, see Example Azure infrastructure walkthrough for Windows VMs.

az vm availability-set create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name myAvailabilitySet \
    --platform-fault-domain-count 2 \
    --platform-update-domain-count 2

The following sections describe the steps for installing WebLogic Server on either GNU/Linux or Windows Server. You can choose the operating system, JDK version, and WebLogic version according to your requirements, but you should verify that they're available in Oracle Fusion Middleware Supported System Configurations. Also, consider system and platform-specific requirements carefully before proceeding. For more information, see System Requirements and Specifications. Select the tab for your chosen operating system.

This article uses an Azure VM image maintained by Oracle and Microsoft containing the latest supported version of the software. For the full list of WebLogic Server base images maintained by Oracle and Microsoft, see Azure Marketplace. If you want to use Windows OS, the instructions start with a base Windows VM and walk you through the steps of installing all of the necessary dependencies.

The Marketplace image that you use to create the VMs in this article is Oracle:weblogic-141100-jdk11-ol91:owls-141100-jdk11-ol91:latest.

Note

You can query all the available Oracle WebLogic images provided by Oracle with az vm image list az vm image list --publisher oracle --output table --all | grep "weblogic". For more information, see Oracle VM images and their deployment on Microsoft Azure.

Create an Oracle Linux machine for admin server

In this section, you create Oracle Linux machines with JDK 11 and WebLogic 14.1.1.0 installed, for the admin server and managed servers.

Create a VM using az vm create. You run the Administration Server on this VM.

The following example creates Oracle Linux VMs using an SSH key pair for the authentication. If desired, you can use password authentication instead.

If you don't have an SSH key pair, you can generate it by using the following command:

ssh-keygen -t rsa -b 2048 -f ~/.ssh/wls-vm-key

This command creates the following files:

  • ~/.ssh/wls-vm-key: The private key.
  • ~/.ssh/wls-vm-key.pub: The public key.
export VM_URN=Oracle:weblogic-141100-jdk11-ol91:owls-141100-jdk11-ol91:latest

az vm create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name adminVM \
    --availability-set myAvailabilitySet \
    --image ${VM_URN} \
    --size Standard_DS1_v2  \
    --admin-username azureuser \
    --ssh-key-value ~/.ssh/wls-vm-key.pub \
    --public-ip-address "" \
    --nsg ""

Note

The use of username and password credentials to grant access to a VM is discouraged. If your particular usage requirements suggest credential based access is the best approach, you can create the VM with username and password:

export VM_URN=Oracle:weblogic-141100-jdk11-ol91:owls-141100-jdk11-ol91:latest
az vm create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name adminVM \
    --availability-set myAvailabilitySet \
    --image ${VM_URN} \
    --size Standard_DS1_v2 \
    --admin-username azureuser \
    --admin-password <your-password> \
    --public-ip-address "" \
    --nsg ""

Create a Windows VM and set up X-server

This tutorial uses the graphical interface of WebLogic Server to complete the installation and configuration. You use a Windows VM as a "jump box" and run an X Windows System server to view the graphical installers on the three VMs of the WebLogic Server cluster.

Follow these steps to provision a Windows 10 machine and install an X-server. If you already have a Windows machine within the same network as the Oracle Linux machine, you don't need to provision a new one from Azure. You can jump to the section that installs the X-server.

  1. Use the following steps to create a Windows 10 VM from the Azure portal:

    1. Open the resource group you created before in the Azure portal.
    2. Select Create to create the resource.
    3. Select Compute, search for windows 10, and then select Microsoft Windows 10.
    4. Select the plan that you want, and then select Create.
    5. Use the following values to configure the VM:
      • Virtual machine name: myWindowsVM
      • Image: Windows 10 Pro
      • Username: azureuser
      • Password: Secret123456
    6. Select the checkbox under Licensing.
    7. Select Review + create, and then select Create.

    It takes a few minutes to create the VM and supporting resources.

    After the deployment finishes, install the X server and use it to configure the application server on the Linux machines by using a graphical interface.

  2. Use the following steps to install and launch the X server:

    1. Use Remote Desktop to connect to myWindowsVM. For a detailed guide, see How to connect using Remote Desktop and sign on to an Azure virtual machine running Windows. You must execute the remaining steps in this section on myWindowsVM.
    2. Download and install VcXsrv Windows X Server.
    3. Disable the firewall. To allow communication from the Linux VMs, use the following steps to turn off Windows Defender Firewall:
      1. Search for and open Windows Defender Firewall.
      2. Find Turn Windows Defender Firewall on or off, and then select Turn off in Private network settings. You can leave Public network settings alone.
      3. Select OK.
      4. Close the Windows Defender Firewall settings panel.
    4. Select X-launch from the desktop.
    5. For display settings, set the display number to -1 to use multiple windows, and then select Next.
    6. For Select how to start clients, select Start no client, and then select Next.
    7. For extra settings, select Clipboard and Primary Selection, Native opengl, and Disable access control.
    8. Select Next to finish.

    A Windows Security Alert dialog might appear with this message: "Allow VcXsrv windows X-server to communicate on these networks." Select Allow access.

  1. Copy the SSH key ~/.ssh/wls-vm-key to the Windows VM and save it to C:\Users\azureuser.ssh.

Create Oracle Linux machines for managed servers

Create two VMs using az vm create. You run the managed servers on these VMs.

The following example creates Oracle Linux VMs using user name and password pair for the authentication. If desired, you can use TLS/SSL authentication instead.

export VM_URN=Oracle:weblogic-141100-jdk11-ol91:owls-141100-jdk11-ol91:latest

az vm create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name mspVM1 \
    --availability-set myAvailabilitySet \
    --image ${VM_URN} \
    --size Standard_DS1_v2  \
    --admin-username azureuser \
    --ssh-key-value ~/.ssh/wls-vm-key.pub \
    --public-ip-address "" \
    --nsg ""

az vm create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name mspVM2 \
    --availability-set myAvailabilitySet \
    --image ${VM_URN} \
    --size Standard_DS1_v2  \
    --admin-username azureuser \
    --ssh-key-value ~/.ssh/wls-vm-key.pub \
    --public-ip-address "" \
    --nsg ""

Use the following commands to get and show the private IP addresses, which you use in later sections:

export ADMINVM_NIC_ID=$(az vm show \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name adminVM \
    --query networkProfile.networkInterfaces'[0]'.id \
    --output tsv)
export ADMINVM_IP=$(az network nic show \
    --ids ${ADMINVM_NIC_ID} \
    --query ipConfigurations'[0]'.privateIPAddress \
    --output tsv)
export MSPVM1_NIC_ID=$(az vm show \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name mspVM1 \
    --query networkProfile.networkInterfaces'[0]'.id \
    --output tsv)
export MSPVM1_IP=$(az network nic show \
    --ids ${MSPVM1_NIC_ID} \
    --query ipConfigurations'[0]'.privateIPAddress \
    --output tsv)
export MSPVM2_NIC_ID=$(az vm show \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name mspVM2 \
    --query networkProfile.networkInterfaces'[0]'.id \
    --output tsv)
export MSPVM2_IP=$(az network nic show \
    --ids ${MSPVM2_NIC_ID} \
    --query ipConfigurations'[0]'.privateIPAddress \
    --output tsv)
echo "Private IP of adminVM: ${ADMINVM_IP}"
echo "Private IP of mspVM1: ${MSPVM1_IP}"
echo "Private IP of mspVM2: ${MSPVM2_IP}"

Now, you're ready to connect to the Oracle Linux machine to configure a WebLogic cluster with graphical interface.

Configure WebLogic Server domain and cluster

A WebLogic Server domain is a logically related group of WebLogic Server instances, and the resources running on and connected to them, that can be managed as a single administrative unit. For more information, see WebLogic Server Domains.

The foundation of high availability in WebLogic Server is the cluster. A WebLogic Server cluster is a group of WebLogic Server instances running simultaneously and working together to provide increased scalability and reliability. For more information, see Oracle WebLogic Cluster.

There are two kinds of cluster, as described in the following list. For more information, see About Dynamic Clusters.

  • Dynamic cluster: A cluster that contains one or more generated (dynamic) server instances that are based on a single shared server template. When you create a dynamic cluster, the dynamic servers are preconfigured and automatically generated for you, enabling you to easily scale up the number of server instances in your dynamic cluster when you need another server capacity. You can start the dynamic servers without having to first manually configure and add them to the cluster.
  • Configured cluster: A cluster in which you manually configure and add each server instance. You have to configure and add new server instance to increase server capacity.

To show you how to form a WebLogic cluster, this tutorial guides you through the process of creating a configured cluster.

Create the domain using the configuration wizard

You keep using the X-server and Oracle Configuration Wizard to create the WebLogic Server domain.

The following section shows how to create a new WebLogic Server domain on the adminVM. Make sure you're still on your Windows machine, if not, remote connect to myWindowsVM.

  1. Connect to adminVM from a command prompt.

    Run the following commands on your Windows machine myWindowsVM. Replace 192.168.0.4 with your adminVM private IP address:

    set SSH_KEY="C:\Users\azureuser\.ssh\wls-vm-key"
    set ADMINVM_IP="192.168.0.4"
    ssh -i %SSH_KEY% azureuser@%ADMINVM_IP%
    
  2. Use the following commands to initialize the folder for domain configuration:

    sudo su
    
    export DOMAIN_PATH="/u01/domains"
    mkdir -p ${DOMAIN_PATH}
    chown oracle:oracle -R ${DOMAIN_PATH}
    
  3. Use the following commands to Install the dependency for X-server:

    # install dependencies for X-server
    sudo yum install -y libXtst libSM libXrender
    # install dependencies to run a Java GUI client
    sudo yum install -y fontconfig urw-base35-fonts
    
  4. Use the following commands to become the oracle user and set the DISPLAY variable:

    sudo su - oracle
    
    export DISPLAY=<my-windows-vm-private-ip>:0.0
    #export DISPLAY=192.168.0.5:0.0
    
  5. Run the following command to launch the Oracle Configuration Wizard:

    bash /u01/app/wls/install/oracle/middleware/oracle_home/oracle_common/common/bin/config.sh
    

The Oracle Configuration Wizard starts and directs you to configure the domain. The following page asks for domain type and location. Select Create a new domain and set domain location to /u01/domains/wlsd. The domain configuration is saved to this folder.

Screenshot of Oracle Configuration Wizard - Create Domain.

Select Next, then select Create Domain Using Product Templates. Keep the default selected template, as shown in the following screenshot:

Screenshot of Oracle Configuration Wizard - Templates.

Select Next, then input Administration Account. Set the Name as weblogic and Password as Secret123456.

Screenshot of Oracle Configuration Wizard - Administration Account.

Select Next. For domain mode, select Production. For JDK, keep the default option.

Screenshot of Oracle Configuration Wizard - Domain Mode and JDK.

Select Next. For advanced configurations, select Administration Server, Node Manager, and Topology.

Screenshot of Oracle Configuration Wizard - Advanced Configurations.

Select Next and fill in the Administration Server name with admin. Fill in the Listen IP Address with the private IP of adminVM. The value is 192.168.0.4 in this example.

Screenshot of Oracle Configuration Wizard - Administration Server.

Select Next. For Node Manager Type, select Per Domain Custom Location, and fill in location with /u01/domains/wlsd/nodemanager. For Node Manager Credentials, the username is weblogic and the password is Secret123456.

Screenshot of Oracle Configuration Wizard - Node Manager.

Select Next. For managed servers, add the following items. Use the IP addresses you discovered earlier:

Server name Listen address Listen port
msp1 The private IP address of mspVM1. 8001
msp2 The private IP address of mspVM2. 8001

Screenshot of Oracle Configuration Wizard - Managed Servers.

Select Next, then create a cluster with the name cluster1.

Screenshot of Oracle Configuration Wizard - Cluster.

Select Next. Don't change the values for Server Templates and Dynamic Servers. The defaults are acceptable for a dynamic cluster.

For Assign Servers to Clusters, assign both msp1 and msp2 to cluster1.

Screenshot of Oracle Configuration Wizard - Assign Servers to Clusters.

Select Next. Add the machines adminVM, mspVM1, and mspVM2. Use the IP addresses you discovered earlier.

Name Node manager listen address Node manager listen port
mspVM1 The private IP address of mspVM1. 5556
mspVM2 The private IP address of mspVM2. 5556
adminVM The private IP address of adminVM. 5556

Screenshot of Oracle Configuration Wizard - Machines.

Select Next. For Assign Servers to Machines, assign server admin to adminVM, msp1 to mspVM1, and msp2 to mspVM2.

Screenshot of Oracle Configuration Wizard - Assign Servers to Machines.

Select Next. You see the Configuration Summary, which should look like the following screenshot:

Screenshot of Oracle Configuration Wizard - Configuration Summary.

Select Create. The Configuration Progress page shows the progress. All the listed items should be configured successfully.

Screenshot of Oracle Configuration Wizard - Configuration Progress.

Finally, there's an End of Configuration page to show the URL of the Administration Server.

Screenshot of Oracle Configuration Wizard - End.

The Administration Server isn't running, so the URL doesn't resolve. Select Next, then Finish. You finished configuring the wlsd domain with a cluster cluster1, including two managed servers.

Next, you apply the domain configuration to mspVM1 and mspVM2.

Create replicas using the pack and unpack command

This tutorial uses the WebLogic Server pack and unpack command to extend the domain. For more information, see Overview of the Pack and Unpack Commands.

  1. Pack the domain configuration on adminVM with the following steps, assuming you're still on adminVM and logged in with the oracle user:

    cd /u01/app/wls/install/oracle/middleware/oracle_home/oracle_common/common/bin
    bash pack.sh -domain=/u01/domains/wlsd -managed=true -template=/tmp/cluster.jar -template_name="wlsd"
    

    If the command is completed successfully, you see output similar the following example:

    [oracle@adminVM bin]$ bash pack.sh -domain=/u01/domains/wlsd -managed=true -template=/tmp/cluster.jar -template_name="wlsd"
    << read domain from "/u01/domains/wlsd"
    >>  succeed: read domain from "/u01/domains/wlsd"
    << set config option Managed to "true"
    >>  succeed: set config option Managed to "true"
    << write template to "/tmp/cluster.jar"
    ..............................
    >>  succeed: write template to "/tmp/cluster.jar"
    << close template
    >>  succeed: close template
    

    Use the following commands to copy /tmp/cluster.jar to mspVM1 and mspVM2 using scp. If prompted for key fingerprint, type yes. Enter the password Secret123456 when prompted.

    scp /tmp/cluster.jar azureuser@<mspvm1-private-ip>:/tmp/cluster.jar
    scp /tmp/cluster.jar azureuser@<mspvm2-private-ip>:/tmp/cluster.jar
    #scp /tmp/cluster.jar azureuser@192.168.0.6:/tmp/cluster.jar
    #scp /tmp/cluster.jar azureuser@192.168.0.7:/tmp/cluster.jar
    
  2. Use the following instructions to apply domain configuration to mspVM1:

    Open a new command prompt, and use the following commands to connect to mspVM1. Replace 192.168.0.6 with your mspVM1 private IP address:

    set SSH_KEY="C:\Users\azureuser\.ssh\wls-vm-key"
    set MSPVM1_IP="192.168.0.6"
    ssh -i %SSH_KEY% azureuser@%MSPVM1_IP%
    

    Enter the password for the connection. For this example, the password is Secret123456.

    You logged into mspVM1 with user azureuser. Next, use the following commands to become the root user and update file ownership of /tmp/cluster.jar to oracle:

    sudo su
    
    chown oracle:oracle /tmp/cluster.jar
    
    export DOMAIN_PATH="/u01/domains"
    mkdir -p ${DOMAIN_PATH}
    chown oracle:oracle -R ${DOMAIN_PATH}
    

    As the oracle user, use the following commands to apply the domain configuration:

    sudo su - oracle
    
    cd /u01/app/wls/install/oracle/middleware/oracle_home/oracle_common/common/bin
    bash unpack.sh -domain=/u01/domains/wlsd -template=/tmp/cluster.jar
    

    If the command completes successfully, you see output similar to the following example:

    [oracle@mspVM1 bin]$ bash unpack.sh -domain=/u01/domains/wlsd -template=/tmp/cluster.jar
    << read template from "/tmp/cluster.jar"
    >>  succeed: read template from "/tmp/cluster.jar"
    << set config option DomainName to "wlsd"
    >>  succeed: set config option DomainName to "wlsd"
    >>  validateConfig "KeyStorePasswords"
    >>  succeed: validateConfig "KeyStorePasswords"
    << write Domain to "/u01/domains/wlsd"
    ..................................................
    >>  succeed: write Domain to "/u01/domains/wlsd"
    << close template
    >>  succeed: close template
    
  3. Use the following instructions to apply domain configuration to mspVM2:

    Connect mspVM2 in a new command prompt. Replace 192.168.0.7 with your mspVM2 private IP address:

    set SSH_KEY="C:\Users\azureuser\.ssh\wls-vm-key"
    set MSPVM2_IP="192.168.0.7"
    ssh -i %SSH_KEY% azureuser@%MSPVM2_IP%
    

    Enter the password for the connection. For this example, the password is Secret123456.

    You logged into mspVM2 with user azureuser. Use the following commands to change to the root user and update the file ownership of /tmp/cluster.jar and initialize the folder for domain configuration:

    sudo su
    
    chown oracle:oracle /tmp/cluster.jar
    
    export DOMAIN_PATH="/u01/domains"
    mkdir -p ${DOMAIN_PATH}
    chown oracle:oracle -R ${DOMAIN_PATH}
    
    sudo su - oracle
    
    cd /u01/app/wls/install/oracle/middleware/oracle_home/oracle_common/common/bin
    bash unpack.sh -domain=/u01/domains/wlsd -template=/tmp/cluster.jar
    

You replicated the domain configuration on mspVM1 and mspVM2, and you're ready to start the servers.

Start servers

The steps in this section direct you to perform the following two tasks:

  1. Make it so the admin and managed servers start automatically after server reboot.
  2. Start the servers for immediate use.

These two tasks aren't easily separated, so the steps for the two tasks are intermixed.

Start admin

Go back to the command prompt that connects to adminVM. If you lost it, run the following command to connect to it:

set SSH_KEY="C:\Users\azureuser\.ssh\wls-vm-key"
set ADMINVM_IP="192.168.0.4"
ssh -i %SSH_KEY% azureuser@%ADMINVM_IP%

If you aren't working with the oracle user, sign in with oracle:

sudo su - oracle

The following command persists the admin account to /u01/domains/wlsd/servers/admin/security/boot.properties to enable automatically starting the admin server without asking for credentials:

Replace the username and password with yours.

mkdir -p /u01/domains/wlsd/servers/admin/security

cat <<EOF >/u01/domains/wlsd/servers/admin/security/boot.properties
username=weblogic
password=Secret123456
EOF

Use the following commands to inspect the file. Be sure it has the correct ownership, permissions, and contents.

ls -la /u01/domains/wlsd/servers/admin/security/boot.properties
cat /u01/domains/wlsd/servers/admin/security/boot.properties

The output should look nearly identical to the following example:

[oracle@adminVM bin]$ ls -la /u01/domains/wlsd/servers/admin/security/boot.properties
-rw-rw-r--. 1 oracle oracle 40 Nov 28 17:00 /u01/domains/wlsd/servers/admin/security/boot.properties
[oracle@adminVM bin]$ cat /u01/domains/wlsd/servers/admin/security/boot.properties
username=weblogic
password=Secret123456

Enable the admin server and node manager to start automatically after VM restart

Create a Linux service for the WebLogic admin server and node manager, to start the process automatically after reboot. For more information, see Use systemd on Oracle Linux.

Exit the oracle user and sign in with the root user.

exit

sudo su

Create the Linux service for the node manager:

cat <<EOF >/etc/systemd/system/wls_nodemanager.service
[Unit]
Description=WebLogic nodemanager service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
# Note that the following three parameters should be changed to the correct paths
# on your own system
WorkingDirectory=/u01/domains/wlsd
ExecStart="/u01/domains/wlsd/bin/startNodeManager.sh"
ExecStop="/u01/domains/wlsd/bin/stopNodeManager.sh"
User=oracle
Group=oracle
KillMode=process
LimitNOFILE=65535
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF

Create the Linux service for the admin server:

cat <<EOF >/etc/systemd/system/wls_admin.service
[Unit]
Description=WebLogic Adminserver service
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
WorkingDirectory=/u01/domains/wlsd
ExecStart="/u01/domains/wlsd/startWebLogic.sh"
ExecStop="/u01/domains/wlsd/bin/stopWebLogic.sh"
User=oracle
Group=oracle
KillMode=process
LimitNOFILE=65535
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target
EOF

You're now ready to start the node manager and admin server on adminVM by using the following commands:

sudo systemctl enable wls_nodemanager
sudo systemctl enable wls_admin
sudo systemctl daemon-reload
sudo systemctl start wls_nodemanager
sudo systemctl start wls_admin

Check the admin server state with sudo systemctl status wls_admin -l. The Administration Server should be ready when you find similar logs:

[root@adminVM wlsd]# sudo systemctl status wls_admin -l
● wls_admin.service - WebLogic Adminserver service
Loaded: loaded (/etc/systemd/system/wls_admin.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2022-09-26 07:47:34 UTC; 54s ago
Main PID: 26738 (startWebLogic.s)
    Tasks: 61 (limit: 20654)
Memory: 649.2M

... ...

Sep 26 07:48:15 adminVM startWebLogic.sh[26802]: <Sep 26, 2022, 7:48:15,411 AM Coordinated Universal Time> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING.>

Press Q to exit the log monitoring mode.

You can't access the admin server before opening ports 7001 and 5556. Use the following commands to open ports:

sudo firewall-cmd --zone=public --add-port=7001/tcp
sudo firewall-cmd --zone=public --add-port=5556/tcp
sudo firewall-cmd --runtime-to-permanent
sudo systemctl restart firewalld

At this point, you can access the admin server on the browser of myWindowsVM with the URL http://<adminvm-private-ip>:7001/console. Verify that you can view the admin server, but don't sign in yet. If the admin server isn't running, troubleshoot and resolve the problem before proceeding. The admin server isn't accessible outside of Azure.

Start msp1

Go back to the command prompt that connects to mspVM1. If you lost it, use the following command to connect to it:

set SSH_KEY="C:\Users\azureuser\.ssh\wls-vm-key"
set MSPVM1_IP="192.168.0.6"
ssh -i %SSH_KEY% azureuser@%MSPVM1_IP%

If you aren't working with oracle user, sign in with oracle:

sudo su - oracle

Persist the admin account to /u01/domains/wlsd/servers/msp1/security/boot.properties to enable automatically starting msp1 without asking for credentials. Replace the username and password with yours.

mkdir -p /u01/domains/wlsd/servers/msp1/security

cat <<EOF >/u01/domains/wlsd/servers/msp1/security/boot.properties
username=weblogic
password=Secret123456
EOF

Now, you create a Linux service for node manager, to start the process automatically on machine reboot. For more information, see Use systemd on Oracle Linux.

Exit the oracle user and sign in with the root user.

exit

#Skip this command if you are root
sudo su

Create the Linux service for the node manager:

cat <<EOF >/etc/systemd/system/wls_nodemanager.service
[Unit]
Description=WebLogic nodemanager service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
# Note that the following three parameters should be changed to the correct paths
# on your own system
WorkingDirectory=/u01/domains/wlsd
ExecStart="/u01/domains/wlsd/bin/startNodeManager.sh"
ExecStop="/u01/domains/wlsd/bin/stopNodeManager.sh"
User=oracle
Group=oracle
KillMode=process
LimitNOFILE=65535
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF

Next, start the node manager.

sudo systemctl enable wls_nodemanager
sudo systemctl daemon-reload
sudo systemctl start wls_nodemanager

If the node manager is running successfully, you see logs similar to the following example:

[root@mspVM1 azureuser]# systemctl status wls_nodemanager -l
● wls_nodemanager.service - WebLogic nodemanager service
Loaded: loaded (/etc/systemd/system/wls_nodemanager.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-09-27 01:23:42 UTC; 19s ago
Main PID: 107544 (startNodeManage)
    Tasks: 15 (limit: 20654)
Memory: 146.7M

... ...

Sep 27 01:23:45 mspVM1 startNodeManager.sh[107592]: <Sep 27, 2022 1:23:45 AM Coordinated Universal Time> <INFO> <Server Implementation Class: weblogic.nodemanager.server.NMServer$ClassicServer.>
Sep 27 01:23:46 mspVM1 startNodeManager.sh[107592]: <Sep 27, 2022 1:23:46 AM Coordinated Universal Time> <INFO> <Secure socket listener started on port 5556, host /192.168.0.6>

Press Q to exit log monitoring mode.

You must open port 8001 to access the application that deployed to the cluster and 5556 for communication inside the domain. Use the following commands to open ports:

sudo firewall-cmd --zone=public --add-port=8001/tcp
sudo firewall-cmd --zone=public --add-port=5556/tcp
sudo firewall-cmd --runtime-to-permanent
sudo systemctl restart firewalld

Start msp2

Go back to the command prompt that connects to mspVM2. If you lost it, use the following command to connect to it:

set SSH_KEY="C:\Users\azureuser\.ssh\wls-vm-key"
set MSPVM2_IP="192.168.0.7"
ssh -i %SSH_KEY% azureuser@%MSPVM2_IP%

If you aren't working with the oracle user, sign in with oracle:

sudo su - oracle

Persist the admin account to /u01/domains/wlsd/servers/msp2/security/boot.properties to enable automatically starting msp2 without asking for credentials. Replace the username and password with yours.


mkdir -p /u01/domains/wlsd/servers/msp2/security

cat <<EOF >/u01/domains/wlsd/servers/msp2/security/boot.properties
username=weblogic
password=Secret123456
EOF

Next, create a Linux service for the node manager.

Exit the oracle user and sign in with the root user.

exit

#SKip this command if you are in root
sudo su

Create the Linux service for the node manager:

cat <<EOF >/etc/systemd/system/wls_nodemanager.service
[Unit]
Description=WebLogic nodemanager service
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
# Note that the following three parameters should be changed to the correct paths
# on your own system
WorkingDirectory=/u01/domains/wlsd
ExecStart="/u01/domains/wlsd/bin/startNodeManager.sh"
ExecStop="/u01/domains/wlsd/bin/stopNodeManager.sh"
User=oracle
Group=oracle
KillMode=process
LimitNOFILE=65535
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF

Start the node manager.

sudo systemctl enable wls_nodemanager
sudo systemctl daemon-reload
sudo systemctl start wls_nodemanager

If the node manager is running successfully, you see logs similar to the following example:

[root@mspVM2 azureuser]# systemctl status wls_nodemanager -l
● wls_nodemanager.service - WebLogic nodemanager service
Loaded: loaded (/etc/systemd/system/wls_nodemanager.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2022-09-27 01:23:42 UTC; 19s ago
Main PID: 107544 (startNodeManage)
    Tasks: 15 (limit: 20654)
Memory: 146.7M

... ...

Sep 27 01:23:45 mspVM2 startNodeManager.sh[107592]: <Sep 27, 2022 1:23:45 AM Coordinated Universal Time> <INFO> <Server Implementation Class: weblogic.nodemanager.server.NMServer$ClassicServer.>
Sep 27 01:23:46 mspVM2 startNodeManager.sh[107592]: <Sep 27, 2022 1:23:46 AM Coordinated Universal Time> <INFO> <Secure socket listener started on port 5556, host /192.168.0.6>

Press Q to exit log monitoring mode.

Open port 8001 and 5556.

sudo firewall-cmd --zone=public --add-port=8001/tcp
sudo firewall-cmd --zone=public --add-port=5556/tcp
sudo firewall-cmd --runtime-to-permanent
sudo systemctl restart firewalld

Start managed servers

Now, open the Administration Console portal from a browser in your Windows machine myWindowsVM, and use the following steps to start the managed servers:

  1. Sign in to the Administration Console portal with your admin account and password. The URL is http://<adminvm-private-ip>:7001/console/. In this example, the admin account and password are weblogic/Secret123456. You'll find the state of managed servers are Shutdown.
  2. Under the Domain Structure, select Environments, Servers, and Control, select msp1 and msp2, and then select Start.
  3. You may be be prompted to confirm starting the servers. If so, select Yes. You'll see the message "A request has been sent to the Node Manager to start the selected servers."
  4. You can select the "refresh" icon at the top of the table to start or stop the dynamic refresh of the data in that table. This icon is shown in the next screenshot.
  5. You'll find the servers are up soon.

Screenshot of Oracle Configuration Wizard - Start Servers.

Clean up the Windows machine

You completed the WebLogic Server cluster configuration. If desired, remove the Windows machine with the following commands. Alternatively, you could shut down the Windows machine myWindowsVM and continue to use it as a jump box for ongoing cluster maintenance tasks.

export WINDOWSVM_NIC_ID=$(az vm show \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name myWindowsVM \
    --query networkProfile.networkInterfaces[0].id \
    --output tsv)
export WINDOWSVM_NSG_ID=$(az network nic show \
    --ids ${WINDOWSVM_NIC_ID} \
    --query networkSecurityGroup.id \
    --output tsv)
export WINDOWSVM_DISK_ID=$(az vm show \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name myWindowsVM \
    --query storageProfile.osDisk.managedDisk.id \
    --output tsv)
export WINDOWSVM_PUBLIC_IP=$(az network public-ip list \
    -g ${RESOURCE_GROUP_NAME} --query [0].id \
    --output tsv)

echo "deleting myWindowsVM"
az vm delete --resource-group ${RESOURCE_GROUP_NAME} --name myWindowsVM --yes
echo "deleting nic ${WINDOWSVM_NIC_ID}"
az network nic delete --ids ${WINDOWSVM_NIC_ID}
echo "deleting public-ip ${WINDOWSVM_PUBLIC_IP}"
az network public-ip delete --ids ${WINDOWSVM_PUBLIC_IP}
echo "deleting disk ${WINDOWSVM_DISK_ID}"
az disk delete --yes --ids ${WINDOWSVM_DISK_ID}
echo "deleting nsg ${WINDOWSVM_NSG_ID}"
az network nsg delete --ids ${WINDOWSVM_NSG_ID}

Expose WebLogic Server with Azure Application Gateway

Now that you created the WebLogic Server (WLS) cluster on either Windows or GNU/Linux virtual machines, this section walks you through the process of exposing WebLogic Server to the internet with Azure Application Gateway.

Create the Azure Application Gateway

To expose WebLogic Server to the internet, a public IP address is required. Create the public IP address and then associate an Azure Application gateway with it. Use az network public-ip create to create it, as shown in the following example:

az network public-ip create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name myAGPublicIPAddress \
    --allocation-method Static \
    --sku Standard

You add the backend servers to Application Gateway backend pool. Query backend IP addresses using the following commands:

export ADMINVM_NIC_ID=$(az vm show \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name adminVM \
    --query networkProfile.networkInterfaces[0].id \
    --output tsv)
export ADMINVM_IP=$(az network nic show \
    --ids ${ADMINVM_NIC_ID} \
    --query ipConfigurations[0].privateIPAddress \
    --output tsv)
export MSPVM1_NIC_ID=$(az vm show \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name mspVM1 \
    --query networkProfile.networkInterfaces[0].id \
    --output tsv)
export MSPVM1_IP=$(az network nic show \
    --ids ${MSPVM1_NIC_ID} \
    --query ipConfigurations[0].privateIPAddress \
    --output tsv)
export MSPVM2_NIC_ID=$(az vm show \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name mspVM2 \
    --query networkProfile.networkInterfaces[0].id \
    --output tsv)
export MSPVM2_IP=$(az network nic show \
    --ids ${MSPVM2_NIC_ID} \
    --query ipConfigurations[0].privateIPAddress \
    --output tsv)

Next, create an Azure Application Gateway. The following example creates an application gateway with managed servers in the default backend pool:

az network application-gateway create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name myAppGateway \
    --public-ip-address myAGPublicIPAddress \
    --location eastus \
    --capacity 2 \
    --http-settings-port 80 \
    --http-settings-protocol Http \
    --frontend-port 80 \
    --sku Standard_V2 \
    --subnet wlsVMGateway \
    --vnet-name myVNet \
    --priority 1001 \
    --servers ${MSPVM1_IP} ${MSPVM2_IP}

The managed servers expose their workloads with port 8001. Use the following commands to update the appGatewayBackendHttpSettings by specifying backend port 8001 and creating a probe for it:

az network application-gateway probe create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --gateway-name myAppGateway \
    --name clusterProbe \
    --protocol http \
    --host 127.0.0.1 \
    --path /weblogic/ready

az network application-gateway http-settings update \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --gateway-name myAppGateway \
    --name appGatewayBackendHttpSettings \
    --port 8001 \
    --probe clusterProbe

The next commands provision a basic rule rule1. This example adds a path to the Administration Server. First, use the following commands to create a URL path map:

az network application-gateway address-pool create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --gateway-name myAppGateway \
    --name adminServerAddressPool \
    --servers ${ADMINVM_IP}

az network application-gateway probe create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --gateway-name myAppGateway \
    --name adminProbe \
    --protocol http \
    --host 127.0.0.1 \
    --path /weblogic/ready

az network application-gateway http-settings create \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --gateway-name myAppGateway \
    --name adminBackendSettings \
    --port 7001 \
    --protocol Http \
    --probe adminProbe

az network application-gateway url-path-map create \
    --gateway-name myAppGateway \
    --name urlpathmap \
    --paths /console/* \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --address-pool adminServerAddressPool \
    --default-address-pool appGatewayBackendPool \
    --default-http-settings appGatewayBackendHttpSettings \
    --http-settings adminBackendSettings \
    --rule-name consolePathRule

Next, use az network application-gateway rule update to update the rule type to be PathBasedRouting.

az network application-gateway rule update \
    --gateway-name myAppGateway \
    --name rule1 \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --http-listener appGatewayHttpListener \
    --rule-type PathBasedRouting \
    --url-path-map urlpathmap \
    --priority 1001 \
    --address-pool appGatewayBackendPool \
    --http-settings appGatewayBackendHttpSettings

You're now able to access the Administration Server with the URL http://<gateway-public-ip-address>/console/. Run the following commands to get the URL:

export APPGATEWAY_IP=$(az network public-ip show \
    --resource-group ${RESOURCE_GROUP_NAME} \
    --name myAGPublicIPAddress \
    --query [ipAddress] \
    --output tsv)
echo "admin console URL is http://${APPGATEWAY_IP}/console/"

Verify that you can sign into the Administration Server console. If you can't, troubleshoot and resolve the problem before proceeding.

Note

This example sets up simple access to the WebLogic servers with HTTP. If you want secure access, configure TLS/SSL termination by follow the instructions in End to end TLS with Application Gateway.

This example exposes the Administration Server console via the Application Gateway. Don't do this in a production environment.

Deploy a sample application

This section shows you how to deploy an application to the WebLogic Server cluster. First, download testwebapp.war from Oracle and save the file to your local filesystem. Then, use the following steps to deploy the application:

  1. Open a web browser.
  2. Navigate to the Administration Console portal with the URL http://<gateway-public-ip-address>/console/, then sign in with your admin account and password. In this example, they're weblogic/Secret123456.
  3. Under the Change Center, if such a button exists, select Lock and Edit. If this button doesn't exist, verify that some text such as "Future changes will automatically be activated as you modify, add or delete items in this domain" exists under Change Center.
  4. Under Domain Structure, select Deployments. If you see an error message similar to Unexpected error encountered while obtaining monitoring information for applications., you can safely ignore it. Select Configuration then Install. Nestled within the text is a hyperlink with the text Upload your files. Select it. Select Choose file , then select the testwebapp.war built in the preceding step. Select Next then Next.
  5. Ensure that Install this deployment as an application is selected. Select Next.
  6. Under Available targets for testwebapp, select deployment target cluster1, select Next, then select Finish.
  7. Under the Change Center, if such a button exists, select Activate Changes. You must complete this step. Failure to complete this step causes the changes you made to not take effect. If this button doesn't exist, verify that some text such as Future changes will automatically be activated as you modify, add or delete items in this domain exists under Change Center.
  8. Under Domain Structure, select Deployments then Control. Select testwebapp then select Start, Servicing all requests.
  9. Select Yes.
  10. You see a message saying Start requests have been sent to the selected deployments. The status of the application must be Active.

Test the WebLogic Server cluster configuration

You finished configuring the WebLogic Server cluster and deploying the Java application to it. Use the following steps to access the application to validate all the settings:

  1. Open a web browser.
  2. Navigate to the application with the URL http://<gateway-public-ip-address>/testwebapp/.

Clean up resources

Delete the resource group with the following command:

az group delete --name ${RESOURCE_GROUP_NAME} --yes --no-wait

Next steps

Continue to explore options to run WebLogic Server on Azure.

For more information about Oracle WebLogic offers, see Oracle WebLogic Server on Azure. These offers are all Bring-Your-Own-License. They assume you already have the appropriate licenses with Oracle and are properly licensed to run offers in Azure.