Installation#
Requirements#
Linux or macOS; it might work on Windows
Python 3.11 or later
Installation on Linux#
On a Debian-based distro (Ubuntu, Mint), install Python 3 using:
$ sudo apt install python3
On a RPM-based distro (RHEL, Fedora), install Python 3 using:
$ sudo dnf install python3
Then run:
$ python3 -m pip install --user cpanel-cli
Test the installation using:
$ cpanel --version
Tested on Ubuntu Linux 23.10 “Mantic”, but it has no specific Ubuntu requirements, so any Linux distro with Python 3.11 or later should work.
Installation on macOS#
Install Python 3 using Homebrew.
$ brew install python
Then run:
$ python3 -m pip install --user cpanel-cli
Test the installation using:
$ cpanel --version
Tested on macOS “Ventura”; should also work on any later release.
What about Windows?#
cpanel-cli should work on Windows 10/11 using WSL 2 (Windows Subsystem for Linux).
Unfortunately I don’t have access to a Windows system, so I can’t confirm this.
Authentication#
To authenticate against your cPanel instance, the recommended way is to create a
$HOME/.config/cpanel/cpanel.conf configuration file.
If you don’t want to use the XDG-compliant $HOME/.config/cpanel location,
you can use a traditional $HOME/.cpanelrc file.
The configuration file must contain the following:
hostname=example.com
username=scott
utoken=ABCDEFGHIJKLMNOPQSRTUVWXYZ012345
hostnameis the hostname of your cPanel instanceusernameis your user name on your instanceutokenis an API token associated withusername. See How to use cPanel API tokens for further information on how to create tokens.
Alternatively, you can set the following environmental variables in your shell:
CPANEL_HOSTNAMECPANEL_USERNAMECPANEL_UTOKEN
For example:
$ export CPANEL_HOSTNAME=example.com
$ export CPANEL_USERNAME=scott
$ export CPANEL_UTOKEN=ABCDEFGHIJKLMNOPQSRTUVWXYZ012345
$ cpanel list features
Or you can pass the credentials directly on the command line using the -H, -U and
-T options. For example:
$ cpanel -H example.com -U scott -T ABCDEFGHIJKLMNOPQSRTUVWXYZ012345 list features
Options passed on the command line override environmental variables, which in turn
override cpanel.conf or .cpanelrc values.