Installing and Configuring the CLI

The Confluent CLI is supported for macOS, Microsoft Windows, and Linux operating systems. You can install the Confluent CLI by downloading the executable or tarball.

Scripted installation

Install the Confluent CLI, confluent, using the following script. The <path-to-cli> parameter must be in your PATH (e.g. /usr/local/bin).

On Microsoft Windows, an appropriate Linux environment may need to be installed in order to have the curl and sh commands available, such as the Windows Subsystem for Linux.

curl -L --http1.1 https://cnfl.io/cli | sh -s -- -b /<path-to-cli>

Tarball installation

Download and install the most recently released raw binaries by platform:

Download previous versions

Previous versions of Confluent CLI are available for scripted download. For reference, see the Confluent CLI to Confluent Platform compatibility table.

List all available Confluent CLI versions:

curl -sL https://cnfl.io/cli | sh -s -- -l

You should expect to see a long list of version numbers as the output to this script. Download a specific version:

curl -sL https://cnfl.io/cli | sh -s -- <version>

For example:

curl -sL https://cnfl.io/cli | sh -s -- v0.265.0

Install previous version in Confluent Platform tar and zip packages

Confluent Platform tar and zip packages inlcude Confluent CLI binaries for each of the operating system and architecture types that Confluent CLI supports. The version of Confluent CLI used by Confluent Platform can be changed by downloading a specific Confluent CLI binary and using it to replace the current binary.

First, download the appropriate version of Confluent CLI. For example, Confluent CLI 0.265.0 is compatible with Confluent Platform 5.5.x, which can be downloaded with the following script:

curl -sL https://cnfl.io/cli | sh -s -- v0.265.0

This script detects which system is running and downloads the appropriate binary. Note the location of the downloaded binary and the OS and architecture in use. For example, on macOS, the previous script results in the following terminal output: confluentinc/cli info found version: v0.265.0 for v0.265.0/darwin/amd64 indicating the machine’s appropriate binary is for the darwin operating system type and amd64 architecture type.

Next, use the downloaded binary to replace the existing Confluent CLI binary in Confluent Platform. These binaries are located in subdirectories of $CONFLUENT_HOME/libexec/cli/. In this example, the appropriate subdirectory is $CONFLUENT_HOME/libexec/cli/darwin_amd64/, which corresponds to the operating system type and architecture type noted above. Replace the binary in this subdirectory with the recently downloaded binary. Once this is in place, confirm it is working with the following command:

confluent version

Java version requirements

On non-Windows platforms, the Confluent CLI offers confluent local commands (designed to operate on a local install of Confluent Platform) which require Java, and JDK version 1.8 or 1.11 is recommended. If you have multiple versions of Java installed, set JAVA_HOME to the version you want Confluent Platform to use.

Important

Setting JAVA_HOME when you have multiple JDKs prevents the Confluent CLI from defaulting to the newest installed Java version, which may not be supported. If the default Java version is not supported, the CLI will fail with a message about unsupported Java versions even if a supported version is installed and set as the in-use JDK (shown as output to java -version).

  • To set JAVA_HOME, add the location of a supported JDK to your PATH in a file such as .bash_profile or by setting it temporarily as an environment variable in your current shell:

    export JAVA_HOME=<path-to-JDK-home>
    

    For example:

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/
    
  • To find the location of your installed Java versions, type the following in a command shell:

    /usr/libexec/java_home -V
    

    The output will look similar to this example, which happens to show two JDKs, 12.0.1 and 1.8.0_212:

    /usr/libexec/java_home -V
    Matching Java Virtual Machines (2):
        12.0.1, x86_64: "OpenJDK 12.0.1"        /Library/Java/JavaVirtualMachines/openjdk-12.0.1.jdk/Contents/Home
        1.8.0_212, x86_64:      "AdoptOpenJDK 8"        /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
    

    In this case, you would add JDK 1.8 to your .bash_profile:

    #JAVA_HOME
    export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/
    

    The Confluent CLI will then run with the specified, supported JDK 1.8, regardless of how many Java versions you have installed.

    See also, Java supported versions for Confluent Platform.

Next steps

  • Type confluent in your terminal to get started.

    confluent
    

    You should see Confluent CLI usage information:

    Manage your Confluent Platform.
    
    Usage:
      confluent [command]
    
    Available Commands:
      completion  Print shell completion code.
      help        Help about any command
      iam         Manage RBAC and IAM permissions.
      local       Manage a local Confluent Platform development environment.
      login       Log in to Confluent Platform. This is required for RBAC.
      logout      Log out of Confluent Platform.
      secret      Manage secrets for Confluent Platform.
      update      Update the confluent CLI.
      version     Print the confluent CLI version.
    
    Flags:
      -h, --help            help for confluent
      -v, --verbose count   Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace).
          --version         version for confluent
    
    Use "confluent [command] --help" for more information about a command.
    
  • Set your PATH variable:

    export PATH=<$CONFLUENT_HOME>/bin:${PATH};
    
  • If RBAC is enabled, you must log in to the Confluent CLI with the Metadata service URL specified (<url>). For more information, see confluent login.

    confluent login --url <url>
    
    Enter your Confluent credentials:
    Email:
    Password:
    

    Your output should resemble:

    Logged in as user
    
  • Try out the Confluent CLI using a local development environment.