Installing OCI Command Line Utilities in Linux and Windows

Posted in: Cloud, DevOps, Oracle

As part of a recent project, I installed the Oracle Cloud command line utilities (oci) on the following Linux systems:

  • Ubuntu Server 20.04 LTS
  • Oracle Linux 7.5

Installing on Ubuntu

Because the plan was to install oci on a few systems, I wanted the ability to simply copy-and-paste a command line, or ssh with the command and let it run.

Note: Oracle recommends not directly installing the oci tools, but rather using virtualenv (as described here).

In the case of these test servers, I do want to globally install the oci utilities, and therefore won’t be using virtualenv.

It’s worth noting that the recommendation to use virtualenv seems to be a recent development. My colleague Nelson Calero reviewed the documentation in the Wayback Machine, and found that the recommendation for virtualenv doesn’t appear in the most recent snapshot of the documentation.

The simplest way to install oci is through pip, as shown in the documentation:

wget https://codeload.github.com/oracle/oci-cli/zip/master -O oci-cli.zip

Install pip if necessary:

apt install -y python3-pip

Then, download and install oci:

wget https://codeload.github.com/oracle/oci-cli/zip/master -O oci-cli.zip

Or:

curl https://codeload.github.com/oracle/oci-cli/zip/master -o oci-cli.zip

pip3 install oci-cli.zip

While that did indeed work, the cx_Oracle package was not installed. cx_Oracle is the Python package that allows connection to Oracle databases directly from a Python script.

Rather than separately installing cx_Oracle, I decided to use another installation method, as described in Installing the CLI.

This is the installation method as described in the documentation for Linux, Unix, and MacOS.

bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"

I don’t know how everyone else feels about this, but I kind of cringe every time I see this installation pattern:

“Here’s a shell script, just download and run it, all in one command.”

If you’re like me and somewhat paranoid, you’ll do it this way (or similar) instead.

curl https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh -o install.sh

Or:
wget https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh -O install.sh

Now, have a look at the file. When you’re satisfied the script is what you expected, you can then run it.

However, running the oci installer requires the correct version of Python. What is the “correct” version, you ask? You won’t know until you run the installer. However, it’ll likely work just fine.

From the current version of the script:

“System version of Python must be either a Python 2 version >= 2.7.5 or a Python 3 version >= 3.5.0.”

First, I tried installing oci on Ubuntu 20.04 LTS. The oci installer failed right after displaying the list of extensions that might be installed:

bash install.sh

