How to install Microsoft’s Build of OpenJDK on Linux

Microsoft has built their own version of OpenJDK.

This build of Open JDK 11 is available on Azure as well as for users to download and install on their local machine.

According to Microsoft’s Dev Blogs:

They rely on Java technologies for a variety of their own internal systems, applications, and workloads to enable well-known public services and products as well as a significant set of mission-critical systems that power Azure infrastructure. They have been working on optimizing their Java-based systems and securing their supply chain to benefit their customers and users.

They have deployed over 500,000 Java Virtual Machines (JVMs) internally – excluding all Azure services and customer workloads – with needs that go from back-end microservices to Big Data systems, message brokers, event streaming services, and gaming servers. More than 140,000 of these JVMs are already based on the Microsoft Build of OpenJDK.

Microsoft uses a variety of open-source Java projects for critical tasks across Azure to support its global infrastructure, as well as for Big Data and log analytics systems. The back-end services of both LinkedIn and Yammer are almost entirely implemented on distributed cloud-native Java microservices. Minecraft Java Edition also remains ubiquitous with a significant ecosystem of mods and a community of enthusiastic modders, and they leverage Java to run the servers behind Minecraft Realms.

Later this year, the Microsoft Build of OpenJDK will become the default distribution for Java 11 across Azure-managed services. Customers won’t have to perform any maintenance tasks, as the transition will be smooth and transparent through application deployments. For all other Azure services, customers can bring their JDK of choice, including Microsoft Build of OpenJDK. They will provide more updates on that in the coming months.

Microsoft Dev Blogs

You can learn more about this over here.

Install Microsoft’s Build of OpenJDK on Ubuntu.

To install it we need to add Microsoft’s repository to our system. (This command will download the package that is right for the Ubuntu release you are using)

wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb -O packages-microsoft-prod.debCode language: JavaScript (javascript)

Install the package by entering the command below.

sudo dpkg -i packages-microsoft-prod.deb
Code language: CSS (css)

Install apt-transport-https. If you, have it already installed it skip this command

sudo apt install apt-transport-https

Update your local repository database.

sudo apt update

Install Microsoft’s Build of OpenJDK.

sudo apt install msopenjdk-11

Install Microsoft’s Build of OpenJDK on Debian.

Follow the steps below for Debian 10.

To install it we need to add Microsoft’s repository to our system.

wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.debCode language: JavaScript (javascript)

Install the package by entering the command below.

sudo dpkg -i packages-microsoft-prod.debCode language: CSS (css)

Follow the steps below for Debian 9.

To install it we need to add Microsoft’s repository to our system.

Download and add the gpg key to the system.

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpgCode language: JavaScript (javascript)

Adjust permission to the gpg key we just downloaded.

sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/

Download the repository and add to the sources.list.d folder.

wget -q https://packages.microsoft.com/config/debian/9/prod.list -O /etc/apt/sources.list.d/microsoft-prod.listCode language: JavaScript (javascript)

Update your local repository database.

sudo apt update

Install apt-transport-https. If you, have it already installed skip this command

sudo apt install apt-transport-https

Install Microsoft’s Build of OpenJDK.

sudo apt install msopenjdk-11

Install Microsoft’s Build of OpenJDK on CentOS/RHEL.

Enter the command below to add the repository to your RPM package managers system.

For CentOS 8.

sudo rpm -Uvh https://packages.microsoft.com/config/centos/8/packages-microsoft-prod.rpmCode language: JavaScript (javascript)

For CentOS 7

sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpmCode language: JavaScript (javascript)

For RHEL 8.

sudo rpm -Uvh https://packages.microsoft.com/config/rhel/8/packages-microsoft-prod.rpmCode language: JavaScript (javascript)

Downloading and installingMicrosoft’s OpenJDK 11.

sudo yum install msopenjdk-11

Example of it running on Azure Cloud Shell.

darryl@Azure:~/clouddrive$ java --version
openjdk 11.0.9 2020-10-20
OpenJDK Runtime Environment Microsoft.13779 (build 11.0.9+8-20200922)
OpenJDK 64-Bit Server VM Microsoft.13779 (build 11.0.9+8-20200922, mixed mode)

That’s it folks, now you have Microsoft’s build of OpenJDK 11.

Happy Coding. If you want to discuss this topic further leave a comment below.