Thursday, July 9, 2026

How to install OCI CLI and instant client tool in Linux VM

 

Problem statement: In an Oracle Autonomous Data Warehouse environment, we do not have access to the underlying compute nodes. However, many organizations run custom shell-script jobs that must access OCI resources through the OCI CLI and make database calls. Even though cloud shell is pre-configured with instant client and OCI CLI tool but it is dedicated for oci user and we can not access from outside oci environment.To support these requirements, we need a Linux VM with Oracle Instant Client and the OCI CLI installed.

This article will guide you step by step  how to install above mentioned tools.

Environment Setup: I have installed Oracle Linux Server release 8.10 using image Oracle-Linux-8.10-2026.06.15-0 available in OCI console. During installation I have chosen to use public IP so that I can connect from my laptop. In real world we may choose to use private IP only for security reasons. Please see the link below how to connect a Linux instance

Connecting to a Linux Instance

I just want to make you aware that old version of putty might throw below error which says there is a mismatch between server and client with respect to  authentication methods.To resolve this error use putty version 0.84 and higher.



1.       Check whether Oracle Instant Client packages are available in the currently enabled RPM repositories

dnf search instantclient

Last metadata expiration check: 23:51:11 ago on Sat 27 Jun 2026 03:28:18 PM GMT.

================================================================================ Name Matched: instantclient ================================================================================

oracle-instantclient-release-23ai-el8.src : Oracle Software yum repository configuration

oracle-instantclient-release-23ai-el8.x86_64 : Oracle Software yum repository configuration

oracle-instantclient-release-26ai-el8.x86_64 : Oracle Software yum repository configuration

oracle-instantclient-release-el8.src : Oracle Instant Client yum repository configuration

oracle-instantclient-release-el8.x86_64 : Oracle Instant Client yum repository configuration

2.       Choose your choice of instant client and install

dnf info oracle-instantclient-release-26ai-el8.x86_64

Last metadata expiration check: 23:52:31 ago on Sat 27 Jun 2026 03:28:18 PM GMT.

Available Packages

Name         : oracle-instantclient-release-26ai-el8

Version      : 1.0

Release      : 6.el8

Architecture : x86_64

Size         : 14 k

Source       : oracle-common-release-1.0-6.el8.src.rpm

Repository   : ol8_baseos_latest

Summary      : Oracle Software yum repository configuration

License      : GPLv2

Description  : This package contains the  Oracle Software yum repository configuration.

dnf install oracle-instantclient-release-26ai-el8

Last metadata expiration check: 23:53:16 ago on Sat 27 Jun 2026 03:28:18 PM GMT.

Dependencies resolved.

=============================================================================================================================================================================================

 Package                                                          Architecture                      Version                               Repository                                    Size

=============================================================================================================================================================================================

Installing:

 oracle-instantclient-release-26ai-el8                            x86_64                            1.0-6.el8                             ol8_baseos_latest                             14 k

 

Transaction Summary

=============================================================================================================================================================================================

Install  1 Package

 

Total download size: 14 k

Installed size: 18 k

Is this ok [y/N]: y

Downloading Packages:

oracle-instantclient-release-26ai-el8-1.0-6.el8.x86_64.rpm                                                                                                   124 kB/s |  14 kB     00:00

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                                        121 kB/s |  14 kB     00:00

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                                     1/1

  Installing       : oracle-instantclient-release-26ai-el8-1.0-6.el8.x86_64                                                                                                              1/1

  Verifying        : oracle-instantclient-release-26ai-el8-1.0-6.el8.x86_64                                                                                                              1/1

 

Installed:

  oracle-instantclient-release-26ai-el8-1.0-6.el8.x86_64

 

Complete!

3.       Find SQL*Plus package and install

dnf search instantclient

Oracle Instant Client 26 for Oracle Linux 8 - License Included (x86_64)                                                                                      384 kB/s |  24 kB     00:00

================================================================================ Name Matched: instantclient ================================================================================

oracle-instantclient-basic.x86_64 : Oracle Instant Client Basic package

oracle-instantclient-basiclite.x86_64 : Oracle Instant Client Light package

