Manual Installation

Instead of using the installer script as described in the Quickstart, you can manually install the CLI and its dependencies. Before proceeding, be sure you meet the Requirements.

Caution

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

Step 1: Installing Python

Python installation instructions vary for each operating system that the CLI supports.

Note

The CLI supports only the Python versions listed in the CLI Requirements.
Windows
Oracle Linux

Some versions of Oracle Linux come with incompatible versions of Python, and might require additional components to install the CLI. Before installing the CLI, run the following commands on a new Oracle Linux image.

Tip

Oracle Autonomous Linux 7 comes with the CLI pre-installed.

Oracle Linux 7 and Oracle Linux 8

sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install gcc wget openssl-devel bzip2-devel libffi-devel
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
tar xvf Python-3.8.3.tgz
cd Python-3.8*/
./configure --enable-optimizations
sudo make altinstall

Oracle Linux 6

sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install gcc wget openssl-devel bzip2-devel libffi-devel
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
tar xvf Python-3.6.3.tgz
cd Python-3.6*/
./configure --enable-optimizations
sudo make altinstall
CentOS

Before you install the CLI, run the following commands on a new CentOS image.

CentOS 7

sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install gcc wget openssl-devel bzip2-devel libffi-devel
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
tar xvf Python-3.8.3.tgz
cd Python-3.8*/
./configure --enable-optimizations
sudo make altinstall

CentOS 6

sudo yum -y update
sudo yum -y groupinstall "Development Tools"
sudo yum -y install gcc wget openssl-devel bzip2-devel libffi-devel
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
tar xvf Python-3.6.3.tgz
cd Python-3.6*/
./configure --enable-optimizations
sudo make altinstall
Ubuntu

Before you install the CLI, run the following commands on a new Ubuntu image.

Ubuntu 16, Ubuntu 18, and Ubuntu 20

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz
tar -xf Python-3.8.3.tgz
cd Python-3.8.3
./configure --enable-optimizations
sudo make altinstall
Mac OS X

Step 2: Creating and Configuring a Virtual Environment

The venv Python module is a virtual environment builder that lets you create isolated Python environments. We recommend installing the CLI in a virtual environment.

Installing and Activating your Virtual Environment

After Python is installed, set up a virtual environment for your operating system using the following steps.

Windows
  1. Navigate to the directory in which you would like to create the virtual environment.
  2. Create the virtual environment by running the following command:
    python -m venv oracle-cli
  3. Activate the virtual environment by running the following command:
    oracle-cli/Scripts/activate
Linux and Mac
  1. Navigate to the directory in which you would like to create the virtual environment.
  2. Create the virtual environment by running one of the following commands, depending on the version of Python installed:
    python3.8 -m venv oracle-cli
    python3.6 -m venv oracle-cli
  3. Activate the virtual environment by running the following command:
    source oracle-cli/bin/activate

Step 3: Installing the Command Line Interface

You can download the CLI from GitHub or install the package from Python Package Index (PyPI).

To install using the GitHub download:

  • Download and unzip oci-cli.zip.
  • Run the following command.

    pip install oci_cli-*-py2.py3-none-any.whl

To install using PyPI, run the following command:

pip install oci-cli

For information on how to start a CLI session, see Starting a CLI Session.

Installing Without a Virtual Environment

We do not recommend installing the CLI in your system-wide Python and suggest that instead you install the CLI using the installer or virtual environment.

In cases where you are trying to install the CLI in your system-wide Python using the latest pip version, you might encounter conflicts with some distutils installed packages. Following is an example error message when this occurs:

sudo pip install oci-cli
...
...
Cannot uninstall 'requests'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

Another option is to install the CLI for the user using the following command, although this approach is not supported:

pip install --user oci-cli