Cuenta Iniciar sesión

The convert2rhel tool makes it possible to convert an operating system that is CentOS or Oracle Linux to Red Hat Enterprise Linux (RHEL).

For converting from these operating systems, the supported source version is the latest one, at the time of this writing it was 7.9 or 8.5.

For Oracle Linux there are some particularities, and the kernel to be used must be the Red Hat Compatible Kernel (RHCK) and not the Unbreakable Enterprise Kernel (UEK) which is the default kernel for all Oracle Linux.. Also Oracle marked the subscription-manager package as deprecated for the rhn-client-tools package in version 7.x.

This article will detail some steps required to convert from Oracle Linux to RHEL using the Red Hat Satellite product.

We’ll show how to create a Job Template in Satellite to perform some additional tasks for Oracle Linux, such as:

  • Upgrade to the latest version of the Oracle Linux operating system

  • Change the default kernel to RHEL and not the Oracle default which is UEK (Unbreakable Enterprise Linux)

  • Remove the iwl7260-firmware and iwlax2xx-firmware packages before converting to Red Hat, as at the time of writing there was a conflict impacting the conversion

An article that I took as a basis and helped me a lot was Bulk Convert2RHEL with Red Hat Satellite 6.10.

SSL certificate for convert2rhel

To synchronize the convert2rhel repositories, first create a "Content Credential" of type "SSL Certificate" through the path "Content->Content Credentials" and clicking on the "Create Content Credential" button:

SSL certificate for convert2rhel

Provide name and type. The certificate can be downloaded here.

SSL certificate for convert2rhel

convert2rhel repository for RHEL 7

To make a repository available to convert2rhel for RHEL 7, create a product and repository:

convert2rhel repository for RHEL 7

Below is the information used to create the repository for RHEL 7:

convert2rhel repository for RHEL 7

convert2rhel repository for RHEL 8

To create a product for convert2rhel for RHEL 8:

convert2rhel repository for RHEL 8Click on "New Repository":

convert2rhel repository for RHEL 8Fill in the information below:

convert2rhel repository for RHEL 8The repository is set up, but it's not showing any packages yet because it hasn't been synced:

convert2rhel repository for RHEL 8Go to "Content->Sync Status", select the respective repository and click on "Synchronize Now":

convert2rhel repository for RHEL 8

ContentView for RHEL 7

Ensure that there is a Content View that has the repositories for RHEL 7 Server and the respective convert2rhel:

ContentView for RHEL 7

ContentView for RHEL 8

Ensure that there is a Content View that has the repositories for RHEL 8 Server and the respective convert2rhel:

ContentView for RHEL 8

Activation Key for RHEL 7

Create the Activation key in whatever way is most appropriate to register the host in the environment:

Activation Key for RHEL 7

Activation Key for RHEL 7

Ensure there are associated subscriptions. In case of subscriptions that require virt-who, the configuration of virt-who must be done properly:

Activation Key for RHEL 7

Activation Key for RHEL 8

Create the Activation key in whatever way is most appropriate to register the host in the environment:

Activation Key for RHEL 8

Ensure there are associated subscriptions. In case of subscriptions that require virt-who, the configuration of virt-who must be done properly:

Activation Key for RHEL 8

Creating subscription-manager Repositories for Oracle Linux

In the case where public access to the internet is forbidden, we show how to create a repo for subscription-manager.

Subscription-manager repository for RHEL 7

Copy the necessary packages to a temporary directory on any server with version 7:

[root@client7 convert2rhel]# ll
total 2376
-rw-r--r--. 1 root root  116932 Aug 23  2021 convert2rhel-0.23-1.el7.noarch.rpm
-rw-r--r--. 1 root root  129304 Oct 12  2021 convert2rhel-0.24-2.el7.noarch.rpm
-rw-r--r--. 1 root root  132776 Dec 22 12:06 convert2rhel-0.25-1.el7.noarch.rpm
-rw-r--r--. 1 root root    8524 Apr 22 09:26 katello-ca-consumer-latest.noarch.rpm
-rw-r--r--. 1 root root  281216 Apr 22 12:55 python-syspurpose-1.24.50-1.el7_9.x86_64.rpm
-rw-r--r--. 1 root root    7411 Apr 22 09:50 redhat-uep.pem
-rw-r--r--. 1 root root    1855 Apr 22 09:49 RPM-GPG-KEY-redhat-release
-rw-r--r--. 1 root root 1140276 Apr 22 12:13 subscription-manager-1.24.50-1.el7_9.x86_64.rpm
-rw-r--r--. 1 root root  340924 Apr 22 12:13 subscription-manager-rhsm-1.24.50-1.el7_9.x86_64.rpm
-rw-r--r--. 1 root root  247576 Apr 22 12:13 subscription-manager-rhsm-certificates-1.24.50-1.el7_9.x86_64.rpm

