How to install the Mule Runtime on Ubuntu 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 benefit certain deployment scenarios, especially when flexibility, control, and customizability are important.

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


Prerequisites

To follow this tutorial we will need:
  • A Virtual Machine with Ubuntu Server 24.04 LTS
  • Java JDK installed. In this tutorial we’ll use the OpenJDK 17 - Check out this post to see How to install Java on Ubuntu Server
  • The JAVA_HOME environment variable set up and pointing to the Java installation

Install Mule

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 in Product Selection and Linux as your Operating System.



Once you fill in the form you’ll get an email with a link for downloading the mule runtime. 
There are several ways to download the zip file to your Ubuntu Server. Here there are two options:

Option 1 - Download it directly from the Ubuntu Server

Open the link from the email from your laptop (not from the Ubuntu Server). Right-click on the Download .zip button and copy the link address. It should be something similar to this (the link below is for mule runtime 4.8.0)

https://www.mulesoft.com/downloads/mule/latest/mule-ee-distribution-standalone-4.8.0.zip



Use that link to download the runtime directly from Ubuntu. From your terminal connected to the Ubuntu server run the following:

Use that link to download the runtime directly from Ubuntu. From your terminal connected to the Ubuntu server run

wget https://www.mulesoft.com/downloads/mule/latest/mule-ee-distribution-standalone-4.8.0.zip


Option 2 - Upload the zip file using scp

scp (Secure Copy Protocol) is a command-line utility in Linux used for securely transferring files between hosts over a network. It uses SSH (Secure Shell) to provide encryption during file transfer, ensuring that the data is secure.

In our case, we can use it to copy the zip file with the runtime from our laptop to the remote Ubuntu server. We just need to follow the syntax:

scp /path/to/local/file user@remote_host:/path/to/destination

If you, like me, are using an AWS EC2 instance for the Ubuntu Server we’d have to add the certificate for the SSH connection:

scp -i [YOUR_CERT] /path/to/local/file ubuntu@[EC2_PUBLIC_DNS]:/path/to/destination


Next, we’ll create a folder for our Mule installation:

mkdir ~/mule

Unzip the file with the runtime and put its content in our Mule directory:

unzip [MULE_RUNTIME_ZIP] -d [MULE_FOLDER]

If unzip tool is not installed in your server install it with this command:

sudo apt-get install unzip


Set the MULE_HOME environment variable

The MULE_HOME environment variable will be used by the Mule Runtime and by the configuration files, such as the wrapper.conf. This environment variable needs to point to the folder where we placed the contents of the zip file. To create the environment variable we just need to run the command:

export MULE_HOME="/home/ubuntu/mule/mule-enterprise-standalone-4.8.0"

If we want to make this variable persistent and always available to any shell session we can edit the 
.profile file. For that, open the file with:

sudo vi ~/.profile

Then copy the previous export command at the end of that file. To apply changes, we can exit and open a new shell or we can reload the 
.profile file with the command:

sudo source ~/.profile


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


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 the Mule Runtime as a Linux service

Now, in a production environment, we would not be starting and stopping the runtime manually. In a linux server, we can install the mule as a service with the systemctl tool 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:

sudo $MULE_HOME/bin/mule install


Now we can start the Mule runtime with the systemctl tool

sudo systemctl start mule_ee

And check the status of the service

sudo systemctl status mule_ee


Lastly, we will enable the Mule service to start at boot (in case it is not already enabled), this way we don’t have to start the mule runtime every time the server is restarted. For that, we need to run:

sudo systemctl enable mule_ee



Before continuing with the rest of the installation, stop the Mule runtime

sudo systemctl stop mule_ee


Register the runtime in the control plane

Now, it is time to connect the Mule runtime with the control plane. This way we will be able to manage the runtime and manage the applications from the Runtime Manager. 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 Ubuntu Server and open a shell. From there, change directory to the bin folder of your MULE_HOME:

cd $MULE_HOME/bin

Next, paste the command you copied in Anypoint. 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 Created status. That means we’ve established the connection between the Mule agent and the control plane



Now, start the Mule runtime from the Ubuntu Server:

sudo systemctl start mule_ee

Get back again to the Anypoint Platform and verify that now the status has changed to Running



With that our Mule Runtime in Ubuntu Server is ready to get our Mule apps

Previous Post Next Post