Forcing Oracle Cloud Agent into AlmaLinux 9

table of contents
Hello, this is Kitada from Beyond Co., Ltd.
This time, I will explain how to install Oracle Cloud Agent on AlmaLinux 9.
*The method described in this article is not officially recommended, so we cannot take any responsibility for any issues.
Please also note that the document information may differ from the current situation as of the time of writing (May 1, 2024).
background
At Beyond, we are currently training new graduates on how to set up environments on various clouds. We were trying to install the Oracle Cloud Agent to monitor an instance created with AlmaLinux 9, the successor to CentOS
No match for argument: oracle-cloud-agent
I got an error message, and when I looked at the official documentation, it seemed like AlmaLinux9 was not supported..
Oracle Cloud Agent: Oracle Cloud Agent is supported on the current platform image custom images based on the current platform image Oracle Cloud Agent is installed by default on the current platform image.
If you are using an older platform image, Oracle Cloud Agent software. Select an image dated after November 15, 2018. (For Ubuntu, it must be dated after February 28, 2019.)
Oracle Cloud Agent on other images , this has not been tested on other operating systems and is not guaranteed to work.
〇 Citation: https://docs.oracle.com/ja-jp/iaas/Content/Compute/Tasks/manage-plugins.htm#manage-plugins
As stated in the documentation, it may be possible to install Oracle Cloud Agent on other images, but as this has not been tested, their operation cannot be guaranteed .

