How to install the Mule Runtime on Windows Server


The Mule Runtime Standalone model refers to running Mule as a standalone service or instance rather than using managed cloud services like MuleSoft’s CloudHub or Runtime Fabric. Using the 
Mule Runtime Standalone model can be beneficial for certain deployment scenarios, especially when flexibility, control, and customizability are important.

In this post, we will see how to install the Mule Runtime on a Windows Server.

Prerequisites

To follow this tutorial we need:
Then, these are the steps we need to follow:

Download the Mule Runtime

First, we need to download the Mule runtime binary files. 
Go to https://www.mulesoft.com/lp/dl/mule-esb-enterprise and provide your details. Don’t forget to select Mule Standalone and in Product Selection and Windows as your Operating System



Once you fill in the form you’ll get an email with a link for downloading the mule runtime. Click on Download .zip and wait for it.


Create a Directory for our Mule Runtime

Once the download is complete, unzip the file. Next, we will create a new folder in your system where we’ll copy the extracted files to it. In this tutorial, our Mule directory will be C:\MULE


Set the MULE_HOME environment variable

For that, go to the Windows Start Menu and search for environment variable. From the results click on the Edit the system environment variables


Next, on the System Properties window, click on Environment Variables...


From the Environment Variables window click on New in the System variables section


In the following window, type MULE_HOME as variable name and in variable value Browse to the directory we’ve just created for Mule and select the folder we’ve copied. Click OK


Lastly, click OK to save our changes


Test the installation

Let’s see if our MULE_HOME env variable works and if our mule runtime can start. Open a new command prompt and type the following:
%MULE_HOME%\bin\mule.bat


If everything went well you should see the message of the Mule. Now, you can stop the mule by pressing Ctrl+c in the command prompt.


Install Mule as a Service

Now, in a production environment, we would not be starting and stopping the runtime manually. In a windows server, we can install the mule as a service. This way, setting the service in Automatic, the mule runtime will get started every time Windows starts/restarts.

For that, first stop the mule if you didn’t do it in the previous step and run the following in the command prompt:
%MULE_HOME%/bin/mule install



Verify the mule service was registered successfully. Go to the Windows Services console and look for the Mule Enterprise Edition service. You should see something like this (don’t worry if you see the service not running, we’ll do it in the next step)



Start the Mule

Time to start the mule runtime. You can do it from the services console or running the following in the command propmt:
%MULE_HOME%/bin/mule start



And now we should see the Mule Runtime service running



Register the runtime in the control plane

Now is time to connect the Mule runtime with the control plane. For that, let’s head over to Anypoint platform > Runtime Manager. On the left panel, click on Servers and then Add Server



In the pop-up window, provide a name for your Mule Server and then copy the command.

Now, get back to the Windows Server and open a command prompt. From there, change directory to the bin folder of your MULE_HOME:
cd %MULE_HOME%/bin

And next, paste the command you copied in Anypoint. This is a windows system, so remember to remove the ./ at the begining of the command. After that, the Mule Agent will start to be installed:



If everything works you should see the final message:


Get back to the Anypoint Platform and verify that your Mule runtime shows Running status


If you see your server in Created status but not Running, restart the Mule Service from Services console.


Deploy a Test App

Time to see if everything works. Let’s deploy a Mule app from the Anypoint Runtime Manager and see if that works.
For that, go to the Anypoint Platform > Runtime Manager > Applications and click on Deploy application. From there, provide a name to your test app and make sure you select your new Server in Deployment Target. It should be located in the Hybrid option of the dropdown.



For the test app you can just use the Import file from Exchange and look for the hello world app provided by Mulesoft.


Select the app and click on Deploy Application. 
Go to your windows server and check the apps directory in your MULE_HOME, there should be a new folder with the name of your app




Previous Post Next Post