...
How to deploy apache jmeter on ubuntu vps
Learn how to deploy apache jmeter on ubuntu vps!

This article provides a guide demonstrating how to deploy Apache JMeter on Ubuntu VPS.

Introduction

Apache JMeter is an open-source load testing tool used to test the performance and scalability of web applications, APIs, databases, and other services. Deploying JMeter on a VPS allows you to perform large-scale load tests without consuming local workstation resources.

This guide covers:

  • Installing Java
  • Installing Apache JMeter
  • Configuring JMeter for CLI operation
  • Running load tests
  • Generating HTML reports
  • Optimizing JMeter for VPS environments
  • Running distributed load testing

Prerequisites

Before you begin, ensure you have:

  • Ubuntu 22.04 LTS (recommended)
  • Root or sudo access
  • At least:
    • 2 CPU cores
    • 4 GB RAM
    • 20 GB storage

Update the system first:

sudo apt update && sudo apt upgrade -y

Launch 100% ssd ubuntu vps from $3. 19/mo!


Compare Ubuntu VPS Plans

KVM-SSD-1
KVM-SSD-8
KVM-SSD-16
KVM-SSD-32
CPU
1 Core
2 Cores
4 Cores
8 Cores
Memory
1 GB
8 GB
16 GB
32 GB
Storage
16 GB NVMe
128 GB NVMe
256 GB NVMe
512 GB NVMe
Bandwidth
1 TB
4 TB
8 TB
16 TB
Network
1 Gbps
1 Gbps
1 Gbps
1 Gbps
Delivery Time
⏱️ Instant
⏱️ Instant
⏱️ Instant
⏱️ Instant
Location
US/FR
US/FR
US/FR
US/FR
Price
$7.58*
$39.50*
$79.40*
$151.22*
KVM-SSD-1
CPU: 1 Core
Memory: 2 GB
Storage: 16 GB NVMe
1 TB
KVM-SSD-8
CPU: 2 Cores
Memory: 8 GB
Storage: 128 GB NVMe
4 TB
KVM-SSD-16
CPU: 4 Cores
Memory: 16 GB
Storage: 256 GB NVMe
8 TB
KVM-SSD-32
CPU: 8 Cores
Memory: 32 GB
Storage: 512 GB NVMe
16 TB

How to Deploy Apache JMeter on Ubuntu VPS