Run the command "createrepo":

[root@client7 convert2rhel]# createrepo .

After executing the command, a "repodata" directory is created that contains the repository metadata:

[root@client7 convert2rhel]# ll
total 2376
-rw-r--r--. 1 root root  116932 Aug 23  2021 convert2rhel-0.23-1.el7.noarch.rpm
-rw-r--r--. 1 root root  129304 Oct 12  2021 convert2rhel-0.24-2.el7.noarch.rpm
-rw-r--r--. 1 root root  132776 Dec 22 12:06 convert2rhel-0.25-1.el7.noarch.rpm
-rw-r--r--. 1 root root    8524 Apr 22 09:26 katello-ca-consumer-latest.noarch.rpm
-rw-r--r--. 1 root root  281216 Apr 22 12:55 python-syspurpose-1.24.50-1.el7_9.x86_64.rpm
-rw-r--r--. 1 root root    7411 Apr 22 09:50 redhat-uep.pem
drwxr-xr-x. 2 root root    4096 Apr 22 15:15 repodata
-rw-r--r--. 1 root root    1855 Apr 22 09:49 RPM-GPG-KEY-redhat-release
-rw-r--r--. 1 root root 1140276 Apr 22 12:13 subscription-manager-1.24.50-1.el7_9.x86_64.rpm
-rw-r--r--. 1 root root  340924 Apr 22 12:13 subscription-manager-rhsm-1.24.50-1.el7_9.x86_64.rpm
-rw-r--r--. 1 root root  247576 Apr 22 12:13 subscription-manager-rhsm-certificates-1.24.50-1.el7_9.x86_64.rpm

Copy this directory structure and files to the Satellite server under the /var/www/html/pub/convert2rhel/7 directory.

Subscription-manager repository for RHEL 8

Copy the necessary packages to a temporary directory on any server with version 8:

[root@olinux8 convert2rhel]# ll
total 3140
-rw-r--r--. 1 root root  120708 Apr 23 21:40 convert2rhel-0.23-1.el8.noarch.rpm
-rw-r--r--. 1 root root  132880 Apr 23 21:40 convert2rhel-0.24-2.el8.noarch.rpm
-rw-r--r--. 1 root root  136324 Apr 23 21:40 convert2rhel-0.25-1.el8.noarch.rpm
-rw-r--r--. 1 root root  307828 Apr 23 21:40 dnf-plugin-subscription-manager-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root  306804 Apr 23 21:40 python3-cloud-what-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root  386288 Apr 23 21:40 python3-subscription-manager-rhsm-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root  320172 Apr 23 21:40 python3-syspurpose-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root    7411 Apr 23 21:21 redhat-uep.pem
-rw-r--r--. 1 root root    1855 Apr 23 21:20 RPM-GPG-KEY-redhat-release
-rw-r--r--. 1 root root 1191016 Apr 23 21:40 subscription-manager-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root  280576 Apr 23 21:40 subscription-manager-rhsm-certificates-1.28.21-5.el8_5.x86_64.rpm

Run the command "createrepo":

[root@olinux8 convert2rhel]# createrepo .

After executing the command, a "repodata" directory is created that contains the repository metadata:

[root@olinux8 convert2rhel]# ll
total 3144
-rw-r--r--. 1 root root  120708 Apr 23 21:40 convert2rhel-0.23-1.el8.noarch.rpm
-rw-r--r--. 1 root root  132880 Apr 23 21:40 convert2rhel-0.24-2.el8.noarch.rpm
-rw-r--r--. 1 root root  136324 Apr 23 21:40 convert2rhel-0.25-1.el8.noarch.rpm
-rw-r--r--. 1 root root  307828 Apr 23 21:40 dnf-plugin-subscription-manager-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root  306804 Apr 23 21:40 python3-cloud-what-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root  386288 Apr 23 21:40 python3-subscription-manager-rhsm-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root  320172 Apr 23 21:40 python3-syspurpose-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root    7411 Apr 23 21:21 redhat-uep.pem
drwxr-xr-x. 2 root root    4096 Apr 23 21:41 repodata
-rw-r--r--. 1 root root    1855 Apr 23 21:20 RPM-GPG-KEY-redhat-release
-rw-r--r--. 1 root root 1191016 Apr 23 21:40 subscription-manager-1.28.21-5.el8_5.x86_64.rpm
-rw-r--r--. 1 root root  280576 Apr 23 21:40 subscription-manager-rhsm-certificates-1.28.21-5.el8_5.x86_64.rpm

