Ubuntu1604完美安装jdk1.8.121和jmeter5.1.1
jmeter必须在系统配置成功jdk后,才能进行jmeter的安装配置运行操作
Ubuntu安装jbk1.8.121
#!/bin/bash
#this shell to use installing jdk1.8.121
#echo "this shell to use installing jdk1.8.121 "
#echo "------------------start to install jdk----------------------"
#sudo su #切换到root权限
mkdir /usr/local/java
cd /usr/local/java
#download jdk 1.8.121
#wget -c --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz
wget https://coding.net/u/jamesz2011/p/ubuntu_lib/git/raw/master/jdk/jdk-8u121-linux-x64.tar.gz
#extract jdk
tar -xvf jdk-8u121-linux-x64.tar.gz
#set environment
export JAVA_HOME="/usr/local/java/jdk1.8.0_121"
if ! grep "JAVA_HOME=/usr/local/java/jdk1.8.0_121" /etc/profile
then
echo "JAVA_HOME=/usr/local/java/jdk1.8.0_121" | sudo tee -a /etc/profile
echo "export JAVA_HOME" | sudo tee -a /etc/profile
echo "JRE_HOME=${JAVA_HOME}/jre" | sudo tee -a /etc/profile
echo "export JRE_HOME" | sudo tee -a /etc/profile
echo "CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib" | sudo tee -a /etc/profile
echo "export CLASSPATH" | sudo tee -a /etc/profile
echo "PATH=${JAVA_HOME}/bin:$PATH" | sudo tee -a /etc/profile
echo "export PATH" | sudo tee -a /etc/profile
fi
#update profile
#source /etc/profile
sudo update-alternatives --install /usr/bin/java java /usr/local/java/jdk1.8.0_121/bin/java 300
sudo update-alternatives --install /usr/bin/javac javac /usr/local/java/jdk1.8.0_121/bin/javac 300
#echo "------------------end to install jdk------------------------"
用install_jdk.sh文件地址安装
wget https://coding.net/u/jamesz2011/p/ubuntu_lib/git/raw/master/jdk/install_jdk.sh
sudo chmod a+x install_jdk.sh
sudo source install_jdk.sh
验证是否安装成功
java -version
【若出现版本号,则安装成功】
Ubuntu1604安装jmeter5.1.1
下载jmeter5.1.1安装包
sudo wget https://mirrors.tuna.tsinghua.edu.cn/apache/jmeter/binaries/apache-jmeter-5.1.1.zip
解压jmeter以及配置
sudo unzip apache-jmeter-5.1.1.zip
sudo mv apache-jmeter-5.1.1 /opt/
sudo ln -s /opt/apache-jmeter-5.1.1/ /opt/jmeter
创建图标
sudo gedit ~/.local/share/applications/apache_jmeter.desktop
输入以下内容
[Desktop Entry]
Encoding=UTF-8
Version=5.1.1
Type=Application
Name=Apache JMeter (5.1.1 r1855137)
Icon=/opt/jmeter/docs/images/jmeter.png
Path=/opt/apache-jmeter-5.1.1
Exec=java -jar /opt/jmeter/bin/ApacheJMeter.jar
StartupNotify=false
StartupWMClass=Apache JMeter
OnlyShowIn=Unity;
X-UnityGenerated=true
启动jmeter
/opt/jmeter/bin/jmeter.sh
jmeter启动成功,图标出现在桌面左侧启动器,右键图标锁定到启动器即可
注意:
开始出来的图标没有图片,原因是Icon中对应的图片位置不对,需要在终端输入
find . -type f -name *.png
在终端输入以下代码,来查看图片
display jmeter.png