Install Ballerina on Linux

Ballerina is a new open source JVM based language specially designed for integration purposes by WSO2 the world's #1 open source integration vendor. In this article, you will see how to manually install Ballerina on Linux systems. Visit the official website and download the installer for your system. There is an installer for Windows, Mac, Debian-based Linux and Fedora-based Linux. I prefer to install Ballerina manually because it is universal for all Linux operating systems out there.

Install Ballerina on Linux

Step 1:
Ballerina is a JVM based language like Kotlin and Scala. Therefore, you must have Oracle Java Development Kit 1.8 installed in your system. If you don't have Oracle JDK 1.8 installed in your system, follow this article:  Install Oracle JDK 8 on Linux.

Step 2:
Download the latest ballerina-<version>.zip file from the official website. In this article, I am using

Step 3:
Open a terminal and change the directory to /usr/local
cd /usr/local

Step 4:
Extract the zip file into the /usr/local folder. In the following command, I assume that you have the file in the Downloads folder.
sudo unzip ~/Downloads/

Step 5 (Optional):
Rename the ballerina-0.990.2 folder to ballerina. I prefer to do so because it will permit me to upgrade the language without modifying the PATH variable every time.
sudo mv ballerina-0.990.2 ballerina

Step 6 (Optional):
Ballerina strictly requires Java Development Kit 1.8. If you have more than one JDKs installed in your system and the JAVA_HOME variable points to a different version, Ballerina may not run in your system. To overcome this problem, we can hard-code the JAVA_HOME variable in the ballerina executable file. To do so, follow these steps:
Open /usr/local/ballerina/bin/ballerina in nano
sudo nano /usr/local/ballerina/bin/ballerina

Scroll down the comments and find the line starting with BASE_DIR=$PWD. Just before that line, hard-code the JAVA_HOME variable. In my case, JDK 1.8 is installed in /usr/lib/jvm/jdk1.8.0_181 so I modified the ballerina executable as shown below:
# OS specific support.  $var _must_ be set to either true or false.
#ulimit -n 100000

Step 7:
Append /usr/local/ballerina/bin to the environment variable PATH and set /usr/local/ballerina as BALLERINA_HOME. You can set them to the entire system by following these steps:
Open /etc/environment in nano
sudo nano /etc/environment

Append /usr/local/ballerina/bin to the PATH variable and add BALLERINA_HOME as shown below:
Press Ctrl + O to save all changes and Ctrl + X to close nano.

Step 8:
Restart the computer or enter the following command in the terminal to load the environment variables.
source /etc/environment

Step 9:
Enter the following command in the terminal to check the version of Ballerina. If it prints the version, congratulations! you have successfully installed Ballerina.
ballerina --version

If you face any problems in installing Ballerina, feel free to comment below. I will try my best to help you in fixing them.
Next Post »

Contact Form


Email *

Message *