This structure is copied to the Satellite server under the /var/www/html/pub/convert2rhel/8 directory.

Job Template for Oracle Linux

Based on the existing job template "Convert to RHEL", a specific job template for Oracle Linux called "Convert to RHEL - Oracle Linux" was created:

Convert to RHEL - Oracle Linux

Convert to RHEL - Oracle Linux

Convert to RHEL - Oracle Linux

Convert to RHEL - Oracle Linux

The template content was created as follows:

---
- hosts: all
  tasks:
    - name: check OS release
      debug: var=ansible_distribution_version

    - name: Upgrade Oracle Linux if version less than 7.9
      block:     
        - name: upgrade all packages
          yum:
            name: '*'
            state: latest
            exclude: subscription-manager*,rhn-client-tools*

        - name: Reboot the machine
          reboot:
            reboot_timeout: 1800
      when: 
        - ansible_distribution_major_version == "7"
        - ansible_distribution_version != "7.9"

    - name: Upgrade Oracle Linux if version less than 8.5
      block:     
        - name: upgrade all packages
          yum:
            name: '*'
            state: latest
            exclude: subscription-manager*,rhn-client-tools*

        - name: upgrade all packages
          yum:
            name: 
              - iwl7260-firmware
              - iwlax2xx-firmware
            state: absent

        - name: Reboot the machine
          reboot:
            reboot_timeout: 1800
      when: 
        - ansible_distribution_major_version == "8"
        - ansible_distribution_version != "8.5"
    

    - name: Make sure that RHEL kernel is default for version 7
      block:     

        - name: Get RHEL 7 Kernel entry for grub
          shell: grubby --info=ALL | grep title | cut -d '=' -f2 | grep '7.9, with Linux' 
          register: grub_entry

        - name: Configure Oracle Linux to use RHEL 7 kernel
          shell: grub2-set-default '{{ grub_entry.stdout }}'

        - name: Rebuild grub configuration file 
          shell: grub2-mkconfig -o /boot/grub2/grub.cfg

        - name: Reboot the machine
          reboot:
            reboot_timeout: 1800

      when: ansible_distribution_major_version == "7"

    - name: Make sure that RHEL kernel is default for version 8
      block:     

        - name: Get RHEL 8 Kernel entry for grub
          shell: grubby --info=ALL | grep ^kernel | grep el8_5 | cut -d '=' -f2 | head -1
          register: grub_entry

        - name: Configure Oracle Linux to use RHEL 8 kernel
          shell: grubby --set-default {{ grub_entry.stdout }}

        - name: Reboot the machine
          reboot:
            reboot_timeout: 1800

      when: ansible_distribution_major_version == "8"

    - name: Install convert2rhel
      ansible.builtin.package:
        name: convert2rhel
        state: present
    - name: Prepopulate katello-ca-consumer
      get_url:
        url: <%= subscription_manager_configuration_url(@host) %>
        dest: /usr/share/convert2rhel/subscription-manager/katello-ca-consumer-latest.noarch.rpm
    - name: Start convert2rhel
      command: convert2rhel -y --activationkey "<%= input('Activation Key') %>" --org "<%= @host.organization.label %>" --keep-rhsm
<%- if input('Restart') == "yes" -%>
    - name: Reboot the machine
      reboot:
        reboot_timeout: 1800
<%- end -%>
    - name: Update system facts
      command: subscription-manager facts --update

Oracle Linux 7 Conversion

Initially, it is noted that the Oracle Linux version is 7.7 and is using the Oracle kernel (UEK):

Oracle Linux 7 Conversion

Create a file pointing to the respective repository to install subscription-manager:

[root@olinux7 ~]# cat /etc/yum.repos.d/convert.repo
[convert-to-rhel]
baseurl = https://satellite.idmrh.example.com/pub/convert2rhel/7/
sslverify = 0
name = Red Hat Convert2RHEL
enabled = 1
gpgcheck = 0

