OCI CLI(コマンドラインインターフェイス)インストール

参考サイトのとおりに進める。

ubuntu@viewdns-net:~$ python3 -V
Python 3.10.6
ubuntu@viewdns-net:~$ 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 16926  100 16926    0     0  52733      0 --:--:-- --:--:-- --:--:-- 52728

    ******************************************************************************
    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/v3.2.1/scripts/install/install.py to /tmp/oci_cli_install_tmp_iTo5.
######################################################################### 100.0%
Running install script.
python3 /tmp/oci_cli_install_tmp_iTo5 
-- Verifying Python version.
-- Python version 3.10.6 okay.

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

===> In what directory would you like to place the 'oci' executable? (leave blank to use '/home/ubuntu/bin'): 
-- Creating directory '/home/ubuntu/bin'.
-- The executable will be in '/home/ubuntu/bin'.

===> In what directory would you like to place the OCI scripts? (leave blank to use '/home/ubuntu/bin/oci-cli-scripts'): 
-- Creating directory '/home/ubuntu/bin/oci-cli-scripts'.
-- The scripts will be in '/home/ubuntu/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 ''.
-- Executing: ['sudo', 'apt-get', 'update']
Hit:1 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy InRelease
Hit:2 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates InRelease
Hit:3 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-backports InRelease
Get:4 http://ports.ubuntu.com/ubuntu-ports jammy-security InRelease [110 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports jammy-security/main arm64 Packages [509 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports jammy-security/main Translation-en [120 kB]
Get:7 http://ports.ubuntu.com/ubuntu-ports jammy-security/main arm64 c-n-f Metadata [7280 B]
Get:8 http://ports.ubuntu.com/ubuntu-ports jammy-security/restricted arm64 Packages [222 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports jammy-security/restricted Translation-en [78.3 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe arm64 Packages [522 kB]
Get:11 http://ports.ubuntu.com/ubuntu-ports jammy-security/universe arm64 c-n-f Metadata [8336 B]
Fetched 1577 kB in 42s (37.7 kB/s)                                             
Reading package lists... Done
-- Installing python3-venv.
-- Executing: ['sudo', 'apt-get', 'install', 'python3-venv', '-y']
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  python3-pip-whl python3-setuptools-whl python3.10-venv
The following NEW packages will be installed:
  python3-pip-whl python3-setuptools-whl python3-venv python3.10-venv
0 upgraded, 4 newly installed, 0 to remove and 14 not upgraded.
Need to get 2474 kB of archives.
After this operation, 2888 kB of additional disk space will be used.
Ign:1 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy/universe arm64 python3-pip-whl all 22.0.2+dfsg-1
Ign:2 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy/universe arm64 python3-setuptools-whl all 59.6.0-1.2
Ign:3 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 python3.10-venv arm64 3.10.6-1~22.04.2
Ign:4 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 python3-venv arm64 3.10.6-1~22.04
Ign:1 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy/universe arm64 python3-pip-whl all 22.0.2+dfsg-1
Ign:2 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy/universe arm64 python3-setuptools-whl all 59.6.0-1.2
Ign:3 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 python3.10-venv arm64 3.10.6-1~22.04.2
Ign:4 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 python3-venv arm64 3.10.6-1~22.04
Ign:1 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy/universe arm64 python3-pip-whl all 22.0.2+dfsg-1
Ign:2 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy/universe arm64 python3-setuptools-whl all 59.6.0-1.2
Ign:3 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 python3.10-venv arm64 3.10.6-1~22.04.2
Ign:4 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 python3-venv arm64 3.10.6-1~22.04
Err:1 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy/universe arm64 python3-pip-whl all 22.0.2+dfsg-1
  Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (185.125.190.36), connection timed out
Err:2 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy/universe arm64 python3-setuptools-whl all 59.6.0-1.2
  Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
Ign:3 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 python3.10-venv arm64 3.10.6-1~22.04.2
Err:4 http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 python3-venv arm64 3.10.6-1~22.04
  Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
