Install and configure the CLI
Review these sections to install the Linode CLI locally.
Installation
Windows, macOS, and Linux (including Ubuntu 23.04 and earlier)
-
Open a terminal application. For Windows, you can use either Powershell or the command prompt.
-
Run these commands to ensure that Python 3 and
pip3
are both installed. If they're not, see Other installs: Python and pip.python3 --version pip3 --version
-
To install Linode CLI, run this command:
pip3 install linode-cli --upgrade
If you see an error like this, you need to add your Python's
bin
folder to your systemPATH
environment variable. Steps to do this vary based on your operating system.WARNING: The script normalizer is installed in '/Users/USERNAME/Library/Python/3.9/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
-
If you're using Linode's Object Storage service, you also need to install the
boto
library:pip3 install boto3
-
To confirm installation, run the help command:
linode-cli --help
Linux (Ubuntu 23.04 and later)
These releases of Ubuntu enforce PEP 668, which prevents you from installing Python packages system-wide using pip
. Instead, you can install using apt
or using pipx
.
You environment returns this error if pip
is run:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.12/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
Install using PipX
You can use pipx
to install the Linode CLI, system-wide in an automatically managed isolated environment.
-
Install
pipx
:sudo apt install pipx -y
-
Ensure the
pipx
path is configured:pipx ensurepath
-
Use
pipx
to install the Linode CLI:pipx install linode-cli
-
You can verify installation of the CLI by running the
--help
command:linode-cli --help
Configure the CLI
You need to authenticate your access to the CLI to use it. Use either of these methods to set it up.
Interactive configuration
With this method, you set up authentication via a token, as you initially interact with the CLI. Each time you interact with it again, you'll need to follow this same process.
-
Initiate the Linode CLI configuration process.
-
Web-based authentication: Prompts you to sign in to your account through a web browser.
linode-cli configure
-
Manually create a personal access token: Prompts you for a token that you need to manually create. See Linode API Keys and Tokens.
linode-cli configure --token
-
-
After authenticating or providing a token, you see a series of prompts to select your preferred defaults, such as the region, Compute Instance type, and distribution. These are optional and can be overridden when running individual commands. Update these defaults at any time by running
linode-cli configure
again or by editing the.config/linode-cli
configuration file.
Non-interactive configuration
To configure the CLI without any interactive prompts, you can manually generate a token and then set it using an environment variable, replacing [token]
:
export LINODE_CLI_TOKEN="[token]"
If you don't set this variable, the Linode CLI stops working until you set it again or until you set up the CLI using the interactive configuration method.
Other installs: Python and pip
If you don't already have python and pip installed on your system, follow these instructions to get the right versions.
Windows
Install Python 3 on Windows by downloading the installer package directly from Python's website:
-
Go to Python's Downloads page. Download the latest stable Python 3 package for Windows.
-
Open the installer package that was just downloaded. This is likely a
.exe
file. -
Within the installer window, check "Add Python 3.x to PATH" and then select Customize installation.
-
Ensure that the
pip
option is checked and select Next. -
Under Advanced Options, ensure that the following options are checked:
- Install for all users
- Associate files with Python
- Create shortcuts for installed applications
- Add Python to environment variables
- Precompiled standard library
-
Select
Next
to proceed with the installation. Once the installation is complete, a message appears confirming that Python 3 was successfully installed.
macOS
Install Python 3 on macOS by downloading the package directly from Python's website:
-
Go to Python's Downloads page. Download the latest stable Python 3 package for macOS.
-
Open the installer package to begin the installation.
-
Follow the prompts to install Python3 and pip.
Linux
On most Linux distributions, you can use the distribution's package manager to install both the python3
and python3-pip
packages.
-
Ubuntu and Debian: Ubuntu 22.x, 20.x, 18.x, and 16.x | Debian 11, 10, and 9
If you're using Ubuntu Linux 23.04 or later, you need to install the proper version of Python and use
pipx
, rather than standardpip
. (These versions of Linux don't support installs usingpip
.)sudo apt update sudo apt install python3 && sudo apt install python3-pip
-
CentOS Stream, RHEL 8, and Fedora: CentOS Stream 9 (and 8), CentOS 8, other RHEL derivatives (including AlmaLinux 8, and Rocky Linux 8), and Fedora.
sudo dnf upgrade sudo dnf install python3 && sudo dnf install python3-pip
-
CentOS 7
sudo yum update sudo yum install python3 && sudo yum install python3-pip
Confirm installation
You can run any of these commands for verify installation:
python3 --version
pip3 --version
(For standardpip
)pipx --version
If you receive command not found
, you may need to add Python3, Pip3, or PipX's locations to your $PATH.
Updated 11 days ago