Oracle Cloud [OCI]: Create a CentOS Stream instance using Compute's cloud-init

There are various images available for Compute instances in Oracle Cloud, As of January 17, 2021, there is no CentOS Stream image available.

Therefore, create a Compute instance of CentOS8 and use CentOS Stream by updating with cloud-init. It was almost the same as when I created a Compute instance, and it was very easy to create.

In addition, this article is very easy to understand and I referred to how to use cloud-init when initializing OCI.

■ Articles that I referred to Complete the initial setup of OCI Compute with cloud-init

Work procedure

  1. Compute instance creation 1-1. Change image Select CentOS8 1-2. Networking configuration 1-3. Cloud-init settings
  2. Operation check

Services and technologies used this time

・ OCI Compute ・ Cloud-init ・ CentOS Stream

Author's environment

Mac OS X 10.15.7

1. Create a Compute instance

Create a Compute instance. This time, I created it with "VM.Standard.E3.Flex 1 core OCPU, 16 GB memory, 1 Gbps network bandwidth".

1-1. Image change

Select "CentOS 8" instead of the default "Oracle Linux 7.9".

cloud-init-centosstream1.jpg

1-2. Networking configuration

This time, we have selected the pre-registered VCN and public subnet and assigned a buprick IP address.

1-3. Cloud-init settings

Click Show Advanced Options to view the advanced options.

cloud-init-centosstream2.jpg

Select "Paste Cloud-init Script" under "Initialization Script" on the "Administration" tab of the extended options. Paste the following script in the input field of the cloud-init script.

Since cloud-init runs with root privileges, there is no problem without sudo. Since you will be prompted to enter [Y/N] during command execution, all [-y] options are added.

#!/bin/bash
dnf install centos-release-stream -y
dnf swap centos-{linux,stream}-repos -y
dnf distro-sync -y

After entering cloud-init, click "Create" and wait until the instance is created.

cloud-init-centosstream3.jpg

2. Operation check

The status of the instance became "Starting", and the operation was confirmed after a few minutes or more had passed.

Log in to the instance created by ssh. Enter the following command and confirm that "CentOS Stream release 8" is displayed.

cat /etc/centos-release
CentOS Stream release 8

The log when cloud-init is executed is saved in the following.

/var/log/cloud-init-output.log

If you check the log, the following log will be output, Since osmsplugin is a plugin used in Oracle Linux 6/7/8, it has no effect. Failed loading plugin "osmsplugin": No module named 'librepo'

When the following line is displayed, cloud-init processing is complete.

Cloud-init v. 19.4 running 'modules:final' at Sun, 17 Jan 2021 14:54:04 +0000. Up 28.87 seconds.
Cloud-init v. 19.4 finished at Sun, 17 Jan 2021 15:00:08 +0000. Datasource DataSourceOracle.  Up 393.38 seconds

reference

■ cloud-init official manual cloud-init Documentation

Repost

■ Articles that I referred to Complete the initial setup of OCI Compute with cloud-init

Recommended Posts

Oracle Cloud [OCI]: Create a CentOS Stream instance using Compute's cloud-init
[Oracle Cloud] Create a development environment for OCI Java SDK (Visual Studio Code, Maven, CentOS)
[Oracle Cloud] Install the free Oracle JDK 11 (LTS) on a virtual instance of OCI
[Android] Create a calendar using GridView
Create a Jetty project using Eclipse
Create a tomcat project using Eclipse
Create a Java project using Eclipse
Create a filtering function using acts-as-taggable-on
Deploy a Node.js application to an ECS instance using the Cloud Toolkit