
本記事の目的
前回の記事では、OCI ComputeにCLIをインストール・設定する方法を紹介しました。
DBaaSの場合は、少し癖があったのですが無事に設定できたので、同じくCLIを利用できるまでの設定手順を紹介してみます。
なお、本記事ではOCI上のDatabaseサービスを(以前のDBCSと区別するため)DBaaSと呼んでいます。
サマリー
もしかしたらプロビジョニング構成によって違うかもですが、私の環境では以下のようなハマリポイントがありました。
- 必要なパッケージが足りないので、デフォルトの状態だとQuickインストールが失敗する
- パッケージの追加インストールのためには、yumリポジトリの構成が必要
- pipをインストールするためにeasy_installを利用する手順となっているが、デフォルトでは利用できない
上記を考慮しつつ、必要パッケージを導入していくことで、最終的にはQuick Installでインストール成功しました。
注意(2019/5/12追記)
本ブログ記事では、あくまで検証用途として独自の手順でyumを操作していますが、DBaaSでOSのアップデートは規定の手順に従って行う必要がある旨がマニュアルに記載があるので注意してください。
Updating a DB System
This topic includes information and instructions on how to update the OS of a bare metal or virtual machine DB system.
Warning
Review all of the information before you begin updating the system. Updating the operating system through methods not described on this page can cause permanent loss of access.
Always back up your databases prior to updating your DB system’s operating system.
検証結果
検索性も考慮して、エラーメッセージや調査経緯も含めて記載。
環境確認
DBaaS VM環境
[opc@dbvmee ~]$ uname -a Linux dbvmee 4.1.12-112.16.7.el6uek.x86_64 #2 SMP Fri Apr 6 14:26:50 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux [opc@dbvmee ~]$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 6.9 (Santiago) [opc@dbvmee ~]$ python --version Python 2.6.6 ⇒phthon2.6.6がデフォルトでインストールされていた。 ※Computeで試した環境よりも低いバージョン。Pythonを予めアップデートするのもよいかも?
Quick Install
[opc@dbvmee ~]$ 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 101 6283 101 6283 0 0 28412 0 --:--:-- --:--:-- --:--:-- 235k Downloading Oracle Cloud Infrastructure CLI install script from https://raw.githubusercontent.com/oracle/oci-cli/6dc61e3b5fd2781c5afff2decb532c24969fa6bf/script s/install/install.py to /tmp/oci_cli_install_tmp_T2Zv. ######################################################################## 100.0% Running install script. python3 /tmp/oci_cli_install_tmp_T2Zv < /dev/tty Traceback (most recent call last): File "/tmp/oci_cli_install_tmp_T2Zv", line 21, in <module> import ssl File "/usr/local/lib/python3.6/ssl.py", line 101, in <module> import _ssl # if we can't import it, let the error propagate ModuleNotFoundError: No module named '_ssl'
⇒上記のようなエラーが出て、Quickインストールに失敗。
同様事象を探したが、バッチリの情報は見つからなかったので、手動インストールで試してみました。
手動インストール
手動インストールの流れは以下の通り。Quickインストールに比べるとステップが多い。
Step 1: Installing Python
Step 2: Installing and Configuring virtualenv
Step 3: Installing the Command Line Interface
まずは、以下のStep1の内容を順に実行していく。
Step 1: Installing Python
sudo yum install gcc libffi-devel python-devel openssl-devel
sudo easy_install pip
curl -O https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz
tar -xvzf Python-3.6.0.tgz
cd Python-3.6.0
./configure
make
sudo make install
※後述の通り、最終的にはこのStep1さえ実行してしまえば、残りはQuick Installの再実行で省略できました。
[opc@dbvmee ~]$ sudo yum install gcc libffi-devel python-devel openssl-devel Loaded plugins: kernel-update-handler, security, ulninfo Setting up Install Process No package libffi-devel available. No package python-devel available. No package openssl-devel available. Nothing to do
⇒上記3つのパッケージが見つからない?
[opc@dbvmee ~]$ rpm -qa | grep libffi-devel [opc@dbvmee ~]$
⇒インストールされていない。
[opc@dbvmee ~]$ rpm -qa | grep gcc libgcc-4.4.7-18.el6.x86_64 gcc-c++-4.4.7-18.el6.x86_64 gcc-4.4.7-18.el6.x86_64
⇒gccはインストールされている。
[opc@dbvmee ~]$ sudo yum install libffi-devel Loaded plugins: kernel-update-handler, security, ulninfo Setting up Install Process No package libffi-devel available. Error: Nothing to do
⇒個別で指定してもNG
[opc@dbvmee ~]$ yum version Loaded plugins: kernel-update-handler, security, ulninfo Installed: 6Server/x86_64 529:31e8ff06dbd632f1d3c1e63609b8881c255367ff Group-Installed: yum 14:818d67dd5084f6ea39b2316b01c869891a510a24 version [opc@dbvmee ~]$ yum repolist Loaded plugins: kernel-update-handler, security, ulninfo repolist: 0
⇒yumリポジトリが構成されていない!
OCI : How to configure yum Repository in OCI Instance (Doc ID 2444552.1)
上記記事を参考に、yumリポジトリを構成してみる。
[opc@dbvmee ~]$ sudo -s [root@dbvmee opc]# cd /etc/yum.repos.d/ [root@dbvmee yum.repos.d]# ls -l total 0 [root@dbvmee yum.repos.d]# wget http://yum-phx.oracle.com/yum-phx-ol6.repo --2019-01-19 07:07:43-- http://yum-phx.oracle.com/yum-phx-ol6.repo Resolving yum-phx.oracle.com... 129.146.100.180 Connecting to yum-phx.oracle.com|129.146.100.180|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 14611 (14K) [application/octet-stream] Saving to: `yum-phx-ol6.repo' 100%[===========================================================================================>] 14,611 --.-K/s in 0s 2019-01-19 07:07:43 (574 MB/s) - `yum-phx-ol6.repo' saved [14611/14611] [root@dbvmee yum.repos.d]# ls -latr total 24 -rw-r--r-- 1 root root 14611 Oct 17 22:13 yum-phx-ol6.repo drwxr-xr-x 86 root root 4096 Jan 18 05:02 .. drwxr-xr-x 2 root root 4096 Jan 19 07:07 . [root@dbvmee yum.repos.d]# yum --version 3.2.29 Installed: rpm-4.8.0-55.el6.x86_64 at 2018-06-03 00:23 Built : None at 2016-05-11 05:53 Committed: Lubos Kardos <lkardos@redhat.com> at 2016-03-29 Installed: yum-3.2.29-81.0.1.el6.noarch at 2018-06-03 00:35 Built : None at 2017-01-12 03:24 Committed: EL Errata <el-errata_ww@oracle.com> at 2017-01-08 [root@dbvmee yum.repos.d]# cd [root@dbvmee ~]# yum repolist Loaded plugins: kernel-update-handler, security, ulninfo ol6_UEKR4 | 2.5 kB 00:00 ol6_UEKR4/primary_db | 3.9 MB 00:00 ol6_addons | 2.5 kB 00:00 ol6_addons/primary_db | 150 kB 00:00 ol6_developer | 2.5 kB 00:00 ol6_developer/primary_db | 121 kB 00:00 ol6_latest | 3.0 kB 00:00 ol6_latest/primary_db | 9.8 MB 00:00 ol6_software_collections | 2.5 kB 00:00 ol6_software_collections/primary_db | 3.5 MB 00:00 repo id repo name status ol6_UEKR4 Latest Unbreakable Enterprise Kernel Release 4 for Oracle Linux 6Server (x86_64) 135 ol6_addons Oracle Linux 6Server Add ons (x86_64) 402 ol6_developer Oracle Linux 6Server Packages for Development and test (x86_64) 61 ol6_latest Oracle Linux 6Server Latest (x86_64) 11417 ol6_software_collections Software Collection Library release 2.4 packages for Oracle Linux 6 (x86_64) 10744 repolist: 22759
⇒yumリポジトリが利用可能に。
・必要パッケージの再インストール
[root@dbvmee ~]# sudo yum install gcc libffi-devel python-devel openssl-devel (中略) Installed: libffi-devel.x86_64 0:3.0.5-3.2.el6 openssl-devel.x86_64 0:1.0.1e-57.0.6.el6 python-devel.x86_64 0:2.6.6-66.0.1.el6_8 Dependency Installed: keyutils-libs-devel.x86_64 0:1.4-5.0.1.el6 krb5-devel.x86_64 0:1.10.3-65.el6 libcom_err-devel.x86_64 0:1.42.8-1.0.3.el6 libkadm5.x86_64 0:1.10.3-65.el6 libselinux-devel.x86_64 0:2.0.94-7.el6 libsepol-devel.x86_64 0:2.0.41-4.el6 zlib-devel.x86_64 0:1.2.3-29.el6 Updated: gcc.x86_64 0:4.4.7-23.0.1.el6 Dependency Updated: cpp.x86_64 0:4.4.7-23.0.1.el6 gcc-c++.x86_64 0:4.4.7-23.0.1.el6 libgcc.x86_64 0:4.4.7-23.0.1.el6 libgomp.x86_64 0:4.4.7-23.0.1.el6 libstdc++.x86_64 0:4.4.7-23.0.1.el6 libstdc++-devel.x86_64 0:4.4.7-23.0.1.el6 openssl.x86_64 0:1.0.1e-57.0.6.el6 Complete!
⇒今度は成功。
pipのインストール
[root@dbvmee ~]# sudo easy_install pip sudo: easy_install: command not found [root@dbvmee ~]# yum install pip Loaded plugins: kernel-update-handler, security, ulninfo Setting up Install Process No package pip available. Error: Nothing to do
⇒今度はeasy_installが見つからないエラーで、pipがインストールできない。
easy_installはpython-setuptoolsパッケージを入れると使えるようなので、試してみる。
[root@dbvmee ~]# yum install python-setuptools (省略) [root@dbvmee ~]# easy_install pip Searching for pip Reading https://pypi.python.org/simple/pip/ (省略) Adding pip 18.1 to easy-install.pth file Installing pip script to /usr/bin Installing pip2.6 script to /usr/bin Installing pip2 script to /usr/bin Installed /usr/lib/python2.6/site-packages/pip-18.1-py2.6.egg Processing dependencies for pip Finished processing dependencies for pip
⇒pipインストール成功
pythonインストール
[root@dbvmee ~]# cd /usr/local/src/ [root@dbvmee ~]# curl -O https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz [root@dbvmee ~]# tar -xvzf Python-3.6.0.tgz [root@dbvmee ~]# cd Python-3.6.0 [root@dbvmee ~]# ./configure [root@dbvmee ~]# make [root@dbvmee ~]# sudo make install
ここは特に問題ないので実行結果は割愛。
Quick Installの再実行
必要パッケージさえあれば、Quick Installが成功する?と思い、試したところ無事にインストール成功。
[opc@dbvme ~]$ pwd /home/opc [opc@dbvm1 ~]$ bash -c "$(curl -L https://raw.githubusercontent.com/oracle/oci-cli/master/scripts/install/install.sh)" (省略) ===> 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
⇒インストール成功!
ociバージョン確認
[opc@dbvmee ~]$ oci -v Traceback (most recent call last): File "/home/opc/bin/oci", line 11, in sys.exit(cli()) File "/home/opc/lib/oracle-cli/lib/python3.6/site-packages/click/core.py", line 722, in __call__ return self.main(*args, **kwargs) File "/home/opc/lib/oracle-cli/lib/python3.6/site-packages/click/core.py", line 676, in main _verify_python3_env() File "/home/opc/lib/oracle-cli/lib/python3.6/site-packages/click/_unicodefun.py", line 118, in _verify_python3_env 'for mitigation steps.' + extra) RuntimeError: Click will abort further execution because Python 3 was configured to use ASCII as encoding for the environment. Consult http://click.pocoo.org/python3/for mitigation steps. This system lists a couple of UTF-8 supporting locales that you can pick from. The following suitable locales where discovered: aa_DJ.utf8, aa_ER.utf8, aa_ET.utf8, af_ZA.utf8, am_ET.utf8, an_ES.utf8, ar_AE.utf8, ar_BH.utf8, ar_DZ.utf8, ar_EG.utf8, ar_IN.utf8, ar_IQ.utf8, ar_JO.utf8, ar_KW.utf8, ar_LB.utf8, ar_LY.utf8, ar_MA.utf8, ar_OM.utf8, ar_QA.utf8, ar_SA.utf8, ar_SD.utf8, ar_SY.utf8, ar_TN.utf8, ar_YE.utf8, as_IN.utf8, ast_ES.utf8, az_AZ.utf8, be_BY.utf8, ber_DZ.utf8, ber_MA.utf8, bg_BG.utf8, bn_BD.utf8, bn_IN.utf8, bo_CN.utf8, bo_IN.utf8, br_FR.utf8, bs_BA.utf8, byn_ER.utf8, ca_AD.utf8, ca_ES.utf8, ca_FR.utf8, ca_IT.utf8, crh_UA.utf8, cs_CZ.utf8, csb_PL.utf8, cv_RU.utf8, cy_GB.utf8, da_DK.utf8, de_AT.utf8, de_BE.utf8, de_CH.utf8, de_DE.utf8, de_LU.utf8, dv_MV.utf8, dz_BT.utf8, el_CY.utf8, el_GR.utf8, en_AG.utf8, en_AU.utf8, en_BW.utf8, en_CA.utf8, en_DK.utf8, en_GB.utf8, en_HK.utf8, en_IE.utf8, en_IN.utf8, en_NG.utf8, en_NZ.utf8, en_PH.utf8, en_SG.utf8, en_US.utf8, en_ZA.utf8, en_ZW.utf8, es_AR.utf8, es_BO.utf8, es_CL.utf8, es_CO.utf8, es_CR.utf8, es_DO.utf8, es_EC.utf8, es_ES.utf8, es_GT.utf8, es_HN.utf8, es_MX.utf8, es_NI.utf8, es_PA.utf8, es_PE.utf8, es_PR.utf8, es_PY.utf8, es_SV.utf8, es_US.utf8, es_UY.utf8, es_VE.utf8, et_EE.utf8, eu_ES.utf8, fa_IR.utf8, fi_FI.utf8, fil_PH.utf8, fo_FO.utf8, fr_BE.utf8, fr_CA.utf8, fr_CH.utf8, fr_FR.utf8, fr_LU.utf8, fur_IT.utf8, fy_DE.utf8, fy_NL.utf8, ga_IE.utf8, gd_GB.utf8, gez_ER.utf8, gez_ET.utf8, gl_ES.utf8, gu_IN.utf8, gv_GB.utf8, ha_NG.utf8, he_IL.utf8, hi_IN.utf8, hne_IN.utf8, hr_HR.utf8, hsb_DE.utf8, ht_HT.utf8, hu_HU.utf8, hy_AM.utf8, id_ID.utf8, ig_NG.utf8, ik_CA.utf8, is_IS.utf8, it_CH.utf8, it_IT.utf8, iu_CA.utf8, iw_IL.utf8, ja_JP.utf8, ka_GE.utf8, kk_KZ.utf8, kl_GL.utf8, km_KH.utf8, kn_IN.utf8, ko_KR.utf8, kok_IN.utf8, ks_IN.utf8, ku_TR.utf8, kw_GB.utf8, ky_KG.utf8, lg_UG.utf8, li_BE.utf8, li_NL.utf8, lo_LA.utf8, lt_LT.utf8, lv_LV.utf8, mai_IN.utf8, mg_MG.utf8, mi_NZ.utf8, mk_MK.utf8, ml_IN.utf8, mn_MN.utf8, mr_IN.utf8, ms_MY.utf8, mt_MT.utf8, my_MM.utf8, nb_NO.utf8, nds_DE.utf8, nds_NL.utf8, ne_NP.utf8, nl_AW.utf8, nl_BE.utf8, nl_NL.utf8, nn_NO.utf8, no_NO.utf8, nr_ZA.utf8, nso_ZA.utf8, oc_FR.utf8, om_ET.utf8, om_KE.utf8, or_IN.utf8, pa_IN.utf8, pa_PK.utf8, pap_AN.utf8, pl_PL.utf8, ps_AF.utf8, pt_BR.utf8, pt_PT.utf8, ro_RO.utf8, ru_RU.utf8, ru_UA.utf8, rw_RW.utf8, sa_IN.utf8, sc_IT.utf8, sd_IN.utf8, se_NO.utf8, shs_CA.utf8, si_LK.utf8, sid_ET.utf8, sk_SK.utf8, sl_SI.utf8, so_DJ.utf8, so_ET.utf8, so_KE.utf8, so_SO.utf8, sq_AL.utf8, sq_MK.utf8, sr_ME.utf8, sr_RS.utf8, ss_ZA.utf8, st_ZA.utf8, sv_FI.utf8, sv_SE.utf8, ta_IN.utf8, te_IN.utf8, tg_TJ.utf8, th_TH.utf8, ti_ER.utf8, ti_ET.utf8, tig_ER.utf8, tk_TM.utf8, tl_PH.utf8, tn_ZA.utf8, tr_CY.utf8, tr_TR.utf8, ts_ZA.utf8, tt_RU.utf8, ug_CN.utf8, uk_UA.utf8, ur_IN.utf8, ur_PK.utf8, ve_ZA.utf8, vi_VN.utf8, wa_BE.utf8, wal_ET.utf8, wo_SN.utf8, xh_ZA.utf8, yi_US.utf8, yo_NG.utf8, zh_CN.utf8, zh_HK.utf8, zh_SG.utf8, zh_TW.utf8, zu_ZA.utf8
⇒バージョン確認しようとすると、上記メッセージが。まだ問題が?!
[opc@dbvmee ~]$ echo $LANG [opc@dbvmee ~]$ export LANG=ja_JP.utf8 [opc@dbvmee ~]$ oci -v 2.4.41
⇒環境変数LANGを設定したところ、無事にバージョン確認成功。
あとは、OCI Computeと同様にOCI configで設定すれば利用可能となるので、割愛。
ようやくDBaas環境へのCLIインストール&設定が完了。
※次はCLIコマンドを触ってみた記事を書く予定。
参考情報
・Command Line Interface (CLI)
https://docs.cloud.oracle.com/iaas/Content/API/Concepts/cliconcepts.htm
・[OCI]: How to Install and Configure Command Line Interface For Oracle Cloud Infrastructure In Linux (Doc ID 2432759.1)
https://support.oracle.com/knowledge/Oracle%20Cloud/2432759_1.html
・OCI : How to configure yum Repository in OCI Instance (Doc ID 2444552.1)
https://support.oracle.com/knowledge/Oracle%20Cloud/2444552_1.html
Leave a Reply