[OCI CLI 설치] Linux & Mac OS

  • 문서 생성일: 0001-01-01 00:00:00 +0000 UTC

  • 이 문서는 리눅스 계열 OS와 Mac OS에서 OCI CLI를 설치하고 제거하는 과정을 소개합니다. 다음과 같은 목차로 구성됩니다.


    OCI CLI 설치

    OCI CLI 프로젝트에서는 리눅스 계열 OS와 Mac OS를 위한 쉡 스크립트를 제공합니다. 터미널상에서 다음 스크립트를 실행하여 간편하게 OCI CLI를 설치할 수 있습니다.

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

    위 스크립트를 실행하면 다음과 같은 항목에 대한 입력이 요청됩니다. 모든 항목에 대하여 기본 값을 선택할 것을 추천합니다.

    입력 요청 질의 설명 입력값
    ===> In what directory would you like to place the install? (leave blank to use ‘/home/opc/lib/oracle-cli’): OCI CLI 설치 위치 기본 값 사용(Enter)
    ===> In what directory would you like to place the ‘oci’ executable? (leave blank to use ‘/home/opc/bin’): OCI CLI 실행 파일 설치 위치 기본 값 사용(Enter)
    ===> In what directory would you like to place the OCI scripts? (leave blank to use ‘/home/opc/bin/oci-cli-scripts’): OCI CLI 스크립트 파일 설치 위치 기본 값 사용(Enter)
    ===> 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)?: 추가패키지 설치 기본 값 사용(Enter)
    ===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): 환경변수 수정 기본 값 사용(Enter)
    ===> Enter a path to an rc file to update (leave blank to use ‘/home/opc/.bashrc’): 패스 업데이트 기본 값 사용(Enter)

    전체 설치 로그는 다음과 같습니다.

    [opc@demo02 ~]$ bash -c \
    > "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)"
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 13979  100 13979    0     0  55147      0 --:--:-- --:--:-- --:--:-- 55472
    
        ******************************************************************************
        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_2Rob.
    ######################################################################## 100.0%
    Python3 not found on system PATH
    Running install script.
    python /tmp/oci_cli_install_tmp_2Rob
    -- Verifying Python version.
    -- Python version 2.7.5 okay.
    
    ===> In what directory would you like to place the install? (leave blank to use '/home/opc/lib/oracle-cli'):
    -- Creating directory '/home/opc/lib/oracle-cli'.
    -- We will install at '/home/opc/lib/oracle-cli'.
    
    ===> In what directory would you like to place the 'oci' executable? (leave blank to use '/home/opc/bin'):
    -- Creating directory '/home/opc/bin'.
    -- The executable will be in '/home/opc/bin'.
    
    ===> In what directory would you like to place the OCI scripts? (leave blank to use '/home/opc/bin/oci-cli-scripts'):
    -- Creating directory '/home/opc/bin/oci-cli-scripts'.
    -- The scripts will be in '/home/opc/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: ['/usr/bin/python', '-m', 'venv', '/home/opc/lib/oracle-cli']
    /usr/bin/python: No module named venv
    -- System was unable to use venv, is going to download and create virtualenv.
    -- Downloading virtualenv package from https://github.com/pypa/virtualenv/archive/15.0.0.tar.gz.
    -- Downloaded virtualenv package to /tmp/tmpZCpUza/15.0.0.tar.gz.
    -- Checksum of /tmp/tmpZCpUza/15.0.0.tar.gz OK.
    -- Extracting '/tmp/tmpZCpUza/15.0.0.tar.gz' to '/tmp/tmpZCpUza'.
    -- Executing: ['/usr/bin/python', 'virtualenv.py', '--python', '/usr/bin/python', '/home/opc/lib/oracle-cli']
    Already using interpreter /usr/bin/python
    New python executable in /home/opc/lib/oracle-cli/bin/python
    Installing setuptools, pip, wheel...done.
    -- Executing: ['/home/opc/lib/oracle-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpZCpUza', 'oci_cli', '--upgrade']
    DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
    Collecting oci_cli
      Downloading oci_cli-2.9.3-py2.py3-none-any.whl (7.4 MB)
         |████████████████████████████████| 7.4 MB 31.0 MB/s
    Collecting cryptography==2.8
      Downloading cryptography-2.8-cp27-cp27mu-manylinux2010_x86_64.whl (2.3 MB)
         |████████████████████████████████| 2.3 MB 33.0 MB/s
    Collecting certifi
      Downloading certifi-2019.11.28-py2.py3-none-any.whl (156 kB)
         |████████████████████████████████| 156 kB 40.2 MB/s
    Collecting pyOpenSSL==18.0.0
      Downloading pyOpenSSL-18.0.0-py2.py3-none-any.whl (53 kB)
         |████████████████████████████████| 53 kB 2.6 MB/s
    Collecting arrow==0.10.0
      Downloading arrow-0.10.0.tar.gz (86 kB)
         |████████████████████████████████| 86 kB 7.7 MB/s
    Collecting retrying==1.3.3
      Downloading retrying-1.3.3.tar.gz (10 kB)
    Collecting oci==2.10.5
      Downloading oci-2.10.5-py2.py3-none-any.whl (3.5 MB)
         |████████████████████████████████| 3.5 MB 38.5 MB/s
    Collecting pytz==2016.10
      Downloading pytz-2016.10-py2.py3-none-any.whl (483 kB)
         |████████████████████████████████| 483 kB 35.1 MB/s
    Collecting idna<2.7,>=2.5
      Downloading idna-2.6-py2.py3-none-any.whl (56 kB)
         |████████████████████████████████| 56 kB 6.5 MB/s
    Collecting PyYAML==5.1.2
      Downloading PyYAML-5.1.2.tar.gz (265 kB)
         |████████████████████████████████| 265 kB 35.2 MB/s
    Collecting terminaltables==3.1.0
      Downloading terminaltables-3.1.0.tar.gz (12 kB)
    Collecting six==1.11.0
      Downloading six-1.11.0-py2.py3-none-any.whl (10 kB)
    Collecting python-dateutil==2.7.3
      Downloading python_dateutil-2.7.3-py2.py3-none-any.whl (211 kB)
         |████████████████████████████████| 211 kB 35.6 MB/s
    Collecting configparser==3.5.0
      Downloading configparser-3.5.0.tar.gz (39 kB)
    Collecting jmespath==0.9.3
      Downloading jmespath-0.9.3-py2.py3-none-any.whl (23 kB)
    Collecting click==6.7
      Downloading click-6.7-py2.py3-none-any.whl (71 kB)
         |████████████████████████████████| 71 kB 9.0 MB/s
    Collecting cffi!=1.11.3,>=1.8
      Downloading cffi-1.14.0-cp27-cp27mu-manylinux1_x86_64.whl (387 kB)
         |████████████████████████████████| 387 kB 33.3 MB/s
    Collecting ipaddress; python_version < "3"
      Downloading ipaddress-1.0.23-py2.py3-none-any.whl (18 kB)
    Collecting enum34; python_version < "3"
      Downloading enum34-1.1.6-py2-none-any.whl (12 kB)
    Collecting pycparser
      Downloading pycparser-2.19.tar.gz (158 kB)
         |████████████████████████████████| 158 kB 43.3 MB/s
    Building wheels for collected packages: arrow, retrying, PyYAML, terminaltables, configparser, pycparser
      Building wheel for arrow (setup.py) ... done
      Created wheel for arrow: filename=arrow-0.10.0-py2.py3-none-any.whl size=32852 sha256=588fb64659d6e482ab77ff9923c1a3b0df991546b38f6c8a2fa35d312d149d08
      Stored in directory: /tmp/tmpZCpUza/wheels/e9/2b/c1/e12eca55f056e9a41ed1d83bc42996bb12283c7509d5d690c6
      Building wheel for retrying (setup.py) ... done
      Created wheel for retrying: filename=retrying-1.3.3-py2-none-any.whl size=11430 sha256=41590ed3406a3bb96547a454c2dcdef5c7317a5a563f35b52d57f46ac1347ba0
      Stored in directory: /tmp/tmpZCpUza/wheels/fa/24/c3/9912f4c9363033bbd0eafbec1b27c65b04d7ea6acd312876b0
      Building wheel for PyYAML (setup.py) ... done
      Created wheel for PyYAML: filename=PyYAML-5.1.2-cp27-cp27mu-linux_x86_64.whl size=44911 sha256=008463f3440ed923750648617d3f55c8be612daef2ddcb8fa25f5a692d2c2f33
      Stored in directory: /tmp/tmpZCpUza/wheels/87/9b/a7/9bfdaa1487acce958269a6b5f86db2e4d38204dff4e256e23a
      Building wheel for terminaltables (setup.py) ... done
      Created wheel for terminaltables: filename=terminaltables-3.1.0-py2-none-any.whl size=15354 sha256=8ccf0b3bc5630e3a28f8f2b0712cb4b0068d7a782cc06562dcd32d69d824f65d
      Stored in directory: /tmp/tmpZCpUza/wheels/f0/11/d1/8902b10e29e3ce2c8965a86533b76894c844565e02d5341520
      Building wheel for configparser (setup.py) ... done
      Created wheel for configparser: filename=configparser-3.5.0-py2-none-any.whl size=21661 sha256=1e85a455796d38a0e4119626b41a5c1c0527d1de6f04952c4d60e02d2edfcc69
      Stored in directory: /tmp/tmpZCpUza/wheels/fe/e1/b2/ffea2d060a50955b9228e7a1dc7b1fc7a5013dc506da8c5272
      Building wheel for pycparser (setup.py) ... done
      Created wheel for pycparser: filename=pycparser-2.19-py2.py3-none-any.whl size=111028 sha256=ef0b916e255c13a6b24f2f827db4c01d8602e5a11c0505ba2ad977b5468ed606
      Stored in directory: /tmp/tmpZCpUza/wheels/f1/ed/ed/1cba03d3b567c6fabb01ea0e572dffecf350b7da49612d05b0
    Successfully built arrow retrying PyYAML terminaltables configparser pycparser
    Installing collected packages: six, pycparser, cffi, ipaddress, enum34, cryptography, certifi, pyOpenSSL, python-dateutil, arrow, retrying, pytz, configparser, oci, idna, PyYAML, terminaltables, jmespath, click, oci-cli
    Successfully installed PyYAML-5.1.2 arrow-0.10.0 certifi-2019.11.28 cffi-1.14.0 click-6.7 configparser-3.5.0 cryptography-2.8 enum34-1.1.6 idna-2.6 ipaddress-1.0.23 jmespath-0.9.3 oci-2.10.5 oci-cli-2.9.3 pyOpenSSL-18.0.0 pycparser-2.19 python-dateutil-2.7.3 pytz-2016.10 retrying-1.3.3 six-1.11.0 terminaltables-3.1.0
    
    ===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): Y
    
    ===> Enter a path to an rc file to update (leave blank to use '/home/opc/.bashrc'):
    -- Backed up '/home/opc/.bashrc' to '/home/opc/.bashrc.backup'
    -- Tab completion set up complete.
    -- If tab completion is not activated, verify that '/home/opc/.bashrc' is sourced by your shell.
    --
    -- ** Run `exec -l $SHELL` to restart your shell. **
    --
    -- Installation successful.
    -- Run the CLI with /home/opc/bin/oci --help
    [opc@demo02 ~]$ 
    

    설치 상태를 oci -v명령으로 확인할 수 있습니다. 이 명령이 실행되면 설치된 OCI CLI 버전이 출력됩니다.

    [opc@demo02 ~]$ oci -v
    2.9.3
    [opc@demo02 ~]$ 
    

    OCI CLI 제거

    OCI CLI가 설치된 상태에서 다음 디렉터리를 삭제하면 OCI CLI는 제거됩니다.

    디렉터리 유형 기본 설정 값(기본 디렉터리)
    OCI CLI 라이브러리 설치 위치 ~/lib/oracle-cli
    OCI CLI 실행 파일 설치 위치 ~/bin

    OCI CLI 라이브러리 설치 디렉터리와 실행 파일 설치 위치를 모두 삭제합니다. 기본 설정 값으로 설치했다면 다음 명령으로 OCI CLI를 제거할 수 있습니다.

    rm -rf $HOME/lib
    rm -rf $HOME/bin
    
    김태완 avatar
  • 작성자: 김태완
  • 사랑하는 민수와 데이터 관리, 데이터 분석 & 클라우드에 집중하고 있습니다.
  • E-mail: taewanme@gmail.com
  • Disclaimer
    이 저작물은 Oracle과 관계없이 개인으로서 개인의 시간을 할애하여 작성된 글 입니다. 본 글의 내용, 입장, 예측은 Oracle을 공식적으로 절대 대변하지 않습니다.