oracle-instantclient-devel.x86_64 : Development header files for Oracle Instant Client.

oracle-instantclient-jdbc.x86_64 : Supplemental JDBC features for the Oracle Instant Client

oracle-instantclient-odbc.x86_64 : Oracle Instant Client ODBC

oracle-instantclient-release-23ai-el8.src : Oracle Software yum repository configuration

oracle-instantclient-release-23ai-el8.x86_64 : Oracle Software yum repository configuration

oracle-instantclient-release-26ai-el8.x86_64 : Oracle Software yum repository configuration

oracle-instantclient-release-el8.src : Oracle Instant Client yum repository configuration

oracle-instantclient-release-el8.x86_64 : Oracle Instant Client yum repository configuration

oracle-instantclient-sqlplus.x86_64 : Oracle Instant Client SQL*Plus package

oracle-instantclient-tools.x86_64 : Tools for Oracle Instant Client

 

dnf install -y oracle-instantclient-sqlplus.x86_64

Last metadata expiration check: 0:01:49 ago on Sun 28 Jun 2026 03:23:46 PM GMT.

Dependencies resolved.

=============================================================================================================================================================================================

 Package                                               Architecture                    Version                                     Repository                                           Size

=============================================================================================================================================================================================

Installing:

 oracle-instantclient-sqlplus                          x86_64                          23.26.2.0.0-2.el8                           ol8_oracle_instantclient26                          4.7 M

Installing dependencies:

 oracle-instantclient-basic                            x86_64                          23.26.2.0.0-2.el8                           ol8_oracle_instantclient26                           84 M

 

Transaction Summary

=============================================================================================================================================================================================

Install  2 Packages

 

Total download size: 89 M

Installed size: 362 M

Downloading Packages:

(1/2): oracle-instantclient-sqlplus-23.26.2.0.0-2.el8.x86_64.rpm                                                                                              17 MB/s | 4.7 MB     00:00

(2/2): oracle-instantclient-basic-23.26.2.0.0-2.el8.x86_64.rpm                                                                                                56 MB/s |  84 MB     00:01

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                                                         59 MB/s |  89 MB     00:01

Running transaction check

Transaction check succeeded.

Running transaction test

Transaction test succeeded.

Running transaction

  Preparing        :                                                                                                                                                                     1/1

  Installing       : oracle-instantclient-basic-23.26.2.0.0-2.el8.x86_64                                                                                                                 1/2

  Running scriptlet: oracle-instantclient-basic-23.26.2.0.0-2.el8.x86_64                                                                                                                 1/2

  Installing       : oracle-instantclient-sqlplus-23.26.2.0.0-2.el8.x86_64                                                                                                               2/2

  Running scriptlet: oracle-instantclient-sqlplus-23.26.2.0.0-2.el8.x86_64                                                                                                               2/2

  Verifying        : oracle-instantclient-basic-23.26.2.0.0-2.el8.x86_64                                                                                                                 1/2

  Verifying        : oracle-instantclient-sqlplus-23.26.2.0.0-2.el8.x86_64                                                                                                               2/2

 

Installed:

  oracle-instantclient-basic-23.26.2.0.0-2.el8.x86_64                                          oracle-instantclient-sqlplus-23.26.2.0.0-2.el8.x86_64

 

Complete!

4.       Create oracle user and necessary groups(oinstall,dba)

groupadd oinstall

groupadd dba

useradd -m -g oinstall -G dba oracle

passwd oracle—to set password

5.       Check whether sqlplus is accessible from oracle user

su – oracle

which sqlplus

/usr/bin/sqlplus

6.       Install packages required for OCI cli

dnf install python36-oci-cli

Following packages were installed part of this installation

INFO =============================================================================================================================================================================================

 Package                                                Architecture                       Version                                        Repository                                    Size

=============================================================================================================================================================================================

Installing:

 python36-oci-cli                                      noarch                             3.83.0-1.0.1.el8                               ol8_oci_included                             6.2 M

