我在EC2 亚马逊的ubuntu系统下进行的配置,步骤如下(非常简单)
1、在/usr/local下分别新建java和jmeter文件夹,把下载的包进行解压
注:此处有坑,需注意ll -lht 查看下载包的大小,包异常8k的话请重新下载。
下载指令
wget https://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jdk-8u191-linux-x64.tar.gz
下载地址需自行去官网复制,未同意官网协议,直接复制地址下载会有异常
注:文件名需要改名sudo mv jdk-8u191-linux-x64.tar.gz?AuthParam=1546155659_0d39590cd367d6bc72573064c2eb197c jdk-8u191-linux-x64.tar.gz
解压指令 sudo tar -xvf jdk-8u191-linux-x64.tar.gz
2、进行配置文件
修改配置文件指令 sudo /etc/profile
配置文件信息如下:
#creat default,java/jmeter classpath、path *_home
export JAVA_HOME=/usr/local/java/jdk1.8.0_191
export JMETER_HOME=/usr/local/jmeter/apache-jmeter-5.0
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/tools.jar:$JMETER_HOME/lib/ext/ApacheJMeter_core.jar:$JMETER_HOME/lib/jorphan.jar:$JMETER_HOME/lib/logkit-2.0.jar:$CLASSPATH
export PATH=$PATH:$JAVA_HOME/bin:$JMETER_HOME/bin:$PATH:$HOME/bin
执行脚本指令source /etc/profile
source命令用法:source FileName
作用:在当前bash环境下读取并执行FileName中的命令。
注:该命令通常用命令".”来替代。
3、输入java -version查看jdk版本,
[ec2-user@jackzz~]$ java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
4、输入jmeter --version查看jmeter版本
[ec2-user@jackzz ~]$ jmeter
Dec 30, 2018 8:14:34 AM java.util.prefs.FileSystemPreferences$1 run
INFO: Created user preferences directory.
================================================================================
Don't use GUI mode for load testing !, only for Test creation and Test debugging.
For load testing, use NON GUI Mode:
jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]
& increase Java Heap to meet your test requirements:
Modify current env variable HEAP="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m" in the jmeter batch file
Check : https://jmeter.apache.org/usermanual/best-practices.html
================================================================================
An error occurred:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
[ec2-user@jackzz ~]$ jmeter --version
_ ____ _ ____ _ _ _____ _ __ __ _____ _____ _____ ____
/ | _ / / ___| | | | ____| | | / | ____|_ _| ____| _
/ _ | |_) / _ | | | |_| | _| _ | | |/| | _| | | | _| | |_) |
/ ___ | __/ ___ |___| _ | |___ | |_| | | | | |___ | | | |___| _ <
/_/ \_\_| /_/ \_\____|_| |_|_____| \___/|_| |_|_____| |_| |_____|_| \_ 5.0 r1840935
Copyright (c) 1999-2018 The Apache Software Foundation