As previously mentioned, Oracle has marked the subscription-manager package as obsolete for version 7.x — it must be installed on the servers beforehand to avoid errors when registering the host on the Satellite. First remove the rhn-client-tools package:

[root@olinux7 ~]# yum -y remove rhn-client-tools

And install the subscription-manager package as follows:

[root@olinux7 ~]# yum --setopt=obsoletes=0 install subscription-manager -y

In "Hosts->All Hosts" click on the "Register Host" button and fill in as follows:

Oracle Linux 7 Conversion

Oracle Linux 7 Conversion

Oracle Linux 7 Conversion

After filling, click on the "Generate" button where the command to register the host appears as follows:

Oracle Linux 7 Conversion

Copy the command and run it on the host with Oracle Linux 7:

Oracle Linux 7 Conversion

If the host is successfully registered, the command execution will end as below:

Oracle Linux 7 Conversion

And also the server will appear in the list of Hosts in the Satellite:

Oracle Linux 7 Conversion

It is good to validate that remote execution is working for the respective server. Select the server in the list of hosts and in the "Select Action" menu choose "Schedule Remote Job":

Oracle Linux 7 Conversion

Run a simple command just to list files for example:

Oracle Linux 7 Conversion

If "remote execution" is working, it will show a result similar to the one below:

Oracle Linux 7 Conversion

By clicking on the hostname link in the lower right corner, you can view the command output:

Oracle Linux 7 Conversion

Making sure that "remote execution" is working, run a new job for the respective server to execute the conversion, filling in the fields as shown below:

Oracle Linux 7 Conversion

As the conversion takes time to complete, you can click on the hostname link in the lower right corner to follow the progress of the process:

Oracle Linux 7 Conversion

When the process is finished it will show the green circle with "100%":

Oracle Linux 7 Conversion

And the visualization of the end of the process will be similar to the one below:

Oracle Linux 7 Conversion

The server will now appear in the Hosts list with the "Red Hat 7.9" version:

Oracle Linux 7 Conversion

Oracle Linux 8 Conversion

By default, Oracle Linux 8 is installed with EFI Secure Boot enabled. Conversion cannot be performed if EFI Secure Boot is enabled. To disable the VM in VMware, it has to be turned off, go to "Edit Settings->VM Options->Boot Options":

Oracle Linux 8 Conversion

In this example, Oracle Linux 8 is at release 8.3 and needs to be upgraded to 8.5:

Oracle Linux 8 Conversion

Create a file pointing to the respective repository to install subscription-manager:

[root@olinux8 ~]# cat /etc/yum.repos.d/convert.repo
[convert-to-rhel]
baseurl = https://satellite.idmrh.example.com/pub/convert2rhel/8/
sslverify = 0
name = Red Hat Convert2RHEL
enabled = 1
gpgcheck = 0

On the Satellite, go to "Hosts->Register Host" and fill in the following two screens:

Oracle Linux 8 Conversion

Oracle Linux 8 Conversion

After clicking on the "Generate" button, copy the command that is shown at the bottom of the screen:

Oracle Linux 8 Conversion

Go to the server with Oracle Linux 8 and paste the command to run:

Oracle Linux 8 Conversion

If the host is successfully registered, a screen like the following will appear:

Oracle Linux 8 Conversion

And on the Satellite server it will appear in the list of registered Hosts:

Oracle Linux 8 Conversion

Select the respective host, and in the "Select Action" drill down menu, select "Schedule Remote Job":

Oracle Linux 8 Conversion

Fill in the following screen:

Oracle Linux 8 Conversion

Execution starting shows the screen as below:

Oracle Linux 8 Conversion

By clicking on the hostname link, it is possible to follow the execution of the steps, and when it is successfully completed, it will show something similar to the following screen:

Oracle Linux 8 Conversion

After successful conversion, the host is shown to have Red Hat 8.5 operating system:

Oracle Linux 8 Conversion

Conclusion

Here we've covered the technical details about converting servers running Oracle Linux to RHEL. Satellite 6.10 allows the creation of custom Job Templates that help in automating the process.

Learn more


About the author

Carlos Schimidt is a Principal Cloud Consultant for Red Hat. He has knowledge in several platform products such as Satellite, RHEV, IdM, Ceph and Openstack. He joined Red Hat in 2017 and is based in São Paulo, Brazil.

Read full bio