Manual and Offline Installations

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.

Prior to manually installing the CLI:

  • Make sure your python path is set correctly
  • Run "python --version" or "python3 --version" and make sure you have the required version
  • If installing on Oracle Linux or CentOS, have the following installed:
    • gcc
    • zlib-devel
    • python3-devel
    • the latest version of OpenSSL 1.1.1

You can also download the CLI installation files and perform an offline installation.

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

Install a supported version of Python from the Python Windows downloads page. During installation, choose to add Python to the PATH and/or environment variables (depending on the prompt).

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 and Oracle Linux Cloud Developer 8 come 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, CentOS 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
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

Mac OS X comes with Python pre-installed.

To install the latest version of Python on Mac OS X, see the official Python documentation.

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 Using the CLI.

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

Offline Installation

If you have Python 3 installed, you can perform an offline installation of the OCI CLI.

To perform an offline installation:
  1. Go to the OCI CLI release page on GitHub and select the version of the CLI that you want to install.
  2. Scroll down to the Assets section of the release page and click on the zip file to download it.
  3. Copy the zip file to the target system.
  4. Unzip the zip file.
  5. Run the appropriate installer for the platform:
    1. On Unix and Linux, run bash install.sh --offline-install
    2. On Windows, run install.ps1 -OfflineInstall
  6. Follow the installation prompts.

For troubleshooting offline installs, see Common Issues or create an issue on GitHub.