How to Install OCI CLI
To work with OCI you need to install oci-cli. Let us discuss
below the ways to do it:
To
install and use the CLI, you must have:
·
An Oracle Cloud Infrastructure account.
·
A user created in that account, in a group with a policy that
grants the desired permissions.
·
A keypair used for signing API requests, with the public key
uploaded to Oracle. Only the user calling the API should possess the private
key.
·
A supported version of Python on a supported operating system.
Supported Python Versions and Operating Systems
The
CLI supports Python versions 3.6 and later running on MacOS, Windows, or
supported Linux and UNIX-like operating systems:
·
Oracle Linux 6.10, Oracle Linux 7.7 and 7.8, and Oracle Linux
8.0
·
Oracle Autonomous Linux 7.8
·
CentOS 7.0 and CentOS 8.x
·
Ubuntu 16.04, Ubuntu 18.04, and Ubuntu 20.04
Linux and Unix (Including Oracle Linux 8)
1.
Open a terminal.
2. To run the installer
script, run the following command.
The installer script automatically installs the
CLI and its dependencies, Python and virtualenv.
bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh
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 -y
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:
a. 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.
b. To
run the installer script without prompting
the user, accepting the default settings, run the following command:
install.ps1 -AcceptAllDefaults
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.
Go to “API Keys” and Click
Add API Key.
Then Add your Public Key to generate these Information.
No comments