===> Currently supported optional packages are: ['db (will install cx_Oracle)']
What optional CLI packages would you like to be installed (comma separated names; press enter if you don't need any optional packages)?:
-- The optional packages installed will be ''.
-- Trying to use python3 venv.
-- Executing: ['/usr/bin/python3', '-m', 'venv', '/opt/oracle/cli']
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.

apt-get install python3-venv
...

Fortunately, it describes how to correct the error:

As root:

apt install -y python3-venv

Apparently, the virtual environment is a dependency, even if I won’t be using it. It’ll also be necessary to have the Python development headers for the “db” option, which installs cx_Oracle.

The following command installs pip as well as the two dependencies:

apt install -y python3-pip python3-venv python3-dev

Now, let’s try again. Note that I wanted to skip all the user prompts and used “install.sh -h” (not reproduced here) to see which options to use to accomplish this.

Here is the command line I used:

bash oci-cli-installer.sh --optional-features db \
--install-dir /opt/oracle/cli \
--exec-dir /usr/local/bin \
--dry-run

Why did I use –dry-run? Because there didn’t seem to be an option to indicate where the cli scripts should be installed.

I had previously run the install.sh script in interactive mode and I was prompted where the oci scripts should be installed. The install.sh script does not have an option for this, so I wanted to see if there would again be a prompt for this when using the command-line options. Sure enough, there was a prompt for the oci script location:

root@ubuntu-mule-03:~/build/oci# bash oci-cli-installer.sh --optional-features db \
>    --install-dir /opt/oracle/cli \
>    --exec-dir /usr/local/bin \
>    --dry-run

    ******************************************************************************
    You have started the OCI CLI Installer in interactive mode. If you do not wish
    to run this in interactive mode, please include the --accept-all-defaults option.
    If you have the script locally and would like to know more about
    input options for this script, then you can run:
    ./install.sh -h
    If you would like to know more about input options for this script, refer to:
    https://github.com/oracle/oci-cli/blob/master/scripts/install/README.rst
    ******************************************************************************
Downloading Oracle Cloud Infrastructure CLI install script from https://raw.githubusercontent.com/oracle/oci-cli/v2.9.3/scripts/install/install.py to /tmp/oci_cli_install_tmp_KPre.
################################################################################################################################################################################### 100.0%
Python not found on system PATH
Running install script.
python3 /tmp/oci_cli_install_tmp_KPre  --optional-features db --install-dir /opt/oracle/cli --exec-dir /usr/local/bin --dry-run
-- Verifying Python version.
-- Python version 3.8.2 okay.

===> In what directory would you like to place the OCI scripts? (leave blank to use '/root/bin/oci-cli-scripts'):

Installing the oci scripts in a /root directory is clearly not appropriate when trying to install for all users. And, because I want to run this without any interaction, this will not do.

Documentation for the install.sh script is located at https://github.com/oracle/oci-cli/blob/master/scripts/install/README.rst. There’s no information about an option that specifies where the cli scripts should be installed, nor could I find one in the script itself.

The shell script is used to collect the defaults for the actual installer, which is a Python script.

To get this done, I see these two choices:

  • Run the install.sh script interactively.
  • Download the Python install script and modify it.

After looking at the Python source for install.py, it’s clear there isn’t an option to specify a location for the oci scripts. So, I added one. In short, the process for that is as follows:

  • Fork the github repository.
  • Clone my forked repository locally on my workstation.
  • Make the required modifications.
  • Create a pull request to get the changes added to the master repository.

That’s just an overview. There are a few more details involved.

The option –script-dir was added to avoid the prompt for the script directory location. You can find the script at https://github.com/jkstill/oci-cli/blob/script-dir-option/scripts/install/install.py.

Note #1: That location will eventually change. Go to https://github.com/jkstill/oci-cli/ or https://github.com/oracle/oci-cli/ to find the script if the URL above no longer works.

Note #2: A pull request will be created for this change after Oracle approves me as a contributor.

Now, I’ll look at the help with the –script-dir option added:

root@ubuntu-mule-03:~/build/oci# python3 install.py  --help
usage: install.py [-h] [--accept-all-defaults] [--optional-features OPTIONAL_FEATURES] [--install-dir INSTALL_DIR] [--exec-dir EXEC_DIR] [--script-dir SCRIPT_DIR]
                  [--update-path-and-enable-tab-completion] [--rc-file-path RC_FILE_PATH] [--oci-cli-version OCI_CLI_VERSION] [--dry-run] [--verify-native-dependencies]

Install Oracle Cloud Infrastructure CLI.

optional arguments:
  -h, --help            show this help message and exit
  --accept-all-defaults
                        If this flag is specified, no user prompts will be displayed and all default prompt responses will be used. This flag can be used in combination with other input
                        parameters/flags. When used with other parameters/flags, other parameter values mentioned on command line take precedence over default values.
  --optional-features OPTIONAL_FEATURES
                        This input param is used to specify any optional features that need to be installed as part of OCI CLI install .e.g. to run dbaas script 'create_backup_from_onprem', users
                        need to install optional "db" feature which will install dependent cxOracle package. Use this optional input param as follows: --optional-features feature1,feature2
  --install-dir INSTALL_DIR
                        This input parameter allows the user to specify the directory where CLI installation is done.
  --exec-dir EXEC_DIR   This input parameter allows the user to specify the directory where CLI executable is stored.
  --script-dir SCRIPT_DIR
                        This input parameter allows the user to specify the directory where CLI scripts are stored.
  --update-path-and-enable-tab-completion
                        If this flag is specified, the PATH environment variable is updated to include CLI executable and tab auto completion of CLI commands is enabled. It does require rc file
                        path in *NIX systems which can be either given interactively or using the --rc-file-path option
  --rc-file-path RC_FILE_PATH
                        This input param is used in *NIX systems to update the corresponding shell rc file with command auto completion and modification to PATH environment variable with CLI
                        executable path. It requires shell's rc file path. e.g. ~/.bashrc. Ideally, should be used with the --update-path-and-enable-tab-completion option
  --oci-cli-version OCI_CLI_VERSION
                        The pip version of CLI to install.
  --dry-run             Do not install virtualenv or CLI but go through the motions.
  --verify-native-dependencies
                        Check whether linux native dependencies are available to compile modules like cryptography. This option is deprecated in version 2.9.7 and will be removed soon.

Again, I’ll try a dry run:

python3 install.py  --optional-features db \
   --install-dir /opt/oracle/cli \
   --exec-dir /usr/local/bin \
   --script-dir /opt/oracle/cli/scripts \
   --update-path-and-enable-tab-completion \
   --rc-file-path /etc/bash.bashrc \
   --dry-run


   root@ubuntu-mule-03:~/build/oci# python3 install.py  --optional-features db \
>    --install-dir /opt/oracle/cli \
>    --exec-dir /usr/local/bin \
>    --script-dir /opt/oracle/cli/scripts \
>    --update-path-and-enable-tab-completion \
>    --rc-file-path /etc/bash.bashrc
>    --dry-run
-- Verifying Python version.
-- Python version 3.8.2 okay.
-- dry-run: Skipping virtualenv setup
-- dry-run: Skipping CLI install, cmd=['/opt/oracle/cli/bin/pip', 'install', '--cache-dir', '/tmp/tmp5nm_wxbq', 'oci_cli[db]', '--upgrade']
-- dry-run: Skipping copying files to Scripts/bin directories.
-- dry-run: exec_dir=/usr/local/bin
-- dry-run: Skipping handle_path_and_tab_completion
-- dry-run: update_path_and_enable_tab_completion=False
-- dry-run: rc_file_path=/etc/bash.bashrc
-- Installation successful.
-- Run the CLI with /usr/local/bin/oci --help

Everything looks OK, so now I’ll perform the installation:

python3 install.py  --optional-features db \
   --install-dir /opt/oracle/cli \
   --exec-dir /usr/local/bin \
   --script-dir /opt/oracle/cli/scripts \
   --update-path-and-enable-tab-completion \
   --rc-file-path /etc/bash.bashrc

(There was a lot of output, and it’s not shown here.)

Verify the results:

root@ubuntu-mule-03:~/build/oci# oci --version
2.10.3

Installing on Oracle Linux

You might expect that you can easily install the oci cli utility through yum on Oracle Linux 7.5. However, this is not the case:

[root@ora75 ~]# yum install -y oci-utils
Loaded plugins: langpacks, ulninfo
Resolving Dependencies
--> Running transaction check
---> Package oci-utils.noarch 0:0.10.1-9.el7 will be installed
--> Processing Dependency: python-daemon for package: oci-utils-0.10.1-9.el7.noarch
--> Finished Dependency Resolution
Error: Package: oci-utils-0.10.1-9.el7.noarch (ol7_developer)
           Requires: python-daemon
 You could try using --skip-broken to work around the problem

There’s a missing dependency on something called python-daemon.

So, I tried to install that, after enabling optional and add-on repositories in yum:

root@ora75 yum.repos.d]# yum install -y python-daemon
Loaded plugins: langpacks, ulninfo
No package python-daemon available.

