Jmeter запуск на linux

Установка и запуск JMeter на Linux CentOS

Обновлено и опубликовано

Опубликовано: 06.09.2021

Данная инструкция показывает только установку на Linux CentOS и настройку в качестве сервиса инструмент для тестирования JMeter.

Подготовка системы

Предварительно, необходимо установить openjdk и wget. Для этого вводим:

yum install java-11-openjdk wget

Мы должны увидеть что-то на подобие:

openjdk version «11.0.12» 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)

Установка JMeter

Установку необходимо выполнить как на сервере, так и на всех клиентах.

Переходим на официальную страницу загрузки JMeter. Нам нужен архив tgz с бинарным файлом. Находим его и копируем ссылку:

Копируем ссылку на последнюю версию jmeter

Используя скопированную ссылку, загружаем на сервер архив:

tar zxvf apache-jmeter-5.4.1.tgz

И переносим распакованный архив в каталог /opt/jmeter:

mv apache-jmeter-*/ /opt/jmeter

Создаем файл для настройки переменных окружения:

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

* в данном примере мы создаем переменную JMETER_HOME с путем до нашего каталога и добавляем ее значение к переменной PATH, которая используется для поиска системой файлов запуска.

Запускаем на выполнения файл, чтобы создать в текущей сессии нужные нам переменные окружения:

Мы должны увидеть версию нашего jmeter:

_ __ __ _____ _____ _____ ____
| | \/ | ____|_ _| ____| _ \
_ | | |\/| | _| | | | _| | |_) |
| |_| | | | | |___ | | | |___| _ \___/|_| |_|_____| |_| |_____|_| \_\ 5.4.1

Copyright (c) 1999-2021 The Apache Software Foundation

Запуск в качестве сервера

Запустим серверную часть в качестве службы.

Настройка сервера

Необходимо создать хранилище ключей перед запуском JMeter с помощью скрипта create-rmi-keystore.sh:

Скрипт запросит наши данные:

What is your first and last name?
[Unknown]: Dmosk
What is the name of your organizational unit?
[Unknown]: DmoskOU
What is the name of your organization?
[Unknown]: Dmosk
What is the name of your City or Locality?
[Unknown]: SPb
What is the name of your State or Province?
[Unknown]: SPb
What is the two-letter country code for this unit?
[Unknown]: RU
Is CN=Dmosk, OU=DmoskOU, O=Dmosk, L=SPb, ST=SPb, C=RU correct?
[no]: yes

Copy the generated rmi_keystore.jks to jmeter/bin folder or reference it in property ‘server.rmi.ssl.keystore.file’

Пробуем запустить сервис командой:

Читайте также:  Linux узнать внутренний ip адрес

Мы должны увидеть что-то на подобие:

Created remote object: UnicastServerRef2 [liveRef: [endpoint:[10.129.0.12:41899,SSLRMIServerSocketFactory(host=bigdata-mon.ru-central1.internal/10.129.0.12, keyStoreLocation=rmi_keystore.jks, type=JKS, trustStoreLocation=rmi_keystore.jks, type=JKS, alias=rmi),SSLRMIClientSocketFactory(keyStoreLocation=rmi_keystore.jks, type=JKS, trustStoreLocation=rmi_keystore.jks, type=JKS, alias=rmi)](local),objID:[-795e2f04:17b5896bf72:-7fff, -516441775273034593]]]

Прерываем его работу комбинацией Ctrl + R и продолжаем настройку.

Автозапуск

Теперь создадим юнит в systemd:

[Unit]
Description=Apache Jmeter server
Documentation=https://jmeter.apache.org/usermanual/remote-test.html
Wants=network-online.target
After=network-online.target

[Service]
LimitNOFILE=10240
Type=simple
Restart=on-failure
RestartSec=180s
WorkingDirectory=/tmp
ExecStart=/opt/jmeter/bin/jmeter-server

* в данном примере мы будем запускать приложение /opt/jmeter/bin/jmeter-server.

Перечитываем конфигурацию в systemd:

Разрешаем автозапуск jmeter-server и стартуем его:

