温馨提示×

如何用ubuntu测postman

小樊
47
2026-09-28 04:25:40
栏目: 智能运维

在 Ubuntu 上“测 Postman”通常有三种理解,我先分情况说明,你对照看是哪一种:


一、在 Ubuntu 上安装并运行 Postman(最常用)

如果你是想知道 怎么在 Ubuntu 上使用 Postman 发请求:

1️⃣ 安装 Postman

方式 A:Snap(推荐)

sudo snap install postman

安装完成后,在应用菜单搜索 Postman 即可。

方式 B:官网下载

  1. 到 https://www.postman.com/downloads/
  2. 选择 Linux 版本(.tar.gz)
  3. 解压并运行:
tar -xzf Postman-linux-x64-*.tar.gz
./Postman/Postman

2️⃣ 基本测试示例

打开 Postman → New → Request

  • Method: GET
  • URL: https://jsonplaceholder.typicode.com/posts/1
  • 点击 Send
  • 查看返回 JSON

二、用 Ubuntu 命令行测试接口(替代 Postman)

如果你是说“不用 Postman 界面,在 Ubuntu 上测接口”:

用 curl

curl -X GET https://jsonplaceholder.typicode.com/posts/1

POST 示例

curl -X POST https://example.com/api \
  -H "Content-Type: application/json" \
  -d '{"name":"test"}'

三、用 Postman 的 命令行工具 Newman(自动化测试)

如果你是写测试用例并在 Ubuntu 上运行:

1️⃣ 安装 Node + Newman

sudo apt update
sudo apt install nodejs npm
sudo npm install -g newman

2️⃣ 导出 Postman Collection

Postman → Collection → Export → 得到 xxx.json

3️⃣ 运行测试

newman run xxx.json

四、如果你指的是“测试 Postman 本身是否正常”

可以检查:

postman --version

或

which postman

如果你能补充一句:

  • 是 界面使用
  • 还是 命令行测试接口
  • 还是 自动化测试

我可以直接给你一套适合你场景的操作步骤。

0 踩