Yucel Moran

Yucel Moran


Salesforce and Mulesoft experience

Edgar Moran
Author

Share


Tags


Yucel Moran

How to install Mulesoft runtime 3.9.X on Ubuntu 16.04

I've been using Anypoint Platform for 3 + years now, at the beginning I was only familiar on how to deploy my applications directly to CloudHub which was enough at that time for the work I did.

Eventually,  I needed tot make use of own servers where I needed to install Mulesoft runtime in order to take advantage of custom memory and disk size. So basically on  this tutorial, I will try to explain what steps I took in order to complete a full installation of the  runtime.

So first, I got an AWS Server with Ubuntu 16.04, 120 GB on disk and 16GB memory, these settings based on performance requirements  for applications what consumes a lot of memory transforming data in general.

Once we have the machine,  we can follow the next steps:

Install JAVA, personally I always like how Digital Ocean makes their tutorials, they explain step by step how to achieve installations of any kind, so in my flow I check this tutorial from them:

https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04

Laptop coding programs
Photo by Tirza van Dijk / Unsplash

Installing the Default JRE/JDK

The easiest option for installing Java is using the version packaged with Ubuntu. Specifically, this will install OpenJDK 8, the latest and recommended version.

First, update the package index.

Next, install Java. Specifically, this command will install the Java Runtime Environment (JRE).

There is another default Java installation called the JDK (Java Development Kit). The JDK is usually only needed if you are going to compile Java programs or if the software that will use Java specifically requires it.

The JDK does contain the JRE, so there are no disadvantages if you install the JDK instead of the JRE, except for the larger file size.

You can install the JDK with the following command:

Installing the Oracle JDK

If you want to install the Oracle JDK, which is the official version distributed by Oracle, you will need to follow a few more steps.

First, add Oracle's PPA, then update your package repository.

Then, depending on the version you want to install, execute one of the following commands:

Oracle JDK 8

This is the latest stable version of Java at time of writing, and the recommended version to install. You can do so using the following command:

Oracle JDK 9

This is a developer preview and the general release is scheduled for March 2017. It's not recommended that you use this version because there may still be security issues and bugs. There is more information about Java 9 on the official JDK 9 website.

To install JDK 9, use the following command:

Managing Java

There can be multiple Java installations on one server. You can configure which version is the default for use in the command line by using update-alternatives, which manages which symbolic links are used for different commands.

The output will look something like the following. In this case, this is what the output will look like with all Java versions mentioned above installed.

Output

You can now choose the number to use as a default. This can also be done for other Java commands, such as the compiler (javac), the documentation generator (javadoc), the JAR signing tool (jarsigner), and more. You can use the following command, filling in the command you want to customize.

Setting the JAVA_HOME Environment Variable

Many programs, such as Java servers, use the JAVA_HOME environment variable to determine the Java installation location. To set this environment variable, we will first need to find out where Java is installed. You can do this by executing the same command as in the previous section:

Copy the path from your preferred installation and then open /etc/environment using nano or your favorite text editor.

At the end of this file, add the following line, making sure to replace the highlighted path with your own copied path.

/etc/environment

Save and exit the file, and reload it.

You can now test whether the environment variable has been set by executing the following command:

This will return the path you just set.

PREPARING MULE RUNTITME IN THE VM MACHINE

After java is installed then we can proceed with Download Mulesoft runtime, you can get a copy of Mule 3.9.1 from here, upload  the file into the VM machine   using any SSH application for file transfer.

Now, from terminal access to  your vm via SSH, and locate the mule391  that  we just uploaded in  my  case is under /mule/391

Here's how I think about the folder content:

/mule/mule391/bin - This keeps all important binary files, the  ones that  make mulesoft runtime to work properly.  also this folder is the one that has the src/main/resources  folder,  meaning that if you are downloading files or generating file, will be  stored here.

/mule/mule391/conf - This folder has all configuration  files we need, this allow tot customize how mule work in your server,  depending of the hardware you can set multiple options. Mainly the file we use to set those options is the wrapper.config file.

/mule/mule391/logs - Store  all  logs separated by application  name, for example (my-mule-app.log)  you cans stream the content of  this file from terminal using this command

From this point the runtime is ready, uploading  and running the runtime just like this will  allow you  to use it for a month, so if you get a Mulesoft subscription  you  need to make sure su have a core for this server because then Mulesoft will provide a .lic file that  you need to install (https://docs.mulesoft.com/mule-runtime/4.2/installing-an-enterprise-license)

CONNECT MY SERVER TO RUNTIME MANAGER.

Runtime Manager, allows you basically to monitor and see metrics from your applications, even CloudHub or custom (Hybrid) ones.  In order to see our server we need to follow this steps:

  1. Login into AnyPoint Platform (https://anypoint.mulesoft.com) you can create a trial account if you want to test all functionality.
  2. Select Runtime Manager from the Menu  on  the left and  then clic on "Servers" this will load the servers already created in case you have some already

On  the top right  we should see  a button  "Add Server",  clic on it   and then you should get  a command that  you need to copy in  order to  use it in your server

Go back in  your terminal, and locate the mule391 folder, and get into the /bin  folder, the path should be  something like this /mule/mule391/bin.

In there you jus need to past the  command you copied from runtime Manager

this will install the communication  between your server and  Runtime Manager.  You can  see the server created in  your environment

From the terminal now go into the bin folder  (/mule/mule391/bin/). So now we  can  start mule, use  this command

the -M-Denv option lets me to specify the environment variable I want to use,  basically we are telling the server what environment is. you can add more variables like the masterkey to decrypt properties files etc.

After the command is executed you should  see your server running in Runtime Manager

So now you have your server ready  to deploy applications, in another post we should explain how to deploy manually selecting a compressed project file and later how to do the same using maven.

Hopefully this gives you an idea on how easy is to set the full environment, overall after a few times to do it, it will take around 30 mins to 1 hour to get working.

Edgar Moran
Author

Edgar Moran

View Comments