We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – How To Sync CentOS 8 repositories on Satellite / Katello / Foreman

Learn how to – How To Sync CentOS 8 repositories on Satellite / Katello / Foreman.

In this guide we’ll learn how to sync and store CentOS 8 BaseOS and AppStream repositories on Foreman Katello & Red Hat Satellite. Foreman is an open source application used for provisioning and life cycle management of physical and virtual systems.

Foreman is the foundation from which Red Hat Satellite’s core functionality is derived. Katello is a Foreman plug-in for subscription and repository management. It allows you to store repositories locally and provides a means to subscribe to those repositories and download content.

If you don’t have Foreman/Red Hat Satellite, check:

How To Create CentOS 8 Local Repository Mirrors With Rsync & Nginx

Step 1: Create a Product

We start by creating a Product, this is done on CLI or from the web console.

From CLI:

  • List organizations:
hammer organization list
  • Create Product
hammer product create --organization-id 1 
  --name "CentOS 8 Linux for x86_64" 
  --description "Repositories to use with CentOS 8 Linux"

From Web Console

Go to Products > Create Product

Enter product details and click the save button to create a product.

Step 2: Import CentOS 8 GPG Key

From CLI

mkdir /etc/pki/rpm-gpg/import/
cd /etc/pki/rpm-gpg/import/
wget https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official
hammer gpg create --organization-id 1 
  --key "RPM-GPG-KEY-CentOS-Official" 
  --name "RPM-GPG-KEY-CentOS-8"

For creation from web console, navigate to Content > Credential > New Content Credential

Give key information – Name, Type and paste the key content or use the browse button to upload.

Step 3: Create Repositories

After adding the product and Content credential, you can now add the repositories for CentOS 8 to the product created.

Hammer CLI

  • BaseOS repository
hammer repository create --organization-id 1 
  --product "CentOS 8 Linux for x86_64" 
  --name "CentOS 8 Base RPMS" 
  --label "CentOS_8_Base_RPMS" 
  --content-type "yum" 
  --download-policy "on_demand" 
  --gpg-key "RPM-GPG-KEY-CentOS-8" 
  --url "http://centos.mirror.liquidtelecom.com/8/BaseOS/x86_64/os/" 
  --mirror-on-sync "no"

  • AppStream repository
hammer repository create --organization-id 1 
  --product "CentOS 8 Linux for x86_64" 
  --name "CentOS 8 AppStream RPMS" 
  --label "CentOS_8_AppStream_RPMS" 
  --content-type "yum" 
  --download-policy "on_demand" 
  --gpg-key "RPM-GPG-KEY-CentOS-8" 
  --url "http://centos.mirror.liquidtelecom.com/8/AppStream/x86_64/os/" 
  --mirror-on-sync "no"
  • PowerTools repository
hammer repository create --organization-id 1 
  --product "CentOS 8 Linux for x86_64" 
  --name "CentOS 8 PowerTools RPMS" 
  --label "CentOS_8_PowerTools_RPMS" 
  --content-type "yum" 
  --download-policy "on_demand" 
  --gpg-key "RPM-GPG-KEY-CentOS-8" 
  --url "http://centos.mirror.liquidtelecom.com/8/PowerTools/x86_64/os/" 
  --mirror-on-sync "no"
  • Centosplus repository
hammer repository create --organization-id 1 
  --product "CentOS 8 Linux for x86_64" 
  --name "CentOS 8 centosplus RPMS" 
  --label "CentOS_8_centosplus_RPMS" 
  --content-type "yum" 
  --download-policy "on_demand" 
  --gpg-key "RPM-GPG-KEY-CentOS-8" 
  --url "http://centos.mirror.liquidtelecom.com/8/centosplus/x86_64/os/" 
  --mirror-on-sync "no"

  • Extras repository
hammer repository create --organization-id 1 
  --product "CentOS 8 Linux for x86_64" 
  --name "CentOS 8 extras RPMS" 
  --label "CentOS_8_extras_RPMS" 
  --content-type "yum" 
  --download-policy "on_demand" 
  --gpg-key "RPM-GPG-KEY-CentOS-8" 
  --url "http://centos.mirror.liquidtelecom.com/8/extras/x86_64/os/" 
  --mirror-on-sync "no"

To view Repositories in the Product, run the command.

$ hammer repository list --organization-id 1 --product "CentOS 8 Linux for x86_64"
---|--------------------------|---------------------------|--------------|---------------------------------------------------------------
ID | NAME                     | PRODUCT                   | CONTENT TYPE | URL
---|--------------------------|---------------------------|--------------|---------------------------------------------------------------
65 | CentOS 8 AppStream RPMS  | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/AppStream/x86_64/os/
64 | CentOS 8 Base RPMS       | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/BaseOS/x86_64/os/
67 | CentOS 8 centosplus RPMS | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/centosplus/x86_64/os/
68 | CentOS 8 extras RPMS     | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/extras/x86_64/os/
66 | CentOS 8 PowerTools RPMS | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/PowerTools/x86_64/os/
---|--------------------------|---------------------------|--------------|---------------------------------------------------------------

