How To Install Postman In Ubuntu 18.04 Using Terminal
Install Postman on Ubuntu 18.04 Using the Terminal
This guide will walk you through installing Postman on Ubuntu 18.04 using the terminal. Postman is a popular tool for API testing, and its command-line interface offers flexibility and integration with scripting.
1. Download the Postman App Image
The first step is to download the appropriate Postman app image for your platform. You can find the download links on the official Postman website. Look for the Linux download option.
wget https://dl.pstmn.io/download/latest/linux64Replace https://dl.pstmn.io/download/latest/linux64 with the correct URL for your version of Postman.
2. Make the Image Executable
Once the download is complete, make the downloaded image executable:
chmod +x linux64Replace linux64 with the actual filename you downloaded.
3. Run Postman
Run the Postman app:
./linux64The Postman app will launch in your browser window. NOTE: If you experience a “permission denied” error, you may need to run the command with sudo:
sudo ./linux64This will open the Postman app and allow you to begin using the interface.
4. Install Postman Using Snap
You can also install Postman using Snap, a universal Linux package manager.
Install Snap:
If you don’t have Snaps installed, you can install it on Ubuntu 18.04:
sudo apt updatesudo apt install snapdInstall Postman:
Once Snap is set up, you can install Postman using the following command:
sudo snap install postmanYou can then launch Postman from the terminal by running:
postman5. Install Postman Using the Official Package
Postman also offers official packages. You can find the latest package on the official Postman download page. Once downloaded, use dpkg to install the package:
sudo dpkg -i postman_VERSION_amd64.debReplace postman_VERSION_amd64.deb with the actual filename. If the package has dependencies missing, run the following command:
sudo apt-get install -fUsing Postman from the Terminal
Postman offers a command-line interface (CLI) that enables you to automate API testing tasks and even manage your API collections and environments. However, the Postman CLI needs to be installed separately using npm.
npm install -g newmanThis will install the newman command-line tool, which you can then use to execute Postman collections.
Run a Collection with Newman
newman run collection.json -e environment.jsonReplace collection.json and environment.json with the actual filenames of your Postman collection and environment files.
Example:
# Sample 'collection.json'{ "info": { "_postman_id": "482e36de-6607-4768-b24c-9f79e37d05c6", "name": "My API Collection", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" }, "item": [ { "name": "GET Request", "request": { "method": "GET", "header": [], "url": { "raw": "https://example.com/api/v1/users", "protocol": "https", "host": ["example", "com"], "path": ["api", "v1", "users"] } }, "response": [] } ]}
# Sample 'environment.json'{ "id": "a1420a2d-a4ba-468b-9d86-f6238a98a199", "name": "My Environment", "values": [ { "key": "baseUrl", "value": "https://example.com/api/v1", "type": "string", "enabled": true } ]}Using Environment Variables:
newman run collection.json -e environment.json -g baseUrl=https://dev.example.com/api/v1This will overwrite the baseUrl value within your environment file with the value provided via the -g flag.
6. Choosing an Installation Method
You can use whichever method is the most convenient for you. If you want a more traditional installation, consider the dpkg method or a dedicated package download if available. If you prefer a simple and quick method, using Snap is an excellent solution. Finally, if you plan to utilize Postman’s command-line interface for testing automation, using npm to install Newman is the best option.
