Oracle Compute Cloud – CLI configuration

0
1670

How to install CLI (Command Line Interface)

System Requirements

  • Python 2 (2.6.6 or later) must be pre-installed.
  • The python-dateutil module is required and it is installed automatically when you use yum.

Installing the Oracle Compute Cloud Service CLI

To install the Oracle Compute Cloud Service:

  1. Download the CLI installation bundle (.zip file) from http://www.oracle.com/technetwork/topics/cloud/downloads/index.html#opccli
  2. Unzip the CLI installation bundle.
    # unzip opc-cli-RELEASE.zip
    

    Where RELEASE indicates the release version of the CLI tool: 1.0.0 or 1.1.0.

    Three files are extracted:

    Archive:  opc-cli-RELEASE.zip
      inflating: README
      inflating: opc-cli-RELEASE.noarch.rpm
      inflating: opc-cli-RELEASE-py2.6.egg
    
  3. Go to the directory in which you extracted the ZIP file.
  4. Install the RPM file. To ensure that all the dependencies are satisfied, use yum.
    # sudo yum install ./opc-cli-RELEASE.noarch.rpm
    

    All the dependencies are verified and fulfilled by yum.

    On other Unix platforms running Python 2.6:

    # sudo easy_install opc_cli-RELEASE_py2.6.egg

    On other Unix platforms running Python 2.7:

    # sudo easy_install python-dateutil
    # sudo easy_install opc_cli_RELEASE_py2.6.egg
  5. When prompted, enter y, and then press Enter. The packages are downloaded onto your machine.
  6. Wait till you see the Complete! message.The Oracle Compute Cloud Service CLI is installed.
  7. Perform the steps described in Setting Up the Required Environment Variables and Files.

Setting Up the Required Environment Variables and Files

On the host on which you installed the CLI client, do the following:

  1. Store the REST API endpoint URL of your Oracle Compute Cloud Service site in an environment variable named OPC_API. If you don’t do this, then you must explicitly specify the endpoint URL in every command, by using the -a option.
    The REST API endpoint URL of your site is locate to the Compute DashBoard

    oraclecloud-compute

    You can set the environment variable from the Bash shell as shown in the following example:

    # export OPC_API="https://api-z999.compute.us0.oraclecloud.com"
    
  2. Store your two-part user name (/Compute-identity_domain/user) in an environment variable named OPC_USER. If you don’t do this, then you must explicitly specify the user in every command, by using the -u option.

    You can set the environment variable from the Bash shell as shown in the following example:

    export OPC_USER=/Compute-smeretech/[email protected]
    

    The account creation email from Oracle would contain the identity domain name, user name, and password for your Oracle Compute Cloud Service instance.

Access to Compute Service

# oracle-compute auth /Compute-smeretech/[email protected] -
Password for /Compute-smeretech/[email protected]:
#

After the request of Password, the Compute service release a token. The token time limit is 30 minutes.

Refresh Token

# oracle-compute refresh_token