在 Debian 上用 Postman 测试接口,一般有两种方式:图形界面 Postman 和 命令行 Newman(Postman 的 CLI)。下面按常见使用场景说明。
# 下载
wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
# 解压
tar -xzf postman.tar.gz -C /opt
# 创建启动命令
ln -s /opt/Postman/Postman /usr/local/bin/postman
启动:
postman
如果是 无桌面环境(服务器),无法使用图形界面,请看下面 Newman 方案。
sudo apt install snapd
sudo snap install postman
http://localhost:8080/api/test{
"username": "test",
"password": "123456"
}
sudo apt update
sudo apt install nodejs npm
sudo npm install -g newman
在 Postman 中:
test.postman_collection.jsonnewman run test.postman_collection.json
带环境变量:
newman run test.postman_collection.json \
-e env.postman_environment.json
✅ 用 Newman
✅ 或在本地 Windows / macOS 跑 Postman,连接 Debian 服务
检查:
curl http://localhost:8080/api/test
确认:
127.0.0.1 以外被限制Postman 中:
如果你愿意,可以告诉我:
我可以直接给你一套可运行的示例。