Install and Configure the JFrog CLI

JFrog CLI is a client that provides a simple CLI interface that automates the management of JFrog products. JFrog CLI works with JFrog Artifactory, JFrog Mission Control, JFrog Bintray and JFrog Xray (through their respective REST APIs) making your scripts more efficient and reliable. You can use the JFrog CLI to assist in your builds, create artifacts, promote artifacts, trigger security scans and much more. It is powerful to that you can use in your CI/CD process and general automation. You can learn more here.

  1. In your Cloud9 terminal, run the following shell commands to install the JFrog CLI.
echo "[jfrog-cli]" > jfrog-cli.repo;
echo "name=jfrog-cli" >> jfrog-cli.repo;
echo "baseurl=https://releases.jfrog.io/artifactory/jfrog-rpms" >> jfrog-cli.repo;
echo "enabled=1" >> jfrog-cli.repo; echo "gpgcheck=0" >> jfrog-cli.repo;
sudo mv jfrog-cli.repo /etc/yum.repos.d/;
sudo yum install -y jfrog-cli;
  1. Execute the following to test the JFrog CLI and check the version.

jfrog --version

  1. Set the following environment variables. Substitute your JFrog Platform credentials (username and API key).

export jfrog_user=<username/email>

export jfrog_apikey=<api key>

  1. Next, we will configure the JFrog CLI to use our JFrog Platform credentials (username and API key). Execute the following command.

jfrog rt config --user $jfrog_user --apikey $jfrog_apikey

  1. When prompted, enter a unique Artifactory server ID such as your JFrog Platform server name. Remember this ID.
  2. Enter the URL for the JFrog Artifactory server which has the artifactory path.
  3. Then accept the remaining default values. If you make a mistake, you can rerun the command again.

JFrog CLI Config

  1. And let’s set an environment variable for our Artifactory server ID.

export jfrog_server_id=<server ID>

  1. Execute the following to list your Artifactory servers that are configured in the JFrog CLI.

jfrog rt config show

  1. Execute the following command to check connectivity to the server. You should get an OK response.

jfrog rt ping