It seems that python-daemon is installed through pip:

[root@ora75 yum.repos.d]# pip3 install python-daemon
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Requirement already satisfied: python-daemon in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: setuptools in /usr/lib/python3.6/site-packages (from python-daemon)
Requirement already satisfied: lockfile>=0.10 in /usr/local/lib/python3.6/site-packages (from python-daemon)
Requirement already satisfied: docutils in /usr/local/lib/python3.6/site-packages (from python-daemon)

Apparently, python-daemon is already installed. So, now I do not know what the problem is, and I don’t really want to spend time troubleshooting it. If I were configuring a large number of production systems, I might take the time to learn how to fix this, if it would also install cx_Oracle. However, these are just test servers, and it’s not necessary to spend time on that. Instead, I’ll use the same method that was used for the Ubuntu servers.

I retrieved the modified version of install.py and ran it:

Note: The argument for –rc-file-path is different on RedHat Linux than it is on Ubuntu.

python3 install.py  --optional-features db \
   --install-dir /opt/oracle/cli \
   --exec-dir /usr/local/bin \
   --script-dir /opt/oracle/cli/scripts \
   --update-path-and-enable-tab-completion \
   --rc-file-path /etc/bashrc

The command ran flawlessly:

[root@ora75 oci-cli]# python3 install.py  --optional-features db    --install-dir /opt/oracle/cli    --exec-dir /usr/local/bin    --script-dir /opt/oracle/cli/scripts    --update-path-and-enable-tab-completion    --rc-file-path /etc/bashrc
-- Verifying Python version.
-- Python version 3.6.8 okay.
-- Creating directory '/opt/oracle/cli'.
-- Creating directory '/opt/oracle/cli/scripts'.
-- Trying to use python3 venv.
-- Executing: ['/usr/bin/python3', '-m', 'venv', '/opt/oracle/cli']
-- Executing: ['/opt/oracle/cli/bin/pip', 'install', '--upgrade', 'pip']
Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/2e/df11ea7e23e7e761d484ed3740285a34e38548cf2bad2bed3dd5768ec8b9/pip-20.1-py2.py3-none-any.whl (1.5MB)
    100% |------------------------| 1.5MB 1.1MB/s 
