Quickstart

Using the installer script and the setup command is the fastest way to get up and running with the CLI.

Caution

Oracle recommends that you avoid using string values that include confidential information.

Installing the CLI

The installer script automatically installs the CLI and its dependencies, Python and virtualenv. Before running the installer, be sure you meet the Requirements.

Note

Oracle Autonomous Linux 7 and Cloud Shell have the CLI pre-installed.

Linux and Unix (Including Oracle Linux 8)

  1. Open a terminal.
  2. To run the installer script, run the following command.

    bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
    Note

    To run a 'silent' install that accepts all default values with no prompts, use the --accept-all-defaults parameter.
  3. Respond to the Installation Script Prompts.

Oracle Linux 7

If you're using Oracle Linux 7, you can use yum to install the CLI.

To use yum to install the CLI:

sudo yum install python36-oci-cli

The CLI will be installed to the Python site packages:

  • /usr/lib/python3.6/site-packages/oci_cli
  • /usr/lib/python3.6/site-packages/services

Documentation and examples will be installed in the /usr/share/doc/python36-oci-cli-<version>/ directory.

To uninstall the CLI:

sudo yum remove python36-oci-cli

Mac OS X

You can use Homebrew to install, upgrade, and uninstall the CLI on Mac OS.

To install the CLI on Mac OS X with Homebrew:

brew update && brew install oci-cli

To upgrade your CLI install on Mac OS X using Homebrew:

brew update && brew upgrade oci-cli

To uninstall the CLI on Mac OS X using Homebrew:

brew uninstall oci-cli

Windows

  1. Open the PowerShell console using the Run as Administrator option.
  2. The installer enables auto-complete by installing and running a script. To allow this script to run, you must enable the RemoteSigned execution policy.

    To configure the remote execution policy for PowerShell, run the following command.

    Set-ExecutionPolicy RemoteSigned
  3. Download the installer script:
    Invoke-WebRequest https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.ps1 -OutFile install.ps1
  4. Run the installer script with or without prompts:
    1. To run the installer script with prompts, run the following command:
      iex ((New-ObjectSystem.Net.WebClient).DownloadString('https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.ps1'))

      ...and respond to the Installation Script Prompts.

    2. To run the installer script without prompting the user, accepting the default settings, run the following command:
      install.ps1 -AcceptAllDefaults  

Installation Script Prompts

The installation script prompts you for the following information.

  • If you do not have a compatible version of Python installed:
    • Windows and Linux: You are prompted to provide a location for installing the binaries and executables. The script will install Python for you.
    • MacOS: You are notified that your version of Python is incompatible. You must upgrade before you can proceed with the installation. The script will not install Python for you.
  • When prompted to upgrade the CLI to the newest version, respond with Y to overwrite an existing installation.
  • When prompted to update your PATH, respond with Y to be able to invoke the CLI without providing the full path to the executable. This will add oci.exe to your PATH.

Setting up the Config File

Before using the CLI, you must create a config file that contains the required credentials for working with Oracle Cloud Infrastructure. You can create this file using a setup dialog or manually using a text editor.

Use the Setup Dialog

To have the CLI walk you through the first-time setup process, use the oci setup config command. The command prompts you for the information required for the config file and the API public/private keys. The setup dialog generates an API key pair and creates the config file.

For more information about how to find the required information, see:

Manual Setup

If you want to set up the API public/private keys yourself and write your own config file, see SDK and Tool Configuration.

Tip

Use the oci setup keys command to generate a key pair to include in the config file.