Installing JMeter on Ubuntu: Step-by-Step Guide
This guide outlines the essential steps to install Apache JMeter on Ubuntu, including prerequisites (Java), downloading JMeter, configuring environment variables, and verifying the installation.
JMeter is a Java-based application and requires Java (OpenJDK or Oracle JDK) to run. For most users, OpenJDK is recommended due to its ease of installation and maintenance.
sudo apt update
sudo apt install openjdk-11-jdk
java -version
Example output:openjdk version "11.0.20" 2023-07-18
OpenJDK Runtime Environment (build 11.0.20+8-post-Ubuntu-1ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.20+8-post-Ubuntu-1ubuntu122.04, mixed mode)
Download the latest stable version of JMeter from the official Apache website. Use wget to directly download the tarball to your Ubuntu system.
~/Downloads):cd ~/Downloads
5.4.1 with the latest version from the JMeter download page):wget https://downloads.apache.org/jmeter/binaries/apache-jmeter-5.4.1.tgz
Extract the downloaded tarball and move the extracted folder to a permanent location (e.g., /opt/jmeter) for easy access.
tar -xvzf apache-jmeter-5.4.1.tgz
/opt/jmeter (requires sudo for system directories):sudo mv apache-jmeter-5.4.1 /opt/jmeter
To run JMeter from any terminal without specifying its full path, add its bin directory to the PATH environment variable.
~/.profile for current user or /etc/profile for all users). Here, we use ~/.profile:nano ~/.profile
/opt/jmeter with your JMeter installation path if different):export JMETER_HOME=/opt/jmeter
export PATH=$JMETER_HOME/bin:$PATH
CTRL+O to write changes, Enter to confirm, then CTRL+X to exit nano.source ~/.profile
Check if JMeter is installed correctly by running the version command.
jmeter -v
Apache JMeter 5.4.1) along with Java version details. This confirms the installation was successful.For performance testing, it’s recommended to use JMeter in non-graphical mode (-n) to reduce resource consumption.
/path/to/testplan.jmx with the path to your JMeter test plan (JMX file) and /path/to/results.jtl with the desired output file for results:jmeter -n -t /path/to/testplan.jmx -l /path/to/results.jtl
.jtl file:jmeter -g /path/to/results.jtl -o /path/to/report
Open the index.html file in the /path/to/report directory to view the report in your browser.java: command not found, ensure Java is installed correctly and the JAVA_HOME environment variable is set.sudo to avoid permission issues.lib/ext directory of your JMeter installation.By following these steps, you’ll have a fully functional JMeter installation on Ubuntu, ready for performance testing and load analysis.