github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/installation/install-with-kbcli/install-kbcli.md (about)

     1  ---
     2  title: Install kbcli 
     3  description: Install kbcli 
     4  keywords: [install, kbcli,]
     5  sidebar_position: 2
     6  sidebar_label: Install kbcli
     7  ---
     8  
     9  import Tabs from '@theme/Tabs';
    10  import TabItem from '@theme/TabItem';
    11  
    12  # Install kbcli
    13  
    14  You can install kbcli on your laptop or virtual machines on the cloud.
    15  
    16  ## Environment preparation
    17  
    18  For Windows users, PowerShell version should be 5.0 or higher.
    19  
    20  ## Install kbcli
    21  
    22  kbcli now supports macOS, Windows, and Linux.
    23  
    24  <Tabs>
    25  <TabItem value="macOS" label="macOS" default>
    26  
    27  You can install kbcli with `curl` or `brew`.
    28  
    29  - Option 1: Install kbcli using the `curl` command.
    30  
    31  1. Install kbcli.
    32  
    33     ```bash
    34     curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash
    35     ```
    36  
    37     If you want to install kbcli with a specified version, follow the steps below.
    38  
    39     1. Check the available versions in [KubeBlocks Release](https://github.com/apecloud/kubeblocks/releases/).
    40     2. Specify a version with `-s` and run the command below.
    41  
    42        ```bash
    43        curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash -s x.x.x
    44        ```
    45  
    46    :::note
    47  
    48    By 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.
    49  
    50    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.
    51  
    52    :::
    53  
    54  2. Run `kbcli version` to check the version of kbcli and ensure that it is successfully installed.
    55  
    56    :::note
    57  
    58    If a timeout exception occurs during installation, please check your network settings and retry.
    59  
    60    :::
    61  
    62  - Option 2: Install kbcli using Homebrew.
    63  
    64  1. Install ApeCloud tap, the Homebrew package of ApeCloud.
    65  
    66     ```bash
    67     brew tap apecloud/tap
    68     ```
    69  
    70  2. Install kbcli.
    71  
    72     ```bash
    73     brew install kbcli
    74     ```
    75  
    76     If you want to install kbcli with a specified version, run the commands below.
    77  
    78     ```bash
    79     # View the available version
    80     brew search kbcli
    81  
    82     # Specify a version
    83     brew install kbcli@x.x.x
    84     ```
    85  
    86  3. Verify that kbcli is successfully installed.
    87  
    88     ```bash
    89     kbcli -h
    90     ```
    91  
    92  </TabItem>
    93  
    94  <TabItem value="Windows" label="Windows">
    95  
    96  There are two ways to install kbcli on Windows:
    97  
    98  - Option 1: Install using the script.
    99  
   100  :::note
   101  
   102  By default, the script will be installed at C:\Program Files\kbcli-windows-amd64 and cannot be modified.
   103  
   104  If you need to customize the installation path, use the zip file.
   105  
   106  :::
   107  
   108  1. Run PowerShell as an **administrator** and execute `Set-ExecutionPolicy Unrestricted`.
   109  2. Install kbcli.  
   110  
   111     The following script will automatically install the environment variables at C:\Program Files\kbcli-windows-amd64.
   112  
   113      ```bash
   114      powershell -Command " & ([scriptblock]::Create((iwr https://www.kubeblocks.io/installer/install_cli.ps1)))"
   115      ```
   116  
   117      To install a specified version of kbcli, use `-v` after the command and describe the version you want to install.
   118  
   119      ```bash
   120      powershell -Command " & ([scriptblock]::Create((iwr https://www.kubeblocks.io/installer/install_cli.ps1))) -v 0.5.2"
   121      ```
   122  
   123  - Option 2: Install using the installation package.
   124  
   125  1. Download the kbcli installation zip package from [KubeBlocks Release](https://github.com/apecloud/kubeblocks/releases/).
   126  2. Extract the file and add it to the environment variables.
   127      1. Click the Windows icon and select **System Settings**.
   128      2. Click **Settings** -> **Related Settings** -> **Advanced system settings**.
   129      3. Click **Environment Variables** on the **Advanced** tab.
   130      4. Click **New** to add the path of the kbcli installation package to the user and system variables.
   131      5. Click **Apply** and **OK**.
   132  
   133  </TabItem>
   134  
   135  <TabItem value="Linux" label="Linux">
   136  
   137  Install kbcli using the `curl` command.
   138  
   139  1. Install kbcli.
   140  
   141     ```bash
   142     curl -fsSL https://kubeblocks.io/installer/install_cli.sh | bash
   143     ```
   144  
   145  2. Run `kbcli version` to check the version of kbcli and ensure that it is successfully installed.
   146  
   147  :::note
   148  
   149  - If a timeout exception occurs during installation, please check your network settings and retry.
   150  
   151  :::
   152  
   153  </TabItem>
   154  </Tabs>
   155  
   156  ## (Optional) Enable auto-completion for kbcli
   157  
   158  `kbcli` supports command line auto-completion.
   159  
   160  ```bash
   161  # Configure SHELL-TYPE as one type from bash, fish, PowerShell, and zsh
   162  kbcli completion SHELL-TYPE -h
   163  ```
   164  
   165  For example, enable kbcli auto-completion for zsh.
   166  
   167  ***Steps:***
   168  
   169  1. Check the user guide.
   170  
   171      ```bash
   172      kbcli completion zsh -h
   173      ```
   174  
   175  2. Enable the completion function of your terminal first.
   176  
   177      ```bash
   178      echo "autoload -U compinit; compinit" >> ~/.zshrc
   179      ```
   180  
   181  3. Enable the `kbcli` automatic completion function.
   182  
   183      ```bash
   184      echo "source <(kbcli completion zsh); compdef _kbcli kbcli" >> ~/.zshrc
   185      ```