systemctl enable jmeter-server —now

Проверяем статус запущенного сервиса:

systemctl status jmeter-server

Настройка клиента

На клиентском компьютере открываем файл:

* где 192.168.0.15 — адрес нашего сервера с jmeter.

Пример запуска тестирования будет выглядеть так:

jmeter -t /tmp/my_test_file.jmx -n -r -X -f -l jmetter.jtl

* где /tmp/my_test_file.jmx — путь до файла с тестами (разработка данного файла не входит в тему данной инструкции).

Графическая оболочка

Настройка jmetter может выполняться с помощью графического интерфейса. Если мы подключены к серверу без графической оболочки по SSH, то нам нужно настроить проброс X11 на рабочий компьютер, с которого мы подключаемся по SSH.

Устанавливаем на сервере пакеты:

Открываем конфигурационный файл:

И проверяем, что опция X11Forwarding разрешена:

Если данную опцию пришлось изменить, то перезапускаем sshd:

Теперь мы можем подключиться к нашему серверу по SSH

Теперь можно запустить jmetter:

На компьютере, с которого мы подключены по SSH должно открыться окно с настройкой jmetter.

Источник

How to Install Apache JMeter on Ubuntu 20.04

Apache JMeter is a load testing tool. It is open-source and Java-based. JMeter can be used for the analysis of a system’s functional behavior. It measures a system’s performance under a load test. The load, in this case, simulates those end-user behaviors that approach the limitations of an application’s specifications. JMeter can be used for simulating loads that are variable or heavy. The simulation may be conducted on single or multiple servers. It may alternately be conducted over networks or objects testing a system’s strength. JMeter simulates a group of users. They send requests to a server or network. The returning statistics are shared back with a user through visual diagrams. JMeter also offers support for browser plug-ins. In this tutorial, we will show you how to install and use Apache Jmeter on Ubuntu 20.04.

Prerequisites

  • A fresh Ubuntu 20.04 Desktop VPS on the Atlantic.net Cloud Platform.
  • A root password is configured on your server.

Step 1 — Create Atlantic.Net Cloud Server

First, Login to your Atlantic.Net Cloud Server. Create a new server, choosing Ubuntu 20.04 as the operating system, with at least 2 GB RAM. Connect to your Cloud Server via SSH and log in using the credentials highlighted at the top of the page.

Once you are logged into your Ubuntu 20.04 server, run the following command to update your base system with the latest available packages.

Step 2 — Install Java

Apache JMeter is a Java-base application so Java must be installed in your system. You can install it by running the following command:

Читайте также:  Linux вывод даты изменения файла

apt-get install openjdk-8-jdk -y

After installing Java, verify the installed version of Java with the following command:

You should get the following output:

openjdk version "1.8.0_272" OpenJDK Runtime Environment (build 1.8.0_272-8u272-b10-0ubuntu1~20.04-b10) OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode) OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode) 

Step 3 — Install Apache Web Server

In this tutorial, we will use Jmeter to test the load of the Apache webserver. So you will need to install the Apache webserver in your system. You can install it with the following command:

After installing Apache web server, start the Apache service and enable it to start at system reboot:

Step 4 — Install Apache JMeter

By default, Apache JMeter is not available in the Ubuntu 20.04 default repository. So you will need to download it from its official website:

You can download it with the following command:

Once downloaded, unzip the downloaded file with the following command:

Step 5 — Launch the Apache JMeter Application

Next, change the directory to the JMeter:

Now, start the JMeter application with the following command:

You should see the JMeter interface in the following page:

Alt Text

Provide the name of your Test Plan and click on the Save button. You should see your Test plan in the left pane as shown below:

Alt Text

Next, you will need to add some components in your Test plan.

Add Thread Group

To add a thread group, right-click on the plan1 and click on the Add => Threads (Users) => Thread Group. You should see the following page:

Alt Text

Here, you will need to provide the Number of Thread Users, Loop Count and Ramp-Up Period. Once you are done, you can proceed to the next step.

Add HTTP Request Sampler

Next, you will need to add the HTTP Request Sample elements to represents a page request that each thread (user) will access.

