Install kbcli
You can install kbcli on your laptop or virtual machines on the cloud.
Environment preparation
For Windows users, PowerShell version should be 5.0 or higher.
Install kbcli
kbcli now supports macOS, Windows, and Linux.
- macOS
- Windows
- Linux
You can install kbcli with curl
or brew
.
- Option 1: Install kbcli using the
curl
command.
Install kbcli.
curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash
If you want to install kbcli with a specified version, follow the steps below.
Check the available versions in KubeBlocks Release.
Specify a version with
-s
and run the command below.curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash -s x.x.x
noteBy default, kbcli installs the latest release version and then when installing KubeBlocks, kbcli installs the matched version. Ensure that the major versions of kbcli and KubeBlocks match.
For instance, you can install kbcli v0.6.1 and KubeBlocks v0.6.3, but mismatched versions like kbcli v0.5.0 and KubeBlocks v0.6.0 may result in errors.
Run
kbcli version
to check the version of kbcli and ensure that it is successfully installed.noteIf a timeout exception occurs during installation, please check your network settings and retry.
- Option 2: Install kbcli using Homebrew.
Install ApeCloud tap, the Homebrew package of ApeCloud.
brew tap apecloud/tap
Install kbcli.
brew install kbcli
If you want to install kbcli with a specified version, run the commands below.
# View the available version
brew search kbcli
# Specify a version
brew install kbcli@x.x.xVerify that kbcli is successfully installed.
kbcli -h
There are two ways to install kbcli on Windows:
- Option 1: Install using the script.
By default, the script will be installed at C:\Program Files\kbcli-windows-amd64 and cannot be modified.
If you need to customize the installation path, use the zip file.
Run PowerShell as an administrator and execute
Set-ExecutionPolicy Unrestricted
.Install kbcli.
The following script will automatically install the environment variables at C:\Program Files\kbcli-windows-amd64.
powershell -Command " & ([scriptblock]::Create((iwr https://www.kubeblocks.io/installer/install_cli.ps1)))"
To install a specified version of kbcli, use
-v
after the command and describe the version you want to install.powershell -Command " & ([scriptblock]::Create((iwr https://www.kubeblocks.io/installer/install_cli.ps1))) -v 0.5.2"
- Option 2: Install using the installation package.
- Download the kbcli installation zip package from KubeBlocks Release.
- Extract the file and add it to the environment variables.
- Click the Windows icon and select System Settings.
- Click Settings -> Related Settings -> Advanced system settings.
- Click Environment Variables on the Advanced tab.
- Click New to add the path of the kbcli installation package to the user and system variables.
- Click Apply and OK.
Install kbcli using the curl
command.
Install kbcli.
curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash
Run
kbcli version
to check the version of kbcli and ensure that it is successfully installed.
- If a timeout exception occurs during installation, please check your network settings and retry.
(Optional) Enable auto-completion for kbcli
kbcli
supports command line auto-completion.
# Configure SHELL-TYPE as one type from bash, fish, PowerShell, and zsh
kbcli completion SHELL-TYPE -h
For example, enable kbcli auto-completion for zsh.
Steps:
Check the user guide.
kbcli completion zsh -h
Enable the completion function of your terminal first.
echo "autoload -U compinit; compinit" >> ~/.zshrc
Enable the
kbcli
automatic completion function.echo "source <(kbcli completion zsh); compdef _kbcli kbcli" >> ~/.zshrc