Installing the OCI CLI

To use the OCI CLI to manage Private Cloud Appliance resources, install and configure the OCI CLI.

Before You Begin

To install and use the OCI CLI, you must have:

  • A user account for the Compute Web UI.

  • An API signing key pair, required to sign API requests. If you don't already have an RSA public/private key pair in PEM format, you can create one in the OCI CLI configuration steps. To add the public key to your user account, see Adding an API Public Key to a User Profile.

  • A Private Cloud Appliance self-signed certificate.

    This requirement is satisfied during the configuration steps.

You can install the OCI CLI on macOS, Microsoft Windows, or any supported Linux/UNIX operating system:

  • Oracle Linux 7 and Oracle Linux 8

  • CentOS 7.0 and CentOS 8.x

  • Ubuntu 16.04, Ubuntu 18.04, and Ubuntu 20.04

Install the OCI CLI

You can install the OCI CLI on Oracle Linux or macOS operating systems using a package manager. To install on Microsoft Windows or some other operating system, use the install script.

Note

If you already have the OCI CLI installed and configured, you can skip to Configuring the OCI CLI to learn how to further configure the OCI CLI for Private Cloud Appliance.

To install the OCI CLI, its dependencies, and Python, follow the steps for your OS. During installation, respond to the prompts for information as described in Responding to the Install Script Prompts.

Oracle Linux 8

Run the following commands to install the OCI CLI:

$ sudo dnf -y install oraclelinux-developer-release-el8
$ sudo dnf install python36-oci-cli

To uninstall the OCI CLI, run:

$ sudo dnf remove python36-oci-cli

Oracle Linux 7

Run the following command to install the OCI CLI:

$ sudo yum install python36-oci-cli

To uninstall the OCI CLI, run:

$ sudo yum remove python36-oci-cli

macOS

You can use Homebrew to install, upgrade, and uninstall the OCI CLI on macOS.

Note

Optionally, you can install the OCI CLI using the install script. See Using the Install Script for Other Operating Systems in this section for details.

  • To install the OCI CLI, run:

    $ brew update && brew install oci-cli
  • To upgrade the OCI CLI, run:

    $ brew update && brew upgrade oci-cli
  • To uninstall the OCI CLI, run:

    $ brew uninstall oci-cli

Microsoft Windows

You can use Microsoft Windows PowerShell to install the OCI CLI.

  1. Open the PowerShell console using the Run as Administrator option.

  2. Set the http_proxy and https_proxy environment variables.

    Important

    The value of https_proxy is the hostname or IP address of your HTTP proxy server.

    $Env:http_proxy="http://www-proxy.example.com:80"
    $Env:https_proxy="http://www-proxy.example.com:80"

    If your proxy server requires a username and password, or uses a port number other than 80, include that information, as shown in the following example:

    $Env:https_proxy=http://username:password@proxy.example.com:port

    Check that your proxy variables are set correctly. Ensure you can connect to internet locations.

    $Env:http_proxy
    $Env:https_proxy
    ping https://raw.githubusercontent.com
  3. 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
  4. Force PowerShell to use TLS 1.2 for Microsoft Windows 2012 and Microsoft Windows 2016:

    $ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 
  5. Download the install script:

    $ Invoke-WebRequest ^
    https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.ps1 ^
    -OutFile install.ps1
  6. Run the install script with or without prompts.

    Run the install.ps1 script that you downloaded in the previous step.

    To avoid prompts and accept the default values, run the script with the following option:

    $ install.ps1 -AcceptAllDefaults
  7. Unset the proxy environment variables.

    $Env:http_proxy=""
    $Env:https_proxy=""

Using the Install Script for Other Operating Systems

For any other OS, run the following install script to install the OCI CLI, its dependencies, and Python.

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

To avoid prompts and accept the default values, add the --accept-all-defaults option.

Responding to the Install Script Prompts

  • If you don't have a compatible version of Python installed in Linux or Microsoft Windows, you are prompted to provide a location for installing the binaries and executables. The script installs Python for you.

  • If you don't have a compatible version of Python installed in macOS, you're notified that your version of Python is incompatible. You must upgrade before you can proceed with the installation. The script doesn't install Python for you.

  • When prompted to upgrade the OCI 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 oci command without providing the full path to the executable.