在CentOS系統上獲取Postman資源,通常指的是安裝Postman應用程序以便進行API開發和測試。以下是幾種在CentOS系統上安裝Postman的方法:
wget
命令直接從終端下載:wget https://dl.pstmn.io/download/latest/linux64 -O postman.tar.gz
/usr/local/postman
目錄:sudo mkdir -p /usr/local/postman
sudo tar -zxf postman.tar.gz --strip-components=1 -C /usr/local/postman/
postman
命令:sudo ln -s /usr/local/postman/Postman/Postman /usr/bin/postman
sudo touch /usr/share/applications/postman.desktop
sudo vim /usr/share/applications/postman.desktop
在文件中添加以下內容:
[Desktop Entry]
Encoding=UTF-8
Name=Postman
GenericName=API Tools
Comment=Postman
Exec=/usr/bin/postman
Terminal=false
MimeType=text/plain
Icon=/usr/local/postman/app/resources/app/assets/icon.png
StartupNotify=true
Categories=Development;
sudo chmod +x /usr/share/applications/postman.desktop
如果您使用的是 CentOS 8 或更高版本,可以使用 Snap 來安裝 Postman:
sudo snap install postman
安裝完成后,可能需要重啟計算機。
如果您更喜歡使用命令行工具,可以通過 Node.js 安裝 Newman,這是 Postman 的命令行版本:
sudo yum install -y nodejs npm
sudo npm install -g newman
以上就是在 CentOS 環境中運行 Postman 的幾種方法。您可以根據自己的需求和偏好選擇最適合的方式。