From Web Console

The same can be achieved from the Foreman / Satellite web dashboard under Products > Repositories

Step 4: Sync Repositories

Once the repositories are added, initiate the sync to pull the repository contents to your local Satellite / Katello server.

Hammer CLI:

  • List repositories
$ hammer repository list --organization-id 1 --product "CentOS 8 Linux for x86_64"
---|--------------------------|---------------------------|--------------|---------------------------------------------------------------
ID | NAME                     | PRODUCT                   | CONTENT TYPE | URL
---|--------------------------|---------------------------|--------------|---------------------------------------------------------------
65 | CentOS 8 AppStream RPMS  | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/AppStream/x86_64/os/
64 | CentOS 8 Base RPMS       | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/BaseOS/x86_64/os/
67 | CentOS 8 centosplus RPMS | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/centosplus/x86_64/os/
68 | CentOS 8 extras RPMS     | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/extras/x86_64/os/
66 | CentOS 8 PowerTools RPMS | CentOS 8 Linux for x86_64 | yum          | http://centos.mirror.liquidtelecom.com/8/PowerTools/x86_64/os/
---|--------------------------|---------------------------|--------------|---------------------------------------------------------------

Take note of the IDs then loop through to sync the repositories.

for i in $(seq 64 68); do 
  hammer repository synchronize --async --organization-id 1 
  --product "CentOS 8 Linux for x86_64" 
  --id "$i"; 
  done

Confirm sync status after a while.

$ hammer product list  --name "CentOS 8 Linux for x86_64" --organization-id 1
---|---------------------------|----------------------------------------|---------------|--------------|------------------
ID | NAME                      | DESCRIPTION                            | ORGANIZATION  | REPOSITORIES | SYNC STATE
---|---------------------------|----------------------------------------|---------------|--------------|------------------
37 | CentOS 8 Linux for x86_64 | Repositories for CentOS 8 Linux x86_64 | Mycompany LTD | 5            | Syncing Complete.
---|---------------------------|----------------------------------------|---------------|--------------|------------------

Sync can also be initiated on the web administration dashboard.

Step 5: Create a Content View

Create content view from the CLI or web console.

hammer content-view create --organization-id 1 
  --name "CentOS_8" 
  --description "Content view for CentOS 8"

Step 6: Add Repositories to Content View

Add Repositories to the Content View created.

for i in $(seq 64 68); do 
  hammer content-view add-repository --organization-id 1 
  --name "CentOS_8" 
  --product "CentOS 8 Linux for x86_64" 
  --repository-id "$i"; 
  done

Step 7: Publish a Content View

Publish the content view.

hammer content-view publish --organization-id 1 
  --name "CentOS_8" 
  --description "Publishing repositories"

Step 8: Create an Activation Key

Get available lifecycle environments:

$ hammer lifecycle-environment list --organization-id 1
---|---------|------
ID | NAME    | PRIOR
---|---------|------
1  | Library |
---|---------|------

Create an Activation Key

$ hammer activation-key create --organization-id 1 
  --name "centos8" 
  --description "CentOS 8 Activation Key" 
  --lifecycle-environment "Library" 
  --content-view "CentOS_8" 
  --unlimited-hosts

$ hammer activation-key list --organization-id 1
---|-----------------|------------------|-----------------------|--------------------------
ID | NAME            | HOST LIMIT       | LIFECYCLE ENVIRONMENT | CONTENT VIEW             
---|-----------------|------------------|-----------------------|--------------------------
1  | centos7         | 0 of Unlimited   |                       |                          
2  | centos8         | 0 of Unlimited   |                       |                          
---|-----------------|------------------|-----------------------|--------------------------

Step 9: Add Subscription to Activation Key

List subscriptions in the organization

$ hammer subscription list --organization-id 1

Add the subscription above to our activation key:

hammer activation-key add-subscription --organization-id 1 
  --name "centos8" 
  --quantity "1" 
  --subscription-id "164"

Where 164 is the id of the subscription shown by the last command.

Step 10: Subscribe CentOS 8 Machine to Satellite / Foreman (Katello)

Our repositories are now ready to be consumed by CentOS 8 clients. We have a guide you can also refer:

How To Subscribe CentOS Server to Katello/Foreman

More on CentOS 8:

Manage CentOS 8 with Cockpit

How To Create CentOS 8 KVM Image Template on OpenStack

Enable Automatic Software Updates on CentOS 8 / RHEL 8

Cart

Your Cart is Empty

Back To Shop