Get:3 http://ports.ubuntu.com/ubuntu-ports jammy-updates/universe arm64 python3.10-venv arm64 3.10.6-1~22.04.2 [5722 B]
Fetched 5722 B in 40s (142 B/s)     
E: Failed to fetch http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports/pool/universe/p/python-pip/python3-pip-whl_22.0.2%2bdfsg-1_all.deb  Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable) Could not connect to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (185.125.190.39), connection timed out Could not connect to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (185.125.190.36), connection timed out
E: Failed to fetch http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports/pool/universe/s/setuptools/python3-setuptools-whl_59.6.0-1.2_all.deb  Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
E: Failed to fetch http://ap-osaka-1-ad-1.clouds.ports.ubuntu.com/ubuntu-ports/pool/universe/p/python3-defaults/python3-venv_3.10.6-1%7e22.04_arm64.deb  Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::19). - connect (101: Network is unreachable) Cannot initiate the connection to ap-osaka-1-ad-1.clouds.ports.ubuntu.com:80 (2620:2d:4000:1::16). - connect (101: Network is unreachable)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
-- System was unable to use venv, is going to download and create virtualenv.
-- Downloading virtualenv package from https://github.com/pypa/get-virtualenv/blob/20.6.0/public/virtualenv.pyz?raw=true.
-- Downloaded virtualenv package to /tmp/tmpou669a4w/virtualenv-20.6.0.pyz.
-- Checksum of /tmp/tmpou669a4w/virtualenv-20.6.0.pyz OK.
-- Executing: ['/usr/bin/python3', 'virtualenv-20.6.0.pyz', '/home/ubuntu/lib/oracle-cli']
created virtual environment CPython3.10.6.final.0-64 in 333ms
  creator CPython3Posix(dest=/home/ubuntu/lib/oracle-cli, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/ubuntu/.local/share/virtualenv)
    added seed packages: pip==21.1.3, setuptools==57.1.0, wheel==0.36.2
  activators BashActivator,CShellActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator
-- Executing: ['/home/ubuntu/lib/oracle-cli/bin/pip', 'install', '--cache-dir', '/tmp/tmpou669a4w', 'oci_cli', '--upgrade']
Collecting oci_cli
  Downloading oci_cli-3.22.1-py3-none-any.whl (34.0 MB)
     |████████████████████████████████| 34.0 MB 3.8 MB/s 
Collecting certifi
  Downloading certifi-2022.12.7-py3-none-any.whl (155 kB)
     |████████████████████████████████| 155 kB 69.0 MB/s 
Collecting arrow>=1.0.0
  Downloading arrow-1.2.3-py3-none-any.whl (66 kB)
     |████████████████████████████████| 66 kB 8.8 MB/s 
Collecting cryptography<=39.0.0,>=3.2.1
  Downloading cryptography-39.0.0-cp36-abi3-manylinux_2_28_aarch64.whl (4.0 MB)
     |████████████████████████████████| 4.0 MB 46.5 MB/s 
Collecting PyYAML<6,>=5.4
  Downloading PyYAML-5.4.1.tar.gz (175 kB)
     |████████████████████████████████| 175 kB 63.8 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Collecting click==7.1.2
  Downloading click-7.1.2-py2.py3-none-any.whl (82 kB)
     |████████████████████████████████| 82 kB 2.3 MB/s 
Collecting pyOpenSSL<=22.1.0,>=17.5.0
  Downloading pyOpenSSL-22.1.0-py3-none-any.whl (57 kB)
     |████████████████████████████████| 57 kB 9.7 MB/s 
Collecting six>=1.15.0
  Downloading six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting prompt-toolkit==3.0.29
  Downloading prompt_toolkit-3.0.29-py3-none-any.whl (381 kB)
     |████████████████████████████████| 381 kB 80.6 MB/s 
Collecting jmespath==0.10.0
  Downloading jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Collecting python-dateutil<3.0.0,>=2.5.3
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     |████████████████████████████████| 247 kB 64.3 MB/s 
Collecting terminaltables==3.1.0
  Downloading terminaltables-3.1.0.tar.gz (12 kB)
Collecting oci==2.90.1
  Downloading oci-2.90.1-py2.py3-none-any.whl (18.7 MB)
     |████████████████████████████████| 18.7 MB 84.8 MB/s 
Collecting pytz>=2016.10
  Downloading pytz-2022.7-py2.py3-none-any.whl (499 kB)
     |████████████████████████████████| 499 kB 62.1 MB/s 
Collecting circuitbreaker<2.0.0,>=1.3.1
  Downloading circuitbreaker-1.4.0.tar.gz (9.7 kB)