Also, when I looked into the official documentation a little more, I found that it said
, "To obtain the Oracle Cloud Agent installation file, please contact support." However, I really wanted to install it this time, so I decided to force it.
First of all, what is Oracle Cloud Agent?
Oracle Cloud Agent is a lightweight process that manages plugins running on Compute instances in Oracle Cloud Infrastructure (OCI).
The plugins collect performance metrics, install OS updates, and perform other instance management tasks.
To use plugins on your instances, Oracle Cloud Agent software on the instance, enable the plugins, and run each plugin. You might need to perform additional configuration tasks before you can use a particular plugin.
This time we want to "monitor compute instances," please check the prerequisites
procedure
1. Add a repository
First, check before installation
# sudo dnf info oracle-cloud-agent Last metadata expiration check: 0:18:11 ago on Wed May 1 05:36:04 2024. Error: No matching Packages to list
Since there is no repository, it will say "No matching Packages to list."
The repository information is specified in the files under /etc/yum.repo.d, so we will place the files directly there
# sudo vi /etc/yum.repos.d/oci-included-ol9.repo
[ol9_oci_included] name=Oracle Linux $releasever OCI Included Packages ($basearch) baseurl=https://yum-phx.oracle.com/repo/OracleLinux/OL9/oci/included/$basearch/ gpgcheck=1 priority=1 enabled=1
The contents to be written look like this.
In this case, the base URL refers to the Oracle Linux 9 package.
Also, please change the priority according to your environment.
As the GPG key is not a supported distribution, it is not under /etc/pki/rpm-gpg/, so we will import it directly.
# sudo rpm --import https://yum.oracle.com/RPM-GPG-KEY-oracle-ol9
Reference: https://linux.oracle.com/security/gpg/
If you can import it, it's OK
2. Installing required modules
If the librepo module required to load the "osmsplugin" plugin is missing before installing the Agent, the following error will be displayed
Failed loading plugin "osmsplugin": No module named 'librepo'
So, install the module with the following command:
# sudo dnf install python3-librepo
Failed loading plugin "osmsplugin": No module named 'librepo' Last metadata expiration check: 0:53:43 ago on Wed May 1 07:24:35 2024. Dependencies resolved. ============================================================ ============================================================ ============================================================ ============================================================ Package Architecture Version Repository Size ============================================================ ============================================================ ============================================================ ============================================================ Installing: python3-librepo x86_64 1.14.5-1.el9 baseos 49k Transaction Summary ============================================================ ============================================================ ============================================================ ============================================================ Install 1 Package Total download size: 49 k Installed size: 183 k Is this ok [y/N]: y Downloading Packages: python3-librepo-1.14.5-1.el9.x86_64.rpm 1.9 MB/s | 49 kB 00:00 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 57 kB/s | 49 kB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : python3-librepo-1.14.5-1.el9.x86_64 1/1 Running scriptlet: python3-librepo-1.14.5-1.el9.x86_64 1/1 Verifying : python3-librepo-1.14.5-1.el9.x86_64 1/1 Installed: python3-librepo-1.14.5-1.el9.x86_64 Complete!
Once the module is installed, install the Oracle Cloud Agent
3. Install Oracle Cloud Agent
# sudo dnf install oracle-cloud-agent
Last metadata expiration check: 0:02:16 ago on Wed May 1 07:24:35 2024. Dependencies resolved. ============================================================ ============================================================ ============================================================ ============================================================ Package Architecture Version Repository Size ============================================================ ============================================================ ============================================================ ============================================================ Installing: oracle-cloud-agent x86_64 1.40.0-11632.el9 ol9_oci_included 127 M</pre> Transaction Summary ============================================================ ============================================================ ============================================================ ============================================================ Install 1 Package Total download size: 127 M Installed size: 360 M Is this ok [y/N]: y Downloading Packages: oracle-cloud-agent-1.40.0-11632.el9.x86_64.rpm 15 MB/s | 127 MB 00:08 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 15 MB/s | 127 MB 00:08 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: oracle-cloud-agent-1.40.0-11632.el9.x86_64 1/1 Installing : oracle-cloud-agent-1.40.0-11632.el9.x86_64 1/1 Running scriptlet: oracle-cloud-agent-1.40.0-11632.el9.x86_64 1/1 Changing ownership of agent.yml* files to oracle-cloud-agent:oracle-cloud-agent Changing ownership of /var/log/oracle-cloud-agent/updater.log to oracle-cloud-agent-updater:adm Setting capabilities on bastions plugin 2024/05/01 07:53:02 Capability set on filePath: /usr/libexec/oracle-cloud-agent/plugins/bastions = [1 0 0 10 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] 2024/05/01 07:53:02 Capability set on filePath: 20 = [1 0 0 10 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] 2024/05/01 07:53:02 Capability set properly : [1 0 0 10 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] Changing ownership of /var/lib/ocarun/db/runcommand.db to ocarun:oracle-cloud-agent post install: starting services Verifying : oracle-cloud-agent-1.40.0-11632.el9.x86_64 1/1 Installed: oracle-cloud-agent-1.40.0-11632.el9.x86_64 Complete!
4. Check after installation
Once the installation is complete, we will check each step.
First, check that the installation was successful.
# sudo dnf list installed | grep "oracle-cloud-agent"
oracle-cloud-agent.x86_64 1.40.0-11632.el9 @ol9_oci_included
If it has been installed from the repository you placed, then it's OK.
Next, check that the program starts.
# sudo systemctl status oracle-cloud-agent.service
● oracle-cloud-agent.service - Oracle Cloud Infrastructure agent for management and monitoring Loaded: loaded (/etc/systemd/system/oracle-cloud-agent.service; enabled; preset: disabled) Active: active (running) since Wed 2024-05-01 08:12:01 UTC; 28min ago Docs: https://docs.cloud.oracle.com/iaas/ Main PID: 4071 (agent) Tasks: 25 (limit: 48708) Memory: 38.8M CPU: 1.948s CGroup: /oca.slice/oracle-cloud-agent.service tq4071 /usr/libexec/oracle-cloud-agent/agent tq4081 /usr/libexec/oracle-cloud-agent/plugins/gomon/gomon mq4118 /usr/libexec/oracle-cloud-agent/plugins/oci-wlp/oci-wlp
If it says running then it's running
Finally, let's check if we can get the value from the console
■ Before installation
■ After installation

The value is definitely there!
That's how to forcefully install Oracle Cloud Agent on AlmaLinux 9.
However, I think it's only a matter of time before official support is provided, so I hope you find this information useful!
6