In this blog covers step-by-step instructions on installing Mule 4 runtime on a Linux box provisioned using Microsoft Azure. To perform these steps I will be using below accounts/tools:
- Microsoft Azure account – To provision Linux server and install mule
- Mule 4 Runtime – downloadable from Mule site
- Java 8 – required for Mule 4 runtime
- WinScp – To copy/view files into linux server
- Putty – To connect Linux server and run commands on the server
Step 1: Provisioning Linux Server
Assuming you already have an account with Microsoft Azure, login to Azure portal and create a VM with Ubuntu server(I have tested with Ubuntu and Oracle Servers, and covered steps which will work for both of these). Below screen shots of the configuration of Ubuntu Server which will be used to install Mule 4 runtime
Step 2: Once the server is provisioned, connect to the server using Putty (or your choice of software)
Switch login as root:
Step 3: Installing Java
Update packages by running apt-get update. Once the update is done, run java -version. If java is not installed as part of update, you should see below
Install java by running apt install default-jre . After the installation is completed, when u execute again java -version, you should see the latest java version installed.
Once java is installed, create directory named “mule” on root. This directory will be used to place mule runtime.
Step 4: Mule Runtime
Download Mule Runtime from https://www.mulesoft.com/lp/dl/mule-esb-enterprise
Open WinScp, connect to linux server and copy mule runtime into the server
Since we copied the file in /home/muleubuntu folder, execute below command to copy it back to /mule(if you directly copy into /mule folder using WinScp, it will give you access denied error as you are not logged in as root in WinScp)
NOTE: A better option would be to upload the mule runtime to a file storage on cloud and use wget to download the runtime directly to Ubuntu server instead of manually copying it.
Step 5: Unzip and start Mule
Once the file is in right location, unzip the file by executing below commands
After the folder is extracted, you can navigate to the bin folder and start mule service
Step 6: Creating sample mule application to be deployed on Linux server
Since this is Mule 4 runtime, create a simple mule application using mule anypoint studio 7
Once the application is created, right click on the project and export as deployable archive. This will create a .jar file based on the name of your application(this can be changed)
Step 7: Deployment
Copy the .jar file(created from above step) into apps folder of extracted mule runtime. As soon as the .jar file is copied, mule runtime will explode the .jar file and creates anchor file. At this point mule application has successfully been deployed. This can also be verified by viewing the log files.
Step 8: Opening port for Mule application
Http listener on the sample mule application was configured using port 8081. This port needs to be opened up for incoming traffic into the Linux server. This can be done on azure portal by navigating to Networking tab and clicking on Add inbound port rules
Once the inbound rule is applied(this may take a minute or so to be reflected), you should be able to browse to mule application url:
Additionally, if you would like to assign DNS name to the VM, you can do it by clicking
If you choose to use Oracle Linux instead of Ubuntu , then installation steps for java and zip would differ slightly as mentioned below:
- Installation of zip/unzip: use yum to install unzip by executing: yum install zip unzip -y
- Installation of java on Oracle Linux – To install java, go to java.com and download the latest jre/jdk version for linux and copy it to a folder inside the Oracle Linux box. Once this is done, you can execute steps mentioned in this post https://stackoverflow.com/questions/10250624/installing-java-in-linux-issues
Above steps are same for older versions of mule(runtime < 4.x) except that the old versions of mule runtime create and use .zip file instead of .jar file.