Installing collected packages: pip
  Found existing installation: pip 9.0.3
    Uninstalling pip-9.0.3:
      Successfully uninstalled pip-9.0.3
Successfully installed pip-20.1
-- Executing: ['/opt/oracle/cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpdv0oh45p', 'wheel', '--upgrade']
Collecting wheel
  Downloading wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: wheel
Successfully installed wheel-0.34.2
-- Executing: ['/opt/oracle/cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpdv0oh45p', 'oci_cli[db]', '--upgrade']
Collecting oci_cli[db]
  Downloading oci_cli-2.10.3-py2.py3-none-any.whl (8.2 MB)
     |------------------------|8.2 MB 1.8 MB/s 
Collecting arrow==0.14.7
  Downloading arrow-0.14.7-py2.py3-none-any.whl (39 kB)
Collecting jmespath==0.9.4
  Downloading jmespath-0.9.4-py2.py3-none-any.whl (24 kB)
Collecting pytz>=2016.10
  Downloading pytz-2020.1-py2.py3-none-any.whl (510 kB)
     |------------------------| 510 kB 59.4 MB/s 
Collecting pyOpenSSL==18.0.0
  Downloading pyOpenSSL-18.0.0-py2.py3-none-any.whl (53 kB)
     |------------------------| 53 kB 880 kB/s 
Collecting six==1.14.0
  Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting PyYAML==5.1.2
  Downloading PyYAML-5.1.2.tar.gz (265 kB)
     |------------------------| 265 kB 52.5 MB/s 
Collecting python-dateutil<3.0.0,>=2.5.3
  Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
     |------------------------| 227 kB 60.5 MB/s 
Collecting certifi
  Downloading certifi-2020.4.5.1-py2.py3-none-any.whl (157 kB)
     |------------------------| 157 kB 43.3 MB/s 
Collecting terminaltables==3.1.0
  Downloading terminaltables-3.1.0.tar.gz (12 kB)
Collecting idna<2.7,>=2.5
  Downloading idna-2.6-py2.py3-none-any.whl (56 kB)
     |------------------------| 56 kB 4.4 MB/s 
Collecting oci==2.14.2
  Downloading oci-2.14.2-py2.py3-none-any.whl (4.3 MB)
     |------------------------| 4.3 MB 15.5 MB/s 
Collecting configparser==4.0.2
  Downloading configparser-4.0.2-py2.py3-none-any.whl (22 kB)
Collecting click==6.7
  Downloading click-6.7-py2.py3-none-any.whl (71 kB)
     |------------------------| 71 kB 10.0 MB/s 
Collecting retrying==1.3.3
  Downloading retrying-1.3.3.tar.gz (10 kB)
Collecting cryptography==2.8
  Downloading cryptography-2.8-cp34-abi3-manylinux2010_x86_64.whl (2.3 MB)
     |------------------------| 2.3 MB 47.1 MB/s 
Collecting cx-Oracle==7.0; extra == "db"
  Downloading cx_Oracle-7.0.0-cp36-cp36m-manylinux1_x86_64.whl (675 kB)
     |------------------------| 675 kB 48.8 MB/s 
Collecting cffi!=1.11.3,>=1.8
  Downloading cffi-1.14.0-cp36-cp36m-manylinux1_x86_64.whl (399 kB)
     |------------------------| 399 kB 37.9 MB/s 