Installing dependencies:

 python3-arrow                                         noarch                             1.1.1-1.el8                                    ol8_oci_included                             119 k

 python3-importlib-metadata                            noarch                             1.7.0-1.el8                                    ol8_addons                                    47 k

 python3-jmespath                                      noarch                             0.10.0-1.el8                                   ol8_oci_included                              48 k

 python3-prompt-toolkit                                noarch                             3.0.29-1.0.2.el8                               ol8_oci_included                             669 k

 python3-terminaltables                                noarch                             3.1.10-1.0.1.el8                               ol8_oci_included                              29 k

 python3-typing-extensions                             noarch                             3.7.4.2-1.el8                                  ol8_oci_included                              47 k

 python3-wcwidth                                       noarch                             0.2.5-3.el8                                    ol8_oci_included                              48 k

 python3-zipp                                          noarch                             0.5.1-3.el8                                    ol8_addons                                    15 k

 

Transaction Summary

=============================================================================================================================================================================================

Install  9 Packages

 

Check the version

oci -version

3.83.0

 

7.       Configure OCI CLI tool

Use below command and follow the instructions

oci setup config

    This command provides a walkthrough of creating a valid CLI config file.

 

    The following links explain where to find the information required by this

    script:

 

    User API Signing Key, OCID and Tenancy OCID:

 

        https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#Other

 

    Region:

 

        https://docs.cloud.oracle.com/Content/General/Concepts/regions.htm

 

    General config documentation:

 

        https://docs.cloud.oracle.com/Content/API/Concepts/sdkconfig.htm

 

 

Enter a location for your config [/root/.oci/config]:

Config file: /root/.oci/config already exists. Do you want add a profile here? (If no, you will be prompted to overwrite the file) [Y/n]: n

File: /root/.oci/config already exists. Do you want to overwrite (Removes existing profiles!!!)? [y/N]: y

Enter a user OCID: ocid1.user.oc1.XXXXXXXXXXXXXXXXXX

Enter a tenancy OCID: ocid1.tenancy.oc1..XXXXXXXXXXXX

Enter a region by index or name(e.g.

1: af-casablanca-1, 2: af-johannesburg-1, 3: ap-batam-1, 4: ap-chiyoda-1, 5: ap-chuncheon-1,

6: ap-chuncheon-2, 7: ap-dcc-canberra-1, 8: ap-dcc-gazipur-1, 9: ap-delhi-1, 10: ap-hyderabad-1,

11: ap-ibaraki-1, 12: ap-kulai-2, 13: ap-melbourne-1, 14: ap-mumbai-1, 15: ap-osaka-1,

16: ap-seoul-1, 17: ap-seoul-2, 18: ap-singapore-1, 19: ap-singapore-2, 20: ap-suwon-1,

21: ap-sydney-1, 22: ap-tokyo-1, 23: ca-montreal-1, 24: ca-toronto-1, 25: eu-amsterdam-1,

26: eu-budapest-1, 27: eu-crissier-1, 28: eu-dcc-dublin-1, 29: eu-dcc-dublin-2, 30: eu-dcc-milan-1,

31: eu-dcc-milan-2, 32: eu-dcc-rating-1, 33: eu-dcc-rating-2, 34: eu-dcc-zurich-1, 35: eu-frankfurt-1,

36: eu-frankfurt-2, 37: eu-jovanovac-1, 38: eu-madrid-1, 39: eu-madrid-2, 40: eu-madrid-3,

41: eu-marseille-1, 42: eu-milan-1, 43: eu-paris-1, 44: eu-stockholm-1, 45: eu-turin-1,

46: eu-zurich-1, 47: il-jerusalem-1, 48: me-abudhabi-1, 49: me-abudhabi-2, 50: me-abudhabi-3,

51: me-abudhabi-4, 52: me-alain-1, 53: me-dcc-doha-1, 54: me-dcc-muscat-1, 55: me-dubai-1,

56: me-ibri-1, 57: me-jeddah-1, 58: me-riyadh-1, 59: mx-monterrey-1, 60: mx-queretaro-1,

61: sa-bogota-1, 62: sa-riodejaneiro-1, 63: sa-santiago-1, 64: sa-saopaulo-1, 65: sa-valparaiso-1,

66: sa-vinhedo-1, 67: uk-cardiff-1, 68: uk-gov-cardiff-1, 69: uk-gov-london-1, 70: uk-london-1,

71: us-ashburn-1, 72: us-ashburn-2, 73: us-chicago-1, 74: us-gov-ashburn-1, 75: us-gov-chicago-1,

76: us-gov-phoenix-1, 77: us-langley-1, 78: us-luke-1, 79: us-newark-1, 80: us-phoenix-1,

81: us-saltlake-2, 82: us-sanjose-1, 83: us-somerset-1, 84: us-thames-1): 80