Collecting cryptography<=39.0.0,>=3.2.1
  Downloading cryptography-38.0.4-cp36-abi3-manylinux_2_28_aarch64.whl (4.0 MB)
     |████████████████████████████████| 4.0 MB 39.9 MB/s 
Collecting wcwidth
  Downloading wcwidth-0.2.5-py2.py3-none-any.whl (30 kB)
Collecting cffi>=1.12
  Downloading cffi-1.15.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (449 kB)
     |████████████████████████████████| 449 kB 70.1 MB/s 
Collecting pycparser
  Downloading pycparser-2.21-py2.py3-none-any.whl (118 kB)
     |████████████████████████████████| 118 kB 62.4 MB/s 
Building wheels for collected packages: terminaltables, circuitbreaker, PyYAML
  Building wheel for terminaltables (setup.py) ... done
  Created wheel for terminaltables: filename=terminaltables-3.1.0-py3-none-any.whl size=15355 sha256=63f4ed52f7080b5e92f72b125a3ef55b5642ddbd6e142b02e386dccfedb960fe
  Stored in directory: /tmp/tmpou669a4w/wheels/0e/e1/98/126eccfa07627229dd8299be9445fcf626f52e636268996bb6
  Building wheel for circuitbreaker (setup.py) ... done
  Created wheel for circuitbreaker: filename=circuitbreaker-1.4.0-py3-none-any.whl size=7522 sha256=ab4d30057cd99070369d3c8fe44db802337774703268a69b767b3b22cb119159
  Stored in directory: /tmp/tmpou669a4w/wheels/3c/be/64/266b6ce2ef1130de5e419f04805acbb2df5a4ab1b91348f25b
  Building wheel for PyYAML (PEP 517) ... done
  Created wheel for PyYAML: filename=PyYAML-5.4.1-cp310-cp310-linux_aarch64.whl size=45658 sha256=c46268d44f9bddb5beae131a9c2e7c894b992095a9a9275e728134cdead73acf
  Stored in directory: /tmp/tmpou669a4w/wheels/c7/0d/22/696ee92245ad710f506eee79bb05c740d8abccd3ecdb778683
Successfully built terminaltables circuitbreaker PyYAML
Installing collected packages: pycparser, cffi, six, cryptography, wcwidth, pytz, python-dateutil, pyOpenSSL, circuitbreaker, certifi, terminaltables, PyYAML, prompt-toolkit, oci, jmespath, click, arrow, oci-cli
Successfully installed PyYAML-5.4.1 arrow-1.2.3 certifi-2022.12.7 cffi-1.15.1 circuitbreaker-1.4.0 click-7.1.2 cryptography-38.0.4 jmespath-0.10.0 oci-2.90.1 oci-cli-3.22.1 prompt-toolkit-3.0.29 pyOpenSSL-22.1.0 pycparser-2.21 python-dateutil-2.8.2 pytz-2022.7 six-1.16.0 terminaltables-3.1.0 wcwidth-0.2.5
WARNING: You are using pip version 21.1.3; however, version 22.3.1 is available.
You should consider upgrading via the '/home/ubuntu/lib/oracle-cli/bin/python -m pip install --upgrade pip' command.
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead

===> Modify profile to update your $PATH and enable shell/tab completion now? (Y/n): Y

