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 CentOS 7 Linux system.
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y https://yum.theforeman.org/client/1.23/el7/x86_64/foreman-client-release.rpm
Step 2: Install subscription manager
Install subscription-manager
tool on CentOS machine to be enrolled.
sudo yum -y install subscription-manager
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 Server:
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 4: Update CentOS repositories
Remove or move all of your repositories except redhat.repo present inside the /etc/yum.repos.d/.
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.