温馨提示×

Ubuntu Postman配置步骤

小樊
40
2025-10-26 16:52:43
栏目: 智能运维

Installing Postman on Ubuntu
Postman can be installed on Ubuntu via three methods: Snap (recommended for simplicity), manual download (for custom versions), or PPA (for package manager integration). Below are detailed steps for each:

1. Install via Snap (Recommended)

Snap is a universal package manager for Linux that simplifies installation and updates.

  • Update System Packages: Run sudo apt update && sudo apt upgrade to ensure your system is up-to-date.
  • Install Snapd (if not installed): Execute sudo apt install snapd to install the Snap daemon.
  • Install Postman: Use the command sudo snap install postman to install Postman. The application will appear in your application menu.
  • Launch Postman: Open it from the application menu or run postman in the terminal.

2. Manual Download & Installation

For users who prefer specific versions or offline installation:

  • Download the Installer: Visit the Postman website, select the Linux version (.tar.gz), and save it to your ~/Downloads folder.
  • Extract the Archive: Open a terminal, navigate to the Downloads folder (cd ~/Downloads), and run sudo tar -xzf Postman-linux-x64-*.tar.gz -C /opt/ (replace * with the actual version number). This extracts Postman to /opt/Postman.
  • Create a Symbolic Link: To run Postman from the terminal, create a link with sudo ln -s /opt/Postman/Postman /usr/local/bin/postman.
  • Add a Desktop Shortcut (Optional): For easy access from the application menu, create a .desktop file:
    sudo nano /usr/share/applications/postman.desktop
    
    Paste the following content (update the path if needed):
    [Desktop Entry]
    Encoding=UTF-8
    Name=Postman
    Exec=/opt/Postman/Postman
    Icon=/opt/Postman/app/resources/app/assets/icon.png
    Terminal=false
    Type=Application
    Categories=Development;
    
    Save (Ctrl+O, Enter) and exit (Ctrl+X). Update the desktop database with sudo update-desktop-database.
  • Launch Postman: Run postman in the terminal or find it in the application menu.

3. Install via PPA (Alternative)

Some users may prefer using a Personal Package Archive (PPA) for package management:

  • Add the Postman PPA: Run sudo add-apt-repository https://dl.bintray.com/postman/apt and confirm with Enter.
  • Update Package Lists: Execute sudo apt update to refresh the package index.
  • Install Postman: Use sudo apt install postman to install the application. Launch it from the application menu or terminal.

Configuring Postman
After installation, configure essential settings to optimize Postman for your workflow:

1. Set Up Proxy (Optional)

If you’re behind a corporate proxy, configure Postman to use it:

  • Open Postman and click the gear icon (⚙️) in the top-right corner to open Settings.
  • Navigate to the General tab.
  • Under the Proxy section, enter your Proxy Server Address and Port.
  • If your proxy requires authentication, check Proxy authentication and provide your Username and Password.
  • Click Save to apply changes.

2. Configure Environment Variables (Optional)

Environment variables help manage API keys, base URLs, and other sensitive data across requests:

  • Open Postman and click the gear icon (⚙️) > Manage Environments.
  • Click the + Add button to create a new environment (e.g., “Development”).
  • Enter a Variable Name (e.g., API_KEY) and its corresponding Value (e.g., your_api_key_here).
  • Click Save. To use the variable in a request, reference it with double curly braces (e.g., {{API_KEY}}).

3. Set API Key (Optional)

For API integrations requiring an API key:

  • Open Postman and click your avatar in the top-left corner > Settings.
  • Navigate to the General tab.
  • In the API Key section, generate a new key or paste an existing one.
  • Click Save to store the key securely.

By following these steps, you can successfully install and configure Postman on Ubuntu to streamline your API development workflow.

0