Collecting pycparser
  Downloading pycparser-2.20-py2.py3-none-any.whl (112 kB)
     |------------------------| 112 kB 34.9 MB/s 
Building wheels for collected packages: PyYAML, terminaltables, retrying
  Building wheel for PyYAML (setup.py) ... done
  Created wheel for PyYAML: filename=PyYAML-5.1.2-cp36-cp36m-linux_x86_64.whl size=44104 sha256=c054ec577f2f48663b8771c9762fdd48b35a7b8d2657c658913cb0b7b6390bcf
  Stored in directory: /tmp/tmpdv0oh45p/wheels/d8/9b/e7/75af463b873c119dd444151fc54a8e190c87993593e1fa194a
  Building wheel for terminaltables (setup.py) ... done
  Created wheel for terminaltables: filename=terminaltables-3.1.0-py3-none-any.whl size=15354 sha256=ab42cd7837957cc71cfde2df316283b8bb3251be26f393c6c14c2e91c5864be9
  Stored in directory: /tmp/tmpdv0oh45p/wheels/86/1b/58/c23af2fe683acd8edc15d5a1268f0242be1ff2cf827fe34737
  Building wheel for retrying (setup.py) ... done
  Created wheel for retrying: filename=retrying-1.3.3-py3-none-any.whl size=11430 sha256=41f75f23c5d9fd38fa2df4e5c4f91afd5f9e5e12c5b8de65d51087ff67b23cae
  Stored in directory: /tmp/tmpdv0oh45p/wheels/ac/cb/8a/b27bf6323e2f4c462dcbf77d70b7c5e7868a7fbe12871770cf
Successfully built PyYAML terminaltables retrying
Installing collected packages: six, python-dateutil, arrow, jmespath, pytz, pycparser, cffi, cryptography, pyOpenSSL, PyYAML, certifi, terminaltables, idna, configparser, oci, click, retrying, cx-Oracle, oci-cli
Successfully installed PyYAML-5.1.2 arrow-0.14.7 certifi-2020.4.5.1 cffi-1.14.0 click-6.7 configparser-4.0.2 cryptography-2.8 cx-Oracle-7.0.0 idna-2.6 jmespath-0.9.4 oci-2.14.2 oci-cli-2.10.3 pyOpenSSL-18.0.0 pycparser-2.20 python-dateutil-2.8.1 pytz-2020.1 retrying-1.3.3 six-1.14.0 terminaltables-3.1.0
-- Backed up '/etc/bashrc' to '/etc/bashrc.backup'
-- Tab completion set up complete.
-- If tab completion is not activated, verify that '/etc/bashrc' is sourced by your shell.
-- 
-- ** Run `exec -l $SHELL` to restart your shell. **
-- 
-- Installation successful.
-- Run the CLI with /usr/local/bin/oci --help

Using my own account, I’ll verify the successful installation:

jkstill@ubuntu-20lts-template:~$ oci --version
2.10.3

Installing on Windows

Installing the oci client on Windows was the easiest of all. However, the cx_Oracle package was not installed. Because I don’t need it here, I didn’t look for a method to install it.

Note: I installed oci on Windows just to ensure it works (I won’t be using it on Windows).

Start by running PowerShell as Administrator on Windows 10.

Note: I followed the instructions exactly as shown in the documentation, and accepted default values for all the prompts.

First, allow the script to run:

PS C:\Windows\system32> Set-ExecutionPolicy RemoteSigned
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): A
PS C:\Windows\system32>

Then, run the installer:

PS C:\Windows\system32> powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.ps1'))"

        ******************************************************************************
        You have started the OCI CLI Installer in interactive mode. If you do not wish
        to run this in interactive mode, please include the -AcceptAllDefaults option.
        If you have the script locally and would like to know more about
        input options for this script, then you can run:
        help .\install.ps1
        If you would like to know more about input options for this script, refer to:
        https://github.com/oracle/oci-cli/blob/master/scripts/install/README.rst
        ******************************************************************************
