How to Download Yum Repositories and Register clients in Katello

In our Previous article we have already discuss ‘How to Install Katell on CentOS 7 Server‘. Now our next task is to download Linux Server’s repositories and create the Sync plan and after that create Activation key and then register the clients to katello server using activation keys and do the patching of registered servers from Katello Dashboard.

In this tutorial we will download CentOS 7 yum repositories.

Steps to download & sync CentOS 7 Repositories from Katello Dashboard

When we install katello default organization and location  is created. So before proceeding let’s first create organization with name ‘Operations’ and will keep the default location as it is.

Login to the Dashboard –> Select on “Default Organization” and click on ‘Manage Organization‘.

To Create New organization , click on ‘New Organization’ option. Specify the name as per your requirement

create-organization-katello

click on ‘Submit

In the next Window click on ‘Proceed to Edit‘ option as this point of time we don’t have any hosts.

assign-hosts-to-operations-katello

Then finally click on Submit in next Window.

Now onward whatever we do in dashboard first make sure we are using ‘Operations‘ Organization. So Go to Organization Tab and Select ‘Operations

Let’s first create the GPG keys for CentOS 7 yum repositories. Download the CentOS 7 GPG key from URL ‘http://mirror.centos.org/centos/‘ Or use below wget command

linuxtechi@cloudworld:~/Desktop$ wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7

Now from the Contents Tab —> Select GPG Keys —> click on ‘New GPG key

Specify the Key Name , in my case i am putting as ‘CentOS_7_GPG‘ and upload the above downloaded CentOS 7 RPM key.

create-gpg-keys-katello

Click on Save.

Let’s Create the Sync Plan for Repositories. From the Content Tab select ‘Sync Plans‘ and click on  ‘New Sync Plan‘ , Specify Sync Plan Name , interval and Start time as per your setup

new-sync-plan-katello

Click on Save

Now from the Content Tab select the Products option and then Click on ‘New Product‘.

Specify the Product Name and it’s label will be automatically set as per Product Name.

new-product-katello-dashboard

Click on Save and then we will get the below screen.

repositories-for-product-katello

Now Click on Create Repository.

Specify the followings and leave other parameters as its.

  •  Name = base_x86_64
  •  Label = base_x86_64
  • Type = yum
  •  url = http://mirror.centos.org/centos/7/os/x86_64/
  •  Download Policy = Immediate
  •  GPG Key = CentOS_7_GPG

details-for-product-katell-part1

details-product-katello-part2

Click on Save

In the next window, Select the Repository and Click on ‘Sync Now

sync-repositories-for-product-katello

Similarly create two more repositories  for updates and extras.

For Updates repository  use the beneath details

  • name = updates_x86_64
  • type = yum
  • url = http://mirror.centos.org/centos/7/updates/x86_64/
  • Download Policy = Immediate
  • GPG Key = CentOS_7_GPG

For Extras repository use the beneath details

  • name = extras_x86_64
  • type = yum
  • url = http://mirror.centos.org/centos/7/extras/x86_64/
  • Download Policy = Immediate
  • GPG Key = CentOS_7_GPG

Note: We can also download and sync the customize and EPEL repository by referring above steps.

Monitor and Verify the Sync Status of Repositories.

From the Content Tab select ‘Sync Status‘ option

repo-sync-status-katello

Depending on your Internet Speed it will download and sync repositories. Once it is done attach the Sync plan to the Product ‘CentOS 7

attach-sync-plan-product-katello

Click on Save.

In Katello by default ‘Library Environment‘ is created during the installation, we can create environment as per our requirement keeping Library as Parent Env. In this tutorial i am going to create below two Environments and will publish content view to these environments.

  • Non Production
  • Production

Go To Content Tab –> Select Life Cycle Environment –> Click on New Environment Path

Specify the Environment name as ‘Non Production

new-environment-katello

click on Save, Similarly create One more Environment with name ‘Production

lifecycle-environment-paths-katello

Now Let’s Create the Content View and promote it to above created Environments.

Go To Content Tab —> Select Content Views —> Click on Create New View

new-content-view-katello

click on Save

Now Select the Repositories that you want add to this view. In my case i am adding all repositories.

repositories-for-content-view-katello

After Adding the repositories and then click on ‘Publish New Version’, first this view will be promoted to Library Environment and then we will Click on ‘Promote‘ then Select the Non Production‘ environment and once done then again promote it to Production Environment.

versions-for-content-view-katello

promote-content-view-katello

 

Similarly repeat the same steps for promoting the view to Production Environment.

Creating Activation Keys

At this point of time we have downloaded the repositories and created the content views for respective environments. Now it’s time to create Activation Key for registering Linux Clients to Katello Server.

Go To Content Tab –> Select Activation Keys –> click on New Activation Key

Specify the Key Name, Environment and Content View as per your setup.

new-activation-key-katello

