In the previous chapters, we have learnt the basics of Mule ESB. In this chapter, let us learn how to install and configure it.
We need to satisfy the following prerequisites before installing Mule on our computer −
Before installing MULE, verify that you have supported version of Java on your system. JDK 1.8.0 is recommended to successfully install Mule on your system.
Following operating systems are supported by Mule −
An application server or database is not required as the Mule Runtime runs as a standalone server. But if we need to access a data store or want to use an application server, following supported application servers or databases can be used −
Before installing Mule on your system, it must fulfil the following system requirements −
To download Mule 4 binary file, click on the link https://www.mulesoft.com/lp/dl/mule-esb-enterprise and it will lead you to the official web page of MuleSoft as follows −
By providing the necessary details, you can get the Mule 4 binary file in Zip format.
Now after downloading the Mule 4 binary file, unzip it and set an environment variable called MULE_HOME for the Mule directory inside the extracted folder.
For example, the environment variable, on Windows and Linux/Unix environments, can be set for version 4.1.5 in the Downloads directory as follows −
$ env:MULE_HOME=C:\Downloads\mule-enterprise-standalone-4.1.5\
$ export MULE_HOME=~/Downloads/mule-enterprise-standalone-4.1.5/
Now, for testing whether Mule is running in your system without any error, use the following commands −
$ $MULE_HOME\bin\mule.bat
$ $MULE_HOME/bin/mule
The above commands will run Mule in the foreground mode. If Mule is running, we cannot issue any other commands on the terminal. Pressing ctrl-c command in the terminal, will stop Mule.
We can start Mule as a Windows Service and as a Linux/Unix Daemon also.
To run Mule as a Windows service, we need to follow the below steps −
Step 1 − First, install it with the help of following command −
$ $MULE_HOME\bin\mule.bat install
Step 2 − Once installed, we can run mule as a Windows service with the help of the following command:
$ $MULE_HOME\bin\mule.bat start
To run Mule as a Linux/Unix Daemon, we need to follow the below steps −
Step 1 − Install it with the help of the following command −
$ $MULE_HOME/bin/mule install
Step 2 − Once installed, we can run mule as a Windows service with the help of following command −
$ $MULE_HOME/bin/mule start
Example
The following example starts Mule as a Unix Daemon −
$ $MULE_HOME/bin/mule start MULE_HOME is set to ~/Downloads/mule-enterprise-standalone-4.1.5 MULE_BASE is set to ~/Downloads/mule-enterprise-standalone-4.1.5 Starting Mule Enterprise Edition... Waiting for Mule Enterprise Edition................. running: PID:87329
We can deploy our Mule apps with the help of following steps −
Step 1 − First, start Mule.
Step 2 − Once Mule starts, we can deploy our Mule applications by moving our JAR package files to the apps directory in $MULE_HOME.
We can use stop command to stop Mule. For example, the following example starts Mule as a Unix Daemon −
$ $MULE_HOME/bin/mule stop MULE_HOME is set to /Applications/mule-enterprise-standalone-4.1.5 MULE_BASE is set to /Applications/mule-enterprise-standalone-4.1.5 Stopping Mule Enterprise Edition... Stopped Mule Enterprise Edition.
We can also use remove command to remove the Mule Service or Daemon from our system. The following example removes Mule as a Unix Daemon −
$ $MULE_HOME/bin/mule remove MULE_HOME is set to /Applications/mule-enterprise-standalone-4.1.5 MULE_BASE is set to /Applications/mule-enterprise-standalone-4.1.5 Detected Mac OSX: Mule Enterprise Edition is not running. Removing Mule Enterprise Edition daemon...