To add it, right-click on Thread Group and click on the Add => Sampler => HTTP Request. You should see the following page:

Alt Text

Here, you will need to provide a name or the IP address of your web server that you want to test.

Add View Results in Table Listener

Next, you will need to add the Listener to output the results of a load test.

To add a Listener, right-click on HTTP Request and click on the Add => Listener => View Results in Table. You should see the following page:

Alt Text

Step 6 — Run Test and get the test result

At this point, your basic test plan is setup. Now it’s time to run the test.

Now, click on the green arrow button to start your test plan. You should see the test results in the following page:

Читайте также:  Linux file and directory programs

Alt Text

Conclusion

In the above guide, you learned how to install the Apache JEmeter on Ubuntu 20.04 desktop. You also learned how to create a basic test plan and run the test. I hope you can now easily use Apache JMeter for load testing.

If you would like to host your application on the cloud server then I would recommend to try Atlantic.net Cloud and get started with one full year of free VPS hosting in the cloud!

Источник

Как установить Apache JMeter в Ubuntu 20.04 LTS

hosting.energy недорогой хостинг сайтов

hosting.energy недорогой хостинг сайтов

В этом руководстве мы покажем вам, как установить Apache JMeter в Ubuntu 20.04 LTS. Для тех из вас, кто не знал, приложение Apache JMeter — это программное обеспечение с открытым исходным кодом, приложение на 100% чистой Java, разработанное для нагрузочного тестирования функционального поведения и измерения производительности. Первоначально он был разработан для тестирования веб-приложений, но с тех пор расширился до других функций тестирования.

В этой статье предполагается, что у вас есть хотя бы базовые знания Linux, вы знаете, как использовать оболочку, и, что наиболее важно, вы размещаете свой сайт на собственном VPS. Установка довольно проста и предполагает, что вы работаете с учетной записью root, в противном случае вам может потребоваться добавить ‘ sudo ‘ к командам для получения привилегий root. Я покажу вам пошаговую установку Apache JMeter на Ubuntu 20.04 (Focal Fossa). Вы можете следовать тем же инструкциям для Ubuntu 18.04, 16.04 и любого другого дистрибутива на основе Debian, например Linux Mint.

Установите Apache JMeter на Ubuntu 20.04 LTS Focal Fossa

Шаг 1. Во-первых, убедитесь, что все ваши системные пакеты обновлены, выполнив следующие apt команды в терминале.

sudo apt update sudo apt upgrade

Шаг 2. Установка Java.

Добавьте PPA «Linux Uprising» с помощью следующей команды:

sudo add-apt-repository ppa:linuxuprising/java

После добавления репозитория приступайте к установке Java в Ubuntu Linux:

sudo apt update sudo apt install oracle-java14-installer

Затем введите ниже, чтобы подтвердить версию Java:

$ java --version java version "14" 2020-04-20 Java(TM) SE Runtime Environment (build 14+46-1469) Java HotSpot(TM) 64-Bit Server VM (build 14+46-1469, mixed mode, sharing)

Шаг 3. Установка Apache JMeter в Ubuntu 20.04.

Теперь мы загружаем последнюю версию Apache JMeter, используя следующую команду:

wget http://www.gtlib.gatech.edu/pub/apache/jmeter/binaries/apache-jmeter-5.2.1.tgz

Затем распакуйте архив JMeter в корневой каталог документов на вашем сервере:

tar -xf apache-jmeter-5.2.1.tgz cd apache-jmeter-5.2.1

После извлечения загруженного пакета перейдите в извлеченную папку, а затем перейдите в каталог bin внутри извлеченной папки:

Затем запустите файл jmeter.sh с помощью команды. На экране появится графический интерфейс Jmeter: sh jemeter . sh

Поздравляю! Вы успешно установили Apache JMeter . Благодарим за использование этого руководства по установке Apache JMeter в системе Ubuntu 20.04 LTS Focal Fossa. Для получения дополнительной помощи или полезной информации мы рекомендуем вам посетить официальный сайт Apache JMeter .

Источник

Оцените статью
Adblock
detector