在 Debian 上“测 Postman”通常有两种理解,我分别说明,你可以按需选择。
sudo apt update
sudo apt install -y wget libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 libxkbcommon0 libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 libpango-1.0-0 libcairo2 libasound2
cd /tmp
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
tar -xzf postman.tar.gz
sudo mv Postman /opt/Postman
sudo ln -s /opt/Postman/Postman /usr/bin/postman
运行:
postman
⚠️ 需要 桌面环境(GNOME / KDE 等) 才能正常使用 GUI
如果你只是想 用 Postman 的导出文件测试 API,不需要 GUI,可以用 Newman(Postman 的命令行运行器)。
sudo apt install -y nodejs npm
sudo npm install -g newman
在 Postman 中:
··· → Exporttest.jsonnewman run test.json
带环境变量:
newman run test.json -e env.json
生成 HTML 报告:
npm install -g newman-reporter-htmlextra
newman run test.json -r htmlextra
如果只是临时验证接口:
curl -X GET http://localhost:8080/api/test
或 POST:
curl -X POST http://localhost:8080/api/test \
-H "Content-Type: application/json" \
-d '{"name":"debian"}'
✅ Newman + CI(GitHub Actions / GitLab CI) ✅ curl 脚本 ❌ 不推荐服务器装 GUI Postman
如果你能补充一句:
我可以给你更精确的命令。