To Deploy Apache JMeter on Ubuntu VPS, follow the steps below:

  1. Install Java

    JMeter requires Java.

    Install OpenJDK 17:

    sudo apt install openjdk-17-jdk -y
    

    Verify installation:

    java -version
    

    Expected output:

    openjdk version "17.x.x"
    

    Check JAVA_HOME:

    readlink -f $(which java)
    

    Example:

    /usr/lib/jvm/java-17-openjdk-amd64/bin/java
    

    Set JAVA_HOME:

    echo 'export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64' | sudo tee /etc/profile.d/java.sh
    echo 'export PATH=$JAVA_HOME/bin:$PATH' | sudo tee -a /etc/profile.d/java.sh
    source /etc/profile.d/java.sh
    

    Verify:

    echo $JAVA_HOME
    
  2. Download Apache JMeter

    Navigate to a temporary directory:

    cd /tmp
    

    Download the latest release:

    wget https://downloads.apache.org/jmeter/binaries/apache-jmeter-5.6.3.tgz
    

    Extract:

    tar -xzf apache-jmeter-5.6.3.tgz
    

    Move to a permanent location:

    sudo mv apache-jmeter-5.6.3 /opt/jmeter
    
  3. Create Global JMeter Command

    Create a symbolic link:

    sudo ln -s /opt/jmeter/bin/jmeter /usr/local/bin/jmeter
    

    Verify:

    jmeter --version
    

    Expected output:

    Apache JMeter 5.6.3
    
  4. Configure Environment Variables

    Create a profile script:

    sudo nano /etc/profile.d/jmeter.sh
    

    Add:

    export JMETER_HOME=/opt/jmeter
    export PATH=$PATH:$JMETER_HOME/bin
    

    Save and reload:

    source /etc/profile.d/jmeter.sh
    

    Verify:

    echo $JMETER_HOME
    
  5. Optimize JMeter Memory Settings

    Edit:

    sudo nano /opt/jmeter/bin/user.properties
    

    Or modify startup configuration:

    sudo nano /opt/jmeter/bin/jmeter
    

    Locate:

    HEAP="-Xms1g -Xmx1g"
    

    Adjust according to server RAM:

    4GB VPS

    HEAP="-Xms1g -Xmx2g"
    

    8GB VPS

    HEAP="-Xms2g -Xmx4g"
    

    16GB VPS+

    HEAP="-Xms4g -Xmx8g"
    
  6. Upload a JMeter Test Plan

    JMeter test plans use the .jmx extension.

    Upload via SCP:

    scp loadtest.jmx user@server-ip:/home/user/
    

    Or use:

    rsync -av loadtest.jmx user@server-ip:/home/user/
    

    Verify:

    ls -lah ~/loadtest.jmx
    
  7. Run JMeter in Non-GUI Mode

    Never use GUI mode on a VPS.

    Run:

    jmeter -n \
    -t loadtest.jmx \
    -l results.jtl
    

    Parameters:

    Option Description
    -n Non-GUI mode
    -t Test plan
    -l Results file

    Example:

    jmeter -n -t api-test.jmx -l results.jtl
    
  8. Generate an HTML Report

    After test completion:

    jmeter -g results.jtl -o report
    

    This creates:

    report/
    β”œβ”€β”€ index.html
    β”œβ”€β”€ content/
    β”œβ”€β”€ statistics.json
    └── dashboard files
    

    View locally:

    scp -r user@server-ip:~/report .
    

    Or serve from the VPS.

  9. Serve Reports via Apache or Nginx

    Install Nginx:

    sudo apt install nginx -y
    

    Copy report:

    sudo cp -r report /var/www/html/jmeter-report
    

    Visit:

    http://SERVER-IP/jmeter-report/
    
  10. Override Variables at Runtime

    Pass variables from the command line:

    jmeter -n \
    -t loadtest.jmx \
    -Jthreads=100 \
    -Jrampup=60 \
    -Jduration=300
    

    Access inside JMeter:

    ${__P(threads,50)}
    ${__P(rampup,30)}
    ${__P(duration,120)}
    

    This allows flexible testing without editing the test plan.

  11. Run Tests in Background

    Using nohup:

    nohup jmeter -n \
    -t loadtest.jmx \
    -l results.jtl \
    > jmeter.log 2>&1 &
    

    Check status:

    ps aux | grep jmeter
    

    Monitor:

    tail -f jmeter.log
    
  12. Schedule Tests with Cron

    Edit cron:

    crontab -e
    

    Run every night at 2 AM:

    0 2 * * * /usr/local/bin/jmeter -n -t /home/user/loadtest.jmx -l /home/user/results.jtl
    
  13. Distributed Load Testing

    For very large loads, use multiple VPS servers.

    Master Server

    Edit:

    nano /opt/jmeter/bin/jmeter.properties
    

    Set:

    remote_hosts=10.0.0.10:1099,10.0.0.11:1099
    

    Slave Servers

    Start server mode:

    jmeter-server
    

    Or:

    /opt/jmeter/bin/jmeter-server
    

    Launch Test

    From master:

    jmeter -n \
    -t loadtest.jmx \
    -r \
    -l results.jtl
    

    The -r flag runs the test on all remote servers.

  14. Tune Linux for High Load

    Increase file descriptors:

    sudo nano /etc/security/limits.conf
    

    Add:

    * soft nofile 65535
    * hard nofile 65535
    

    Apply:

    ulimit -n 65535
    

    Verify:

    ulimit -n
    

    Increase TCP ports:

    sudo nano /etc/sysctl.conf
    

    Add:

    net.ipv4.ip_local_port_range=1024 65535
    net.ipv4.tcp_tw_reuse=1
    net.core.somaxconn=65535
    

    Apply:

    sudo sysctl -p
    
  15. Useful JMeter Commands

    Show version:

    jmeter --version
    

    Run test:

    jmeter -n -t test.jmx -l results.jtl
    

    Generate report:

    jmeter -g results.jtl -o report
    

    Run distributed:

    jmeter -n -t test.jmx -r
    

    Stop gracefully:

    pkill -f ApacheJMeter
    

    Force stop:

    pkill -9 -f ApacheJMeter
    

Production Best Practices

Do

βœ… Run in non-GUI mode only
βœ… Generate HTML reports after testing
βœ… Use runtime variables (-J)
βœ… Monitor CPU, memory, and network usage
βœ… Use multiple VPS instances for high concurrency
βœ… Store results on fast SSD storage

Don’t

❌ Run GUI mode on a VPS
❌ Save every response body in results
❌ Test production without permission
❌ Run excessive listeners during load tests
❌ Launch millions of threads from a single server

Example Real-World API Load Test

jmeter -n \
-t api-loadtest.jmx \
-Jthreads=500 \
-Jrampup=300 \
-Jduration=1800 \
-l api-results.jtl

This configuration simulates:

  • 500 virtual users
  • 5-minute ramp-up
  • 30-minute test duration
  • Results stored in api-results.jtl

Ideal for testing REST APIs, web applications, and hosting infrastructure.
Launch 100% ssd ubuntu vps from $3. 19/mo!

Conclusion

You now know how to deploy Apache JMeter on Ubuntu VPS.

Avatar of editorial staff

Editorial Staff

Rad Web Hosting is a leading provider of web hosting, Cloud VPS, and Dedicated Servers in Dallas, TX.
lg