===> Enter a path to an rc file to update (file will be created if it does not exist) (leave blank to use '/home/ubuntu/.bashrc'): 
-- Backed up '/home/ubuntu/.bashrc' to '/home/ubuntu/.bashrc.backup'
-- Tab completion set up complete.
-- If tab completion is not activated, verify that '/home/ubuntu/.bashrc' is sourced by your shell.
-- 
-- ** Run `exec -l $SHELL` to restart your shell. **
-- 
-- Installation successful.
-- Run the CLI with /home/ubuntu/bin/oci --help
hbirds1104@gmail.com
ocid1.user.oc1..aaaaaaaat5wishajickpzemuqswvnci227qbqj5ps6xeg3ou6b45mm27y3uq
hbirds1104
ocid1.tenancy.oc1..aaaaaaaalcb3gfcnqeafklwpmsuv4roq3yllzbp4ckldn3p365r5t2ktp6la
hbirds1104
ocid1.compartment.oc1..aaaaaaaaaac5pk3tlst7k6cwdzcmhdzoq7ea7e7ml74igmccdee2bqmsy3oq
ubuntu@viewdns-net:~$ exec -l $SHELL
ubuntu@viewdns-net:~$ oci -v
3.22.1
ubuntu@viewdns-net:~$ 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 [/home/ubuntu/.oci/config]: 
Enter a user OCID: ocid1.user.oc1..aaaaaaaat5wishajickpzemuqswvnci227qbqj5ps6xeg3ou6b45mm27y3uq
Enter a tenancy OCID: ocid1.tenancy.oc1..aaaaaaaalcb3gfcnqeafklwpmsuv4roq3yllzbp4ckldn3p365r5t2ktp6la
Enter a region by index or name(e.g.
1: af-johannesburg-1, 2: ap-chiyoda-1, 3: ap-chuncheon-1, 4: ap-dcc-canberra-1, 5: ap-hyderabad-1,
6: ap-ibaraki-1, 7: ap-melbourne-1, 8: ap-mumbai-1, 9: ap-osaka-1, 10: ap-seoul-1,
11: ap-singapore-1, 12: ap-sydney-1, 13: ap-tokyo-1, 14: ca-montreal-1, 15: ca-toronto-1,
16: eu-amsterdam-1, 17: eu-dcc-milan-1, 18: eu-frankfurt-1, 19: eu-madrid-1, 20: eu-marseille-1,
21: eu-milan-1, 22: eu-paris-1, 23: eu-stockholm-1, 24: eu-zurich-1, 25: il-jerusalem-1,
26: me-abudhabi-1, 27: me-dcc-muscat-1, 28: me-dubai-1, 29: me-jeddah-1, 30: mx-queretaro-1,
31: sa-santiago-1, 32: sa-saopaulo-1, 33: sa-vinhedo-1, 34: uk-cardiff-1, 35: uk-gov-cardiff-1,
36: uk-gov-london-1, 37: uk-london-1, 38: us-ashburn-1, 39: us-chicago-1, 40: us-gov-ashburn-1,
41: us-gov-chicago-1, 42: us-gov-phoenix-1, 43: us-langley-1, 44: us-luke-1, 45: us-phoenix-1,
46: us-sanjose-1): 9
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 [/home/ubuntu/.oci]: 
Enter a name for your key [oci_api_key]: 
Public key written to: /home/ubuntu/.oci/oci_api_key_public.pem
Enter a passphrase for your private key (empty for no passphrase): 
Private key written to: /home/ubuntu/.oci/oci_api_key.pem
Fingerprint: 11:81:1f:88:7f:10:2b:71:0c:06:d1:67:44:eb:d5:eb
Config written to /home/ubuntu/.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

Public鍵(oci_api_key_public.pem)確認

ubuntu@viewdns-net:~$ cat ~/.oci/*_public.pem
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkhQ8s4lRbBlLhRbPHIF/
lOIbGkIGWW1Volo84QCOkMP5dcZuduVoGjN2RC7FHwhtMujWpZp78lMOztMo1Ykw
Zk5o4Lh5UhnB/7ILdR9gSwb6D2uuRE9rRVwmahHC21qnD5eouggwT//rUTdrVaqe
4zh0h/rKRh4XuCpfuvJ/S7NIsd6pDkIwiz6/l165Dvs/IkiXw+D+EY3JeJV7Lju0
ObRYmxl8MxMQE13tYZ3SLhF/duS/olktMxn9MyQKl0m9DHN7dyhVmA5Cq0iHv6T5
pHOSUECDZ17Ep2u79X8H3OWDbw/CzY9KeoWEMwjixpIl0o64GJnb8WcSAuRspflV
AwIDAQAB
-----END PUBLIC KEY-----

以下の表示されたテキスト・ボックスの内容が~/.oci/configファイルに貼り付けられる。

[DEFAULT]
user=ocid1.user.oc1..aaaaaaaat5wishajickpzemuqswvnci227qbqj5ps6xeg3ou6b45mm27y3uq
fingerprint=11:81:1f:88:7f:10:2b:71:0c:06:d1:67:44:eb:d5:eb
tenancy=ocid1.tenancy.oc1..aaaaaaaalcb3gfcnqeafklwpmsuv4roq3yllzbp4ckldn3p365r5t2ktp6la
region=ap-osaka-1
key_file=<path to your private keyfile> # TODO
Copied title and URL