VERBOSE: Python found in registry: HKCU:\Software\Python\PythonCore
VERBOSE: Downloading install script to C:\Users\jaredstill\AppData\Local\Temp\tmp6D4A.tmp
VERBOSE:  False   False
VERBOSE: Using Python executable: C:\Python37\python.exe to run install script...
VERBOSE: Arguments to python script: "C:\Users\jaredstill\AppData\Local\Temp\tmp6D4A.tmp"
-- Verifying Python version.
-- Python version 3.7.2 okay.

===> In what directory would you like to place the install? (leave blank to use 'C:\Users\jaredstill\lib\oracle-cli'):
-- Creating directory 'C:\Users\jaredstill\lib\oracle-cli'.
-- We will install at 'C:\Users\jaredstill\lib\oracle-cli'.

===> In what directory would you like to place the 'oci.exe' executable? (leave blank to use 'C:\Users\jaredstill\bin'):
-- Creating directory 'C:\Users\jaredstill\bin'.
-- The executable will be in 'C:\Users\jaredstill\bin'.

===> In what directory would you like to place the OCI scripts? (leave blank to use 'C:\Users\jaredstill\bin\oci-cli-scripts'):
-- Creating directory 'C:\Users\jaredstill\bin\oci-cli-scripts'.
-- The scripts will be in 'C:\Users\jaredstill\bin\oci-cli-scripts'.

