
本記事の目的
コマンド・ライン・インタフェース(CLI)は、Oracle Cloud Infrastructureオブジェクトおよびサービスを操作できるツールです。
ローカル端末などにインストールしておけば、サービスコンソールにログインせずにサービスの状態確認や起動停止が出来て便利です。
今回はOCI Compute上のLinux環境にCLIをインストール・設定する手順を確認してみました。
サマリー
最初に結論ですが、後述の環境であれば、マニュアルに沿ってQuickInstallの手順(シェル一発)で簡単にインストールできます。
設定手順もマニュアルもしくは公式ブログの記事(後述)に沿って設定すれば、問題ないはず。
検証結果
・環境確認
[opc@node1 ~]$ uname -a Linux node1 4.14.35-1818.5.4.el7uek.x86_64 #2 SMP Mon Dec 3 20:51:20 PST 2018 x86_64 x86_64 x86_64 GNU/Linux [opc@node1 ~]$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.6 (Maipo) [opc@node1 ~]$ python --version Python 2.7.5 ⇒phthon2.7.5がデフォルトでインストールされていた。
・Quick Install
[opc@node1 ~]$ bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)" (途中省略) [opc@node1 ~]$ oci -v 2.4.41
質問にはデフォルトで答えておけばOK。
・oci setup config
公式ブログ記事を参照して、以下の手順を実施していけばOK
3-1. 設定ファイルとAPIキーの生成
3-2. APIキーのアップロード
3-3. CLIからのアクセスの確認
3-4. デフォルトコンパートメント値の設定
既に別環境で作ったのと同じAPIキーを使うのであれば、3-1の前にComputeノードの任意のフォルダににアップロードしておくことで、3-1の一部と、3-2の手順はスキップ可能。
※「Do you want to generate a new RSA key pair? (If you decline you will be asked to supply the path to an existing key.) [Y/n]: 」でnを選択する
・動作確認
こんな風にシェイプ一覧が表示されればOK
[opc@node1 .oci]$ oci compute shape list { "data": [ { "shape": "BM.Standard2.52" }, { "shape": "BM.Standard.E2.64" }, { "shape": "BM.DenseIO2.52" }, { "shape": "BM.GPU2.2" }, { "shape": "BM.Standard1.36" }, { "shape": "BM.HighIO1.36" }, { "shape": "BM.DenseIO1.36" }, { "shape": "VM.Standard2.1" }, { "shape": "VM.Standard2.2" }, { "shape": "VM.Standard2.4" }, { "shape": "VM.Standard2.8" }, { "shape": "VM.Standard2.16" }, { "shape": "VM.Standard2.24" }, { "shape": "VM.Standard.E2.1" }, { "shape": "VM.Standard.E2.2" }, { "shape": "VM.Standard.E2.4" }, { "shape": "VM.Standard.E2.8" }, { "shape": "VM.DenseIO2.8" }, { "shape": "VM.DenseIO2.16" }, { "shape": "VM.DenseIO2.24" }, { "shape": "VM.Standard1.1" }, { "shape": "VM.Standard1.2" }, { "shape": "VM.Standard1.4" }, { "shape": "VM.Standard1.8" }, { "shape": "VM.Standard1.16" }, { "shape": "VM.DenseIO1.4" }, { "shape": "VM.DenseIO1.8" }, { "shape": "VM.DenseIO1.16" }, { "shape": "BM.Standard2.52" }, { "shape": "BM.Standard.E2.64" }, { "shape": "BM.DenseIO2.52" }, { "shape": "BM.HPC2.36" }, { "shape": "BM.Standard1.36" }, { "shape": "BM.HighIO1.36" }, { "shape": "BM.DenseIO1.36" }, { "shape": "VM.Standard2.1" }, { "shape": "VM.Standard2.2" }, { "shape": "VM.Standard2.4" }, { "shape": "VM.Standard2.8" }, { "shape": "VM.Standard2.16" }, { "shape": "VM.Standard2.24" }, { "shape": "VM.Standard.E2.1" }, { "shape": "VM.Standard.E2.2" }, { "shape": "VM.Standard.E2.4" }, { "shape": "VM.Standard.E2.8" }, { "shape": "VM.DenseIO2.8" }, { "shape": "VM.DenseIO2.16" }, { "shape": "VM.DenseIO2.24" }, { "shape": "VM.Standard1.1" }, { "shape": "VM.Standard1.2" }, { "shape": "VM.Standard1.4" }, { "shape": "VM.Standard1.8" }, { "shape": "VM.Standard1.16" }, { "shape": "VM.DenseIO1.4" }, { "shape": "VM.DenseIO1.8" }, { "shape": "VM.DenseIO1.16" }, { "shape": "BM.Standard2.52" }, { "shape": "BM.Standard.E2.64" }, { "shape": "BM.DenseIO2.52" }, { "shape": "BM.Standard1.36" }, { "shape": "BM.HighIO1.36" }, { "shape": "BM.DenseIO1.36" }, { "shape": "VM.Standard2.1" }, { "shape": "VM.Standard2.2" }, { "shape": "VM.Standard2.4" }, { "shape": "VM.Standard2.8" }, { "shape": "VM.Standard2.16" }, { "shape": "VM.Standard2.24" }, { "shape": "VM.Standard.E2.1" }, { "shape": "VM.Standard.E2.2" }, { "shape": "VM.Standard.E2.4" }, { "shape": "VM.Standard.E2.8" }, { "shape": "VM.DenseIO2.8" }, { "shape": "VM.DenseIO2.16" }, { "shape": "VM.DenseIO2.24" }, { "shape": "VM.Standard1.1" }, { "shape": "VM.Standard1.2" }, { "shape": "VM.Standard1.4" }, { "shape": "VM.Standard1.8" }, { "shape": "VM.Standard1.16" }, { "shape": "VM.DenseIO1.4" }, { "shape": "VM.DenseIO1.8" }, { "shape": "VM.DenseIO1.16" } ] }
参考情報
・Command Line Interface (CLI)
https://docs.cloud.oracle.com/iaas/Content/API/Concepts/cliconcepts.htm
・Oracle Cloud 公式ブログ:コマンドライン(CLI)でOCIを操作する – Oracle Cloud Infrastructureアドバンスド
https://community.oracle.com/docs/DOC-1019624#jive_content_id_2_Oracle_Cloud_Infrastructure_CLI
・Oracle Cloud : コマンド・ライン・インタフェース(CLI) をインストールしてみた
https://qiita.com/shirok/items/e63be9a22158fef10ba9
Leave a Reply