Installing and Configuring the CLI

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

Scripted installation

Run this script to install the Confluent CLI. This command creates a bin directory in your designated location (<path-to-directory>/bin). The location must be in your PATH (e.g. /usr/local/bin).

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

Tarball installation

Download and install the raw binaries by platform.

Java version requirements

The Confluent CLI requires Java to run, 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=<path-to-confluent>/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.