Do you want to generate a new API Signing RSA key pair? (If you decline you will be asked to supply the path to an existing key.) [Y/n]: y

Enter a directory for your keys to be created [/root/.oci]:

Enter a name for your key [oci_api_key]:

File /root/.oci/oci_api_key_public.pem already exists, do you want to overwrite? [y/N]: y

Public key written to: /root/.oci/oci_api_key_public.pem

Enter a passphrase for your private key ("N/A" for no passphrase):

Repeat for confirmation:

File /root/.oci/oci_api_key.pem already exists, do you want to overwrite? [y/N]: y

Private key written to: /root/.oci/oci_api_key.pem

Fingerprint: XXXXXXXXXXXXXXXXXXXXXXX

Config written to /root/.oci/config

 If you haven't already uploaded your API Signing public key through the

    console, follow the instructions on the page linked below in the section

    'How to upload the public key':

 

        https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#How2

Validate all the enties of config file /root/.oci/config

8.       Upload API signing key in the console

From OCI console click on profile icon visible on top right corner and from there select Tokens and Keys tab


Click on the button Add API Key and paste contents of /root/.oci/oci_api_key_public.pem



In the next  window it will generate configuration file preview.Make sure it matches with your config file stored in the server

9. Testing the OCI CLI configuration from root user

     Use below command to test the configuration

      oci iam user list

{

  "data": [

    {

      "capabilities": {

        "can-use-api-keys": true,

        "can-use-auth-tokens": true,

        "can-use-console-password": true,

        "can-use-customer-secret-keys": true,

        "can-use-db-credentials": true,

        "can-use-o-auth2-client-credentials": true,

        "can-use-smtp-credentials": true

      },

      "compartment-id": "ocid1.tenancy.oc1..XXXXXXXXXXXXXXXXXXXXXXXXX",

      "db-user-name": null,

      "defined-tags": {},

      "description": null,

      "email": "debdhritiman@*****.com",

      "email-verified": true,

      "external-identifier": "7f322816bfc24b2094ac507bef60e069",

      "freeform-tags": {},

      "id": "ocid1.user.oc1..XXXXXXXXXXXXXXXXXXXXXXXXXX",

      "identity-provider-id": null,

      "inactive-status": null,

      "is-mfa-activated": true,

      "last-successful-login-time": "2026-07-09T15:27:01.421000+00:00",

      "lifecycle-state": "ACTIVE",

      "name": "debdhritiman@yahoo.com",

      "previous-successful-login-time": null,

      "time-created": "2026-06-09T16:15:23.478000+00:00"

    }

  ]

}

10. Download credential using oci command 

Set below variable after login into linux vm

 ADB_OCID=ocid1.autonomousdatabase.oc1.phx.XXXXXXXXXXXXXXX

 FILE_NAME=wallet.zip

 WALLET_PW=XXXXXX

oci db autonomous-database generate-wallet --autonomous-database-id $ADB_OCID --file $FILE_NAME --password $WALLET_PW

unzip this wallet.zip file which will have wallet keys and tnsnames.ora file.

Update sqlnet.ora to point wallet location appropriate to your wallet location.

WALLET_LOCATION = (SOURCE = (METHOD = file) (METHOD_DATA = (DIRECTORY="/home/oracle")))

SSL_SERVER_DN_MATCH=yes

and connect like below

export TNS_ADMIN=/home/oracle

 sqlplus admin/XXXX@cdborcl_high

Hope you have learned something useful









No comments:

Post a Comment

How to install OCI CLI and instant client tool in Linux VM

  Problem statement: In an Oracle Autonomous Data Warehouse environment, we do not have access to the underlying compute nodes. However, ma...