今まで作成してきた仮想マシンを、Oracle Cloud Infrastructureのコンピュート・インスタンスとして動作させます。Oracle Cloudにアカウントがあり、仮想クラウド・ネットワークが構成されていることを前提としています。
今までは無料の範囲で作業ができましたが、カスタム・イメージの作成やコンピュート・インスタンスの作成(今回はVM.Standard.E4.Flex 1OCPU, 4GBメモリ)には費用がかかります。アカウントもアップグレードされている必要があります。
VM.Standard.E4.Flex 1OCPU 4GBの月額利用料は、全く停止させずに744時間使用して3千円程度になります。
仮想マシンが停止している状態から作業を始めます。
2023年5月18日追記以下の作業をあらかじめ実施してカスタム・イメージに含めておくと、コンピュート・インスタンスの作成後の作業を減らすことができます。
仮想マシンのエクスポート
エクスポートする仮想マシンを選択します。今回の作業で作成しているのはOracleAPEXです。
% ls -l OracleAPEX.ovf OracleAPEX-disk001.vmdk
-rw-r--r-- 1 ******** staff 8647028736 11 18 17:17 OracleAPEX-disk001.vmdk
-rwx------ 1 ******** staff 8067 11 18 17:10 OracleAPEX.ovf
%
VMDKファイルのアップロード
カスタム・イメージの作成
コンピュート・インスタンスの作成
% ssh -i 秘密キー・ファイル opc@***.***.***.***
The authenticity of host '***.***.***.*** (***.***.***.***)' can't be established.
ED25519 key fingerprint is SHA256:sgFPo6M0S8zAEFLVFkvWVJMmd0jcGJBRCdE817jZEl0.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '***.***.***.***' (ED25519) to the list of known hosts.
[opc@apex ~]$
以上でVirtualBoxの仮想マシンを元にした、Oracle Cloud Infrastructureのコンピュート・インスタンスの作成および実行ができました。
Oracle Cloud Agentのインストール
[root@apex vars]# cat ociregion
-us-ashburn-1
[root@apex vars]# cat ocidomain
oracle.com
[root@apex vars]#
dnf install oci-included-release-el8
[root@apex ~]# dnf install oci-included-release-el8
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:19:26 ago on Tue May 23 12:58:20 2023.
No match for argument: oci-included-release-el8
Error: Unable to find a match: oci-included-release-el8
[root@apex ~]#
直接/etc/yum.repos.d/以下にol8-included-ol8.repoを作成します。以下の内容を記述します。
[ol8_oci_included]
name=Oracle Software for OCI users on Oracle Linux $releasever ($basearch)
baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/oci/included/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
[root@apex yum.repos.d]# cat ol8-included-ol8.repo
[ol8_oci_included]
name=Oracle Software for OCI users on Oracle Linux $releasever ($basearch)
baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL8/oci/included/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1
[root@apex yum.repos.d]#
dnf -y install oracle-cloud-agent
[root@apex ~]# dnf -y install oracle-cloud-agent
Failed to set locale, defaulting to C.UTF-8
Oracle Software for OCI users on Oracle Linux 64 MB/s | 82 MB 00:01
Last metadata expiration check: 0:00:31 ago on Tue May 23 13:23:01 2023.
Dependencies resolved.
===============================================================================
Package Arch Version Repository Size
===============================================================================
Installing:
oracle-cloud-agent x86_64 1.31.0-8769.el8 ol8_oci_included 119 M
Transaction Summary
===============================================================================
Install 1 Package
Total download size: 119 M
Installed size: 340 M
Downloading Packages:
oracle-cloud-agent-1.31.0-8769.el8.x86_64.rpm 40 MB/s | 119 MB 00:02
-------------------------------------------------------------------------------
Total 40 MB/s | 119 MB 00:03
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
[中略]
post install: starting services
Verifying : oracle-cloud-agent-1.31.0-8769.el8.x86_64 1/1
Installed:
oracle-cloud-agent-1.31.0-8769.el8.x86_64
Complete!
[root@apex ~]#