【注意】 Jmeter必须在系统配置成功jdk后,才能进行jmeter的安装配置运行操作。
如果,系统中没有安装jdk,详见使用Ubuntu16.04一键安装jdk进行相关jdk的安装配置。
【软件版本说明】
软件名 | 版本号 |
---|---|
jdk | 1.8.121 |
apache-jmeter | 5.4.3 |
1.一键安装jmeter的shell脚本:
#一键安装jmeter#
#!/bin/bash
sudo cd /opt
sudo wget https://mirrors.tuna.tsinghua.edu.cn/apache/jmeter/binaries/apache-jmeter-5.4.3.tgz
#pwd
#extract jdk
#sudo cd /opt
sudo tar -xvf apache-jmeter-5.4.3.tgz -C /opt
pwd
echo "------------------------------------------------------------"
echo "------------------start to install jmeter--------------------"
#set environment
export JMETER_HOME="/opt/apache-jmeter-5.4.3"
if ! grep JMETER_HOME="/opt/apache-jmeter-5.4.3" /etc/profile
then
echo "JMTER_HOME=/opt/apache-jmeter-5.4.3" | sudo tee -a /etc/profile
echo "export JMETER_HOME" | sudo tee -a /etc/profile
echo "PATH=${JMETER_HOME}/bin:$PATH" | sudo tee -a /etc/profile
echo "export PATH" | sudo tee -a /etc/profile
fi
source /etc/profile
sudo update-alternatives --install /usr/bin/jmeter jmeter /opt/apache-jmeter-5.4.3/bin/jmeter 500
sudo jmeter --version
2.用法:
#wget https://coding.net/u/jamesz2011/p/ubuntu_lib/git/raw/master/jmeter/install_jmeter.sh
sudo chmod a+x install_jmeter.sh
sudo source install_jmeter.sh