Run JMeter Test on a Linux VM on Azure: Step-by-step guide with Linux commands- Part 1(Setup)

Chalindu Kodikara
5 min readJun 20, 2022

--

I am currently working as a Software Engineering Intern at WSO2 Lanka(PVT) Limited. I’ve been working on this for so long. In the beginning, finding a good tutorial about running a JMeter script on a Linux VM was hard for me, hence a lot of time was wasted. Therefore, I would like to share the steps and ultimately save all of your time.

Here is the summary of the articles. You can read the parts as you need:

Part 1: Install Java, Install JMeter on VM.

Part 2: Copy jmx files from the local machine to VM, how to run the tests, Useful commands, how to run the tests in the background(Solve connection reset issue).

Part 3: Create html_report of the test, download jtl file, download html_report folder, download ultimate thread group plugin, install ultimate thread group plugin on VM and on local machine.

Related Article: Elevate your JMeter performance tests by seamlessly integrating CSV data as dynamic variables within your test plans. Learn step-by-step how to read data from CSV files and leverage it dynamically, enabling more robust and realistic performance testing scenarios.

1. What is JMeter?

The Apache JMeter is a java open-source software designed to generate loads and hence test APIs. There are several tests you can perform using JMeter.

  • Performance Test — This is used to test the performance of a system under different loads.
  • Load Test — This test is used to identify the highest load a system can withstand.
  • Stress Test — This test is used to break the system by overwhelming its resources.

JMeter comes with a graphical user interface and runs on any environment that accepts Java virtual machines. Ex: Linux, Windows, Mac, etc…

2. Setup JMeter on Linux VM

Linux VM on Azure

I am currently using a window OS and therefore I use Powershell. If you are a Linux user, you will have to use the terminal. This tutorial is based on Azure Linux VM. When the Azure VM is created, you will get your user name, IP address for that VM, and SSH private key. The private key is a file with a .pem extension.

Here I use “ ” these marks to indicate variables that you have to put when you run these commands.

1. As the first step, you have to log in to your VM.

Open Powershell. If you use a Linux distribution, you may have to use a terminal.

  • Go to the folder where your private key resides.
    Here I go to the downloads folder since my private key resides there.
  • Then, you can use the following command to log in to the VM.
# Go to the folder where your private key resides
>>cd "Folder_path"
Example: (cd downloads/)
#Login
>>ssh -i "private_key_name".pem "Username"@"IP"
Example:- (ssh -i test_key.pem azureuser@20.109.104.66)
Powershell. Login to the VM

2. Check the java version

You have to install Java to run JMeter since JMeter was written using Java and it needs Java Virtual Machine to run.
If the VM has already Java installed, you don’t need to follow this step and the next one.

#check java version
>>java -version
#check java compiler version
>>javac -version

If java is not installed, you will get a message like the following.
Command ‘java’ not found

If java is installed you will get a message like the following image.

If java is installed

3. Install Java

Before installing Java, you have to verify which version of java you want to install. You can check the JMeter website to confirm the version you need. New apache JMeter versions require newer Java versions.

To install java, you can use the following command. Here I am installing Java 8 version. You can change the version as you want.

>>sudo apt install openjdk-8-jdk-headless

4. Find the distribution you want

You can find the newest version of JMeter from this link.

If you want to install an older distribution, you can use this link.

Copy the link of the JMeter binary file with the extension tgz.

5. Create a folder in VM

This is to add the files that we are going to download in the upcoming steps.

For this, you can use mkdir command. Then, go inside the folder that you created.

>>mkdir "folder_name"
Example: (>mkdir jmeter_files)
>cd "folder_name"
Example: (>cd jmeter_files)

6. Download the JMeter binary file

In step 4, we copied the link of the distribution we wanted to install. You can use that link here for installation.

>wget "link_of_the_distribution"Example: (>wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-5.4.2.tgz)

Then, the binary file with extension tgz will be downloaded.

7. Extract the downloaded file

Now, you have to extract the downloaded binary file

#type ls to view the folders inside jmter_files folder
>>ls
>>tar -xf 'file_name'
Example: (>>tar -xf apache-jmeter-5.4.2.tgz)

8. Run an example

Now, you have successfully installed JMeter on VM. You can use it for your tests.

Let’s run an example. There are example jmx files inside the JMeter folder. You can run one of the examples using the following command.

>>./jmeter.sh -n -t examples/CSVSample.jmx

Let’s meet in the next article.
— — — — — — — — — — — — — — — — — — — —

Do feel free to comment and give your feedback.

You can connect with me on LinkedIn: https://www.linkedin.com/in/chalindukodikara

— — — — — — — — — — — — — — — — — — — —

--

--

Chalindu Kodikara

Computer Science and Engineering Graduate, Software Engineer