Quickstart
This section documents how to quickly install and configure the OCI Command Line Interface (CLI).
Installing the CLI
What's In This Section
Oracle Linux 9
If you're using Oracle Linux 9, you can use dnf
to install the CLI.
We strongly recommend running
sudo dnf update
regularly to ensure your system is up-to-date by installing available updated
RPMs.To use dnf to install the CLI:
sudo dnf -y install oraclelinux-developer-release-el9
sudo dnf install python39-oci-cli
The CLI will be installed to the Python site packages:
/usr/lib/python3.9/site-packages/oci_cli
/usr/lib/python3.9/site-packages/services
Documentation and examples will be installed in the
/usr/share/doc/python39-oci-cli-<version>/
directory.
To uninstall the CLI:
sudo dnf remove python39-oci-cli
Oracle Linux 8
If you're using Oracle Linux 8, you can use dnf to install the CLI.
We strongly recommend running
sudo dnf update
regularly to ensure your system is up-to-date by installing available updated
RPMs.To use dnf to install the CLI:
sudo dnf -y install oraclelinux-developer-release-el8
sudo dnf 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 dnf remove python36-oci-cli
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
You can use Homebrew to install, upgrade, and uninstall the CLI on Mac OS.
To install the CLI on Mac OS with Homebrew:
brew update && brew install oci-cli
To upgrade your CLI install on Mac OS using Homebrew:
brew update && brew upgrade oci-cli
To uninstall the CLI on Mac OS using Homebrew:
brew uninstall oci-cli
Windows
You can install the CLI on Windows by using the MSI installer or by using PowerShell.
The MSI CLI installer will overwrite any existing versions of the CLI on your Windows system. If you need to install multiple versions of the CLI, for subsequent installs create a virtual environment and use the manual installation method. For more information, see Manual and Offline Installations.
- Download the OCI CLI MSI installer for Windows from GitHub.
- Run the downloaded installer executable.
- Select the local directory on your system where you want to install the CLI, and then click Next.
- When the installer is finished, click Finish.
To install the CLI on Windows using PowerShell:
- Open the PowerShell console using the Run as Administrator option.
-
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
- Force PowerShell to use TLS 1.2 for Windows 2012 and Windows
2016:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- Download the installer
script:
Invoke-WebRequest https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.ps1 -OutFile install.ps1
- Run the installer script with or without prompts:
- To run the installer script with prompts, run the following command:
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.ps1'))
...and respond to the Installation Script Prompts.
-
To run the installer script without prompting the user, accepting the default settings, run the following command:
./install.ps1 -AcceptAllDefaults
- To run the installer script with prompts, run the following command:
Linux and Unix
The installer script automatically installs the CLI and its dependencies, Python and virtualenv. Before running the installer, be sure you meet the requirements.
Oracle Linux 8 and Oracle Linux Cloud Developer 7 have the CLI pre-installed.
- Open a terminal.
- 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. - Respond to the Installation Script Prompts.
Other Environments
To install the CLI in an environment not listed here, see Manual and Offline Installations.
Verifying the OCI CLI Installation
- From a command prompt, run the following
command:
oci --version
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 Configuration File
Before using the CLI, you must create a configuration 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
setup config
command:oci setup config
This command prompts you for the information required to create the configuration file and the API public and private keys. The setup dialog uses this information to generate an API key pair and creates the configuration file. After API keys are created, upload the public key using the Console.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.
Use the oci setup keys
command to generate a key pair to include in the config file.
Verifying the Configuration File
Make Sure Your Configuration File Is Complete
A proper configuration file should have at least one profile name (such as
[DEFAULT]
) and the entries specified in the File Entries section: user, fingerprint,
key_file, tenancy, region, and an optional pass_phrase.
Confirm Your User and Fingerprint Information
You can confirm your user and fingerprint information by logging onto the OCI console, opening the profile menu in the upper right, and then selecting your user name.
Once you selected your user name, you will see your OCID in the User Information panel. This OCID should be the user entry in your configuration file.
You can find your fingerprint by navigating to the API Keys section under the Resources column on the lower left.
Adding Comments to the Configuration File
[DEFAULT]
user=ocid1.user.oc1..<unique_ID>
fingerprint=<your_fingerprint>
key_file=~/.oci/oci_api_key.pem
tenancy=ocid1.tenancy.oc1..<unique_ID>
# Some comment
region=us-ashburn-1
Other Authentication Methods
The CLI also supports token-based, instance principal and resource principal authentication for some services. For more information, see SDK Authentication Methods.
Next Steps
- Getting Started with the Command Line Interface provides an end-to-end walk-through of using the CLI to launch an instance.
- Using the CLI provides detailed examples of CLI usage.