How to install Heroku CLI on Ubuntu Server


Heroku is a cloud platform that lets us build, run, and scale applications quickly. The Heroku Command Line Interface (CLI) is an essential tool for managing applications on Heroku. It allows us to deploy code, monitor apps, and scale services directly from the terminal. If we're working with MuleSoft or other cloud-based tools, the Heroku CLI can simplify deployment and management.

In this post, we'll learn how to install the Heroku CLI on an Ubuntu server. Follow these steps to set up our system and start using Heroku seamlessly.


Prerequisites

Before installing the Heroku CLI, we need to ensure our system meets these requirements:
  • Ubuntu Server (20.04 or later recommended)
  • A non-root user with sudo privileges
  • curl installed on our system


Update System Packages

Before installing new software, we’ll update our system’s package list to ensure we get the latest versions:
sudo apt update
sudo apt upgrade -y


Install Required Dependencies

If curl and wget are not installed, we can install them using the following command:

sudo apt install curl wget -y


Download and Install the Heroku CLI

Run the command below to add the Heroku repository and install the CLI:

curl -sSL https://cli-assets.heroku.com/install.sh | sudo bash

This script automatically downloads and installs the Heroku CLI for Ubuntu.


Verify Installation

To check if the Heroku CLI is installed correctly, run:

heroku --version

If installed successfully, we'll see the version number displayed in the terminal. Something similar to:

heroku/10.4.0 linux-x64 node-v20.17.0


Login to Heroku

To start using Heroku, we need to log in using our Heroku account credentials:

heroku login

This will prompt you to open a browser for authentication. If we're on a server without a graphical interface, we can use:

heroku login -i

This will prompt you to enter your email and password in the terminal. If you’re account is protected by MFA use the API key as your password.


Install Git

If you plan to deploy applications to Heroku, install Git:

sudo apt install git -y

That's it! The Heroku CLI is now installed and ready to use on your Ubuntu server




Previous Post Next Post