Wednesday, November 20, 2024
Google search engine
HomeUncategorisedHow To Subscribe CentOS Server to Katello/Foreman

How To Subscribe CentOS Server to Katello/Foreman

How to subscribe centos server to Katello/Foreman. This tutorial will guide you through steps needed to subscribe CentOS server to consume content from Katello Server. This assumes you already have katello installed and running, you can use my Ansible Playbook Available to do quick installation.

Syncing repositories: How To Sync CentOS 8 repositories on Satellite / Katello / Foreman

All of these steps are performed on the host you want to register

Step 1: Add EPEL and Foreman repository

Add EPEL and Foreman repository to your EL based system.

### RHEL 9 based systems ###
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
sudo dnf -y install https://yum.theforeman.org/client/latest/el9/x86_64/foreman-client-release.rpm

### RHEL 8 based systems ###
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf -y install https://yum.theforeman.org/client/latest/el8/x86_64/foreman-client-release.rpm

### RHEL 7 based systems ###
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum -y install https://yum.theforeman.org/client/latest/el7/x86_64/foreman-client-release.rpm

Step 2: Install subscription manager

Install subscription-manager tool on CentOS machine to be enrolled.

sudo yum install subscription-manager

Proceed with the installation when prompted.

Dependencies resolved.
======================================================================================================================================================================================================
 Package                                                               Architecture                          Version                                      Repository                             Size
======================================================================================================================================================================================================
Installing:
 subscription-manager                                                  x86_64                                1.28.32-1.el8                                baseos                                1.2 M
Installing dependencies:
 dnf-plugin-subscription-manager                                       x86_64                                1.28.32-1.el8                                baseos                                313 k
 python3-cloud-what                                                    x86_64                                1.28.32-1.el8                                baseos                                312 k
 python3-decorator                                                     noarch                                4.2.1-2.el8                                  baseos                                 26 k
 python3-dmidecode                                                     x86_64                                3.12.2-15.el8                                baseos                                 92 k
 python3-ethtool                                                       x86_64                                0.14-5.el8                                   baseos                                 44 k
 python3-iniparse                                                      noarch                                0.4-31.el8                                   baseos                                 48 k
 python3-inotify                                                       noarch                                0.9.6-13.el8                                 baseos                                 56 k
 python3-librepo                                                       x86_64                                1.14.2-3.el8                                 baseos                                 53 k
 python3-libxml2                                                       x86_64                                2.9.7-15.el8                                 baseos                                236 k
 python3-subscription-manager-rhsm                                     x86_64                                1.28.32-1.el8                                baseos                                390 k
 subscription-manager-rhsm-certificates                                x86_64                                1.28.32-1.el8                                baseos                                281 k
 usermode                                                              x86_64                                1.113-2.el8                                  baseos                                201 k

Transaction Summary
======================================================================================================================================================================================================
Install  13 Packages

Total download size: 3.2 M
Installed size: 7.9 M
Is this ok [y/N]: y

Then download and install ca-consumer package to get a copy of the CA certificate from your Katello/Foreman Server.

export katello_fqdn="katello.example.com"
sudo rpm -Uvh http://$[katello_fqdn]/pub/katello-ca-consumer-latest.noarch.rpm

For above command to work, you should be able to resolve katello.example.com hostname.

Step 3: Register CentOS Server on Katello

Use the subscription-manager command to register your CentOS machine on Katello server.

sudo subscription-manager register --org="YourOrg" \
  --activationkey="activation-key-name"

Replace:

  • YourOrg with the name of your organization configured on Katello.
  • activation-key-name with the name of the activation key set.

Activation key need to be created on foreman prior to running above command.

Step 4: Install Katello agent tools

Install the katello-host-tools and katello-agent package which reports errata & package profile information, but does not allow you to run remote actions on the clients.

sudo yum -y install katello-host-tools  katello-agent katello-host-tools-tracer

The Katello Agent must be enabled on client servers to push the updates from the Katello Dashboard. It also provides information about errata that are applicable to the system to the Katello Dashboard from there you can get to know all the details of what is required to keep the client-server up-to-date.

Start the Katello agent service and enable it to start at the system boot.

systemctl start goferd
systemctl enable goferd

Step 5: Update OS repositories

Remove or move all of your repositories except redhat.repo present inside the /etc/yum.repos.d/.

### Example on CentOS system ###
cd /etc/yum.repos.d/
sudo mkdir old
sudo mv CentOS-* epel*  katello* old/

Verify whether the Katello-agent is installed on the host using the Katello Dashboard.

Hosts –> Content Hosts –>

To install a package from the UI, go to Hosts –> Content Hosts –> Select Host  –> Packages.

Chose Package Action as “Package Remove” and then type the name of a package; then click on perform.

Related guides:

RELATED ARTICLES

Most Popular

Recent Comments