===> Currently supported optional packages are: ['db (will install cx_Oracle)']
What optional CLI packages would you like to be installed (comma separated names; press enter if you don't need any optional packages)?:
-- The optional packages installed will be ''.
-- Trying to use python3 venv.
-- Executing: ['C:\\Python37\\python.exe', '-m', 'venv', 'C:\\Users\\jaredstill\\lib\\oracle-cli']
-- Executing: ['C:\\Users\\jaredstill\\lib\\oracle-cli\\Scripts\\pip', 'install', '--cache-dir', 'C:\\Users\\JAREDS~1\\AppData\\Local\\Temp\\tmpcovdle8g', 'oci_cli', '--upgrade']
Collecting oci_cli
  Downloading https://files.pythonhosted.org/packages/23/cf/8a3536b5b70157b85bd39c1c9f4c21222705dfa2e014fbe5404ba741dddf/oci_cli-2.10.3-py2.py3-none-any.whl (8.2MB)
    100% |------------------------| 8.2MB 5.5MB/s
Collecting click==6.7 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl (71kB)
    100% |------------------------| 71kB 7.3MB/s
Collecting oci==2.14.2 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/ce/a0/7e6d38ff2c3314d29738765bdb93f951a9cb63051b8d8e937e6e2a1becba/oci-2.14.2-py2.py3-none-any.whl (4.3MB)
    100% |------------------------| 4.3MB 7.0MB/s
Collecting pytz>=2016.10 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/4f/a4/879454d49688e2fad93e59d7d4efda580b783c745fd2ec2a3adf87b0808d/pytz-2020.1-py2.py3-none-any.whl (510kB)
    100% |------------------------| 512kB 15.1MB/s
Collecting certifi (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/57/2b/26e37a4b034800c960a00c4e1b3d9ca5d7014e983e6e729e33ea2f36426c/certifi-2020.4.5.1-py2.py3-none-any.whl (157kB)
    100% |------------------------| 163kB 11.7MB/s
Collecting configparser==4.0.2 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/7a/2a/95ed0501cf5d8709490b1d3a3f9b5cf340da6c433f896bbe9ce08dbe6785/configparser-4.0.2-py2.py3-none-any.whl
Collecting cryptography==2.8 (from oci_cli)                                                                                                                                                                                       Downloading https://files.pythonhosted.org/packages/a4/9c/9ad11ad293bb75d37fa63a0d1f47ae7f6ccda32bc7452bf2ffb788ca753f/cryptography-2.8-cp37-cp37m-win_amd64.whl (1.5MB)                                                          100% |------------------------| 1.5MB 8.1MB/s                                                                                                                                                                       Collecting idna<2.7,>=2.5 (from oci_cli)                                                                                                                                                                                          Downloading https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl (56kB)
    100% |------------------------| 61kB 6.3MB/s
Collecting six==1.14.0 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting python-dateutil<3.0.0,>=2.5.3 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl (227kB)
    100% |------------------------| 235kB 13.1MB/s
Collecting terminaltables==3.1.0 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/9b/c4/4a21174f32f8a7e1104798c445dacdc1d4df86f2f26722767034e4de4bff/terminaltables-3.1.0.tar.gz
Collecting arrow==0.14.7 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/b9/26/aff20e20eb4fc8f9cbe60434494b53b8cc327062585517461bfdff76125f/arrow-0.14.7-py2.py3-none-any.whl
Collecting retrying==1.3.3 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/44/ef/beae4b4ef80902f22e3af073397f079c96969c69b2c7d52a57ea9ae61c9d/retrying-1.3.3.tar.gz
Collecting PyYAML==5.1.2 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/bc/3f/4f733cd0b1b675f34beb290d465a65e0f06b492c00b111d1b75125062de1/PyYAML-5.1.2-cp37-cp37m-win_amd64.whl (215kB)
    100% |------------------------| 225kB 6.6MB/s
Collecting jmespath==0.9.4 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/83/94/7179c3832a6d45b266ddb2aac329e101367fbdb11f425f13771d27f225bb/jmespath-0.9.4-py2.py3-none-any.whl
Collecting pyOpenSSL==18.0.0 (from oci_cli)
  Downloading https://files.pythonhosted.org/packages/96/af/9d29e6bd40823061aea2e0574ccb2fcf72bfd6130ce53d32773ec375458c/pyOpenSSL-18.0.0-py2.py3-none-any.whl (53kB)
    100% |------------------------| 61kB 7.9MB/s
Collecting cffi!=1.11.3,>=1.8 (from cryptography==2.8->oci_cli)
  Downloading https://files.pythonhosted.org/packages/cf/d6/77bafa8180a8ec309a5300296f2855f7d58c0530d2e4a39064ae8ab42e4e/cffi-1.14.0-cp37-cp37m-win_amd64.whl (176kB)
    100% |------------------------| 184kB 13.1MB/s
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography==2.8->oci_cli)
  Downloading https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl (112kB)
    100% |------------------------| 112kB 9.5MB/s
Installing collected packages: click, pytz, certifi, configparser, pycparser, cffi, six, cryptography, python-dateutil, pyOpenSSL, oci, idna, terminaltables, arrow, retrying, PyYAML, jmespath, oci-cli
  Running setup.py install for terminaltables ... done
  Running setup.py install for retrying ... done
Successfully installed PyYAML-5.1.2 arrow-0.14.7 certifi-2020.4.5.1 cffi-1.14.0 click-6.7 configparser-4.0.2 cryptography-2.8 idna-2.6 jmespath-0.9.4 oci-2.14.2 oci-cli-2.10.3 pyOpenSSL-18.0.0 pycparser-2.20 python-dateutil-2.8.1 pytz-2020.1 retrying-1.3.3 six-1.14.0 terminaltables-3.1.0
You are using pip version 18.1, however version 20.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

===> Modify PATH to include the CLI and enable tab completion in PowerShell now? (Y/n):
--
-- ** Close and re-open PowerShell to reload changes to your PATH **
-- In order to run the autocomplete script, you may also need to set your PowerShell execution policy to allow for running local scripts (as an Administrator run Set-ExecutionPolicy RemoteSigned in a PowerShell prompt)
--
-- Installation successful.
-- Run the CLI with C:\Users\jaredstill\bin\oci.exe --help
VERBOSE: Successfully installed OCI CLI!

Finally, I opened a Command window and verified the version:

C:\Users\jaredstill>C:\Users\jaredstill\bin\oci.exe --version
2.10.3

Conclusion

Sometimes the simplest installation method (that works) is the best.

For another take on installing the oci tools on Oracle 7 Linux, see this blog by fellow Pythianite Jose Rodriguez.

There are times, however, when the simplest method might not be sufficient for your requirements, and the other documented methods might not quite do what you need them to do. In these situations, it’s good to be innovative, as a little time spent early on can save a lot of time later. Such was the case with the installation of the Oracle Cloud Infrastructure oci command line utilities.

It was a little frustrating at first to not be able to install it the way I wanted. However, after a little investigation, the path to success was clear.

A minor victory for the day!

email

Authors

Interested in working with Jared? Schedule a tech call.

About the Author

Oracle experience: started with Oracle 7.0.13 Programming Experience: Perl, PL/SQL, Shell, SQL Also some other odds and ends that are no longer useful Systems: Networking, Storage, OS to varying degrees. Have fond memories of DG/UX

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *