Installation of OCI CLI on WSL [Windows Subsystem for Linux] in Windows 10 or above by@hackydansoumik

Installation of OCI CLI on WSL [Windows Subsystem for Linux] in Windows 10 or above

Dan Soumik HackerNoon profile picture

Dan Soumik

Passionate about enterprise software. Love watching F1, coding projects on raspberry pie

Step by Step guide for the installation and configuration of Oracle Cloud Infrastructure (known as OCI) CLI (Command Line Interface) in Windows WSL2

What is OCI CLI?

Oracle Cloud Infrastructure is a next-generation enterprise-class
Cloud Provider. Oracle Cloud provides both new infrastructure and a full set of platform capabilities. Oracle Cloud is expanding its presence in more than 36 regional locations across the globe.

OCI and its resources can be accessed through multiple
methods like Cloud Console or Command Line Interface (CLI). OCI CLI provides the same functionalities as Cloud console with additional parameters and it also helps to execute scripts. CLI is built on OCI SDK for Python and runs on Mac, Windows or Linux.

What is WSL?

As per Microsoft's documentation,Β  " The Windows Subsystem for Linux lets developers run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup."

Installation of WSL


  • Windows 10 version 2004 and above [build 19041 and higher ]
  • Windows 11

Checking Windows version

Type Windows Logo Key + R and type Winver and select OK


Run Powershell as Administrator


At the Window Powershell prompt type:

wsl --install

And wait for the process to complete. For WSL to be properly activated, you will now need to restart your computer.


Now check available Linux distros:

wsl --list --online

Now you need to select the distros and execute this command

wsl --install -d <distros_name>

Once installation of Linux Distros is done, it will prompt for User. You
will need to create a user account and password for your newly installed Linux distribution.


Commonly Used WSL Commands

Listing of installed Linux distributions and check the version of WSL.

wsl -l -v

List of available Linux distributions available.

wsl -l -o

Name of the distribution you would like to install.

wsl --install -d <distros_name>

Installation of Python in WSL (Ubuntu)

Update Package index inside WSL:

$ sudo apt update
$ sudo apt -y 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

Extract the .tgz file

$tar -xf Python-3.8.3.tgz

You need to perform tests and optimizations before installing Python. It
increases the performance of the execution of codes by 10-20 percent:

$ cd Python-3.8.3
$ ./configure --enable-optimizations

Creating Virtual Environment for Python workspace

Creating a new folder for workspace (as Virtual Environment)

$ mkdir -p ~/OCI/python  && cd ~/OCI/python

Create the virtual environment by running one of the following commands, depending on the version of Python installed:

$ python3.8 -m venv oracle-cli

After venv in place, it need to be activited. It is a crucial step.

$ source oracle-cli/bin/activate

Download and Installation of OCI - CLI

Now download the OCI-CLI from OCI CLI release github

Download the Vanila release not the distribution specific one e.g.

$ curl -L "" -o /tmp/

Installing OCI using pip Python Package manager

bash -c "$(curl -L"

It will prompt for the following options

===> Enter a path to an rc file to update (file will be created if it does not exist) (leave blank to use '/home/skdan/.bashrc'):
-- Backed up '/home/skdan/.bashrc' to '/home/skdan/.bashrc.backup'
-- Tab completion set up complete.
-- If tab completion is not activated, verify that '/home/skdan/.bashrc' is sourced by your shell.
-- ** Run `exec -l $SHELL` to restart your shell. **
-- Installation successful.
-- Run the CLI with /home/skdan/bin/oci –help

Post Installation, execute this command to verify the version

$/home/skdan/bin/oci -v

Reference Sites

Install WSL

Best practices for setting up a WSL development environment


Signup or Login to Join the Discussion


Related Stories