Click on Save

Now Go to Subscription Tab and Add ‘CentOS 7‘ Product and disable auto-attach option

add-subscriptions-for-activation-key-katello

Once you are done with Activation Key. Now Start Registering the Linux Servers to Katello.

Register Clients to Katello Server using Activation Keys

ssh your CentOS 7 Server which we want to register on Katello Server and perform the following Steps from the command line.

Install the Subscription-manager using existing centos repository and bootstrap rpm from your katello server

[root@web ~]# yum install subscription-manager
[root@web ~]# rpm -ivh http://192.168.43.111/pub/katello-ca-consumer-katello.example.com-1.0-1.noarch.rpm

Now run below subscription manager command to register the server to katello.

[root@web ~]# subscription-manager register --org="Operations" --activationkey="Operations_Non_Prod"
The system has been registered with ID: 7c0a6c2f-96f8-41b6-85e2-9765e0ec6ddf

No products installed.
[root@web ~]#

No Go to Katello Dashboard, Select Operations as the Organization.

Under the Hosts Tab —> Select Content Hosts

content-hosts-katello

As we can see that host or server is automatically register under Non Production Environment and its content View is Operation_view

Now again access the Server (web.example.com) and verify which repositories are enabled. Run the below commands.

[root@web ~]# subscription-manager repos --list

subscription-manager-katello

You can also run below yum command to verify which yum repositories are enabled

[root@web ~]# yum repolist

If we want to push updates from Katello dashboard to its content hosts then katello-agent package needs to be installed on register clients or its content hosts.

Katello agent Package is not available in default CentOS 7 repositories , so set the katello agent repository and run yum command to install.

[root@web ~]# yum install -y http://fedorapeople.org/groups/katello/releases/yum/3.2/client/el7/x86_64/katello-client-repos-latest.rpm
[root@web ~]# rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
[root@web ~]#  yum install katello-agent -y
[root@web ~]# systemctl start  goferd.service
[root@web ~]# systemctl enable  goferd.service

Note : Once the Katello agent is installed then you can move default CentOS 7 and katell-agent repository to other location.

[root@web ~]# cd /etc/yum.repos.d/
[root@web yum.repos.d]# mv CentOS-* epel* katello-client.repo /mnt/
[root@web yum.repos.d]# yum clean all
[root@web yum.repos.d]# yum repolist

Now Only Repositories from  your Katello Server should be available.

From Katello Dashboard verify whether katello-agent is installed on the content host.

content-host-details-katello

From Packages Tab now we can manage packages (like install , remove and update particular or list of  packages )

That’s all for this article. Hope you get an idea how to download repositories and register Linux server for patching in Katello setup. Please share your feedback and comments 🙂

15 thoughts on “How to Download Yum Repositories and Register clients in Katello”

  1. Any chance you have you got to the stage where Puppet does the provisioning, so that you don’t have to repeat registration steps above on each new server? That would be truly helpful.

    Reply
    • Hi Tomas,

      Yes you can play with provision templates under configure. You can modify provision templates according to your need. Once you make changes in templates then you can assign that template to particular organization and locations. Templates contain all provisioning information which also include pre & post installation scripts.

      I recommend do not change any thing on existing template create your own or clone template (backup purpose). 😛

      Reply
      • Thanks, it took me a while, but I’ve got it all working.

        It’s such a great free-of-charge tool-stack (Foreman, Katello, Puppet), the best part likely being monitoring dashboards for me. Unless Ansible Tower drops in price, Katello is the way to go. May not be cheap if you run an enterprise (learning curve for Katello etc is pretty steep), but definitely a winner for SMBs.

        Reply
  2. Hi all ,

    I have a little prob for subscribe with the redhat manifest.
    info: I have uploaded the files into katello but the repositories into redhat provider are blank :/.

    Do you help me please ?

    thx

    Gallardo

    Reply
    • Hi,

      Please check whether subscriptions are attached to your manifests from Red Hat Account. In Case you are not sure then you can ask Red Hat technical team to create / update manifests for you on the basis of your subscription.

      Once they are done with changes then try refreshing the manifests from your Katello Dashboard. Also make sure your katello server should reach to Red Hat CDN.

      Reply
  3. I know this article is a little old but its still super helpful with katello configuration, so thanks for that, I have setup everything like you instructed but when I register a server it shows up under content hosts and shows that the server has a valid subscription but when using subscription-manager list repos i get the following error

    This system has no repositories available through subscriptions.

    Under content hosts i can see the registered server, and i show that it has a product attached, and user product contents i can see all my repo’s and can see that they are all enabled.

    Any ideas as to what I did wrong?

    Reply
  4. Thank you for the post. I need help with one thing. Where does katello keep the synced repositories? I want them to be on dedicated disk but can`t find where to configure it 🙁

    Reply

Leave a Reply to Tomas Cancel reply