Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
A RHEL system must be registered to get software and updates from the Red Hat Content Delivery Network (CDN). subscription-manager connects the system to your Red Hat account (or your company's Satellite server) and manages the repositories it can use.
Today Red Hat uses Simple Content Access: after registration the system can use the repositories at once. The old steps to "attach" a subscription are no longer needed.
In a company, systems are usually registered with an organization ID and an activation key, so no personal password is used in scripts.
Zo schrijf je het
subscription-manager COMMAND [OPTIONS]
subscription-manager register [--username=USER] [--password=PASS] | [--org=ORG --activationkey=KEY]
subscription-manager repos [--list | --list-enabled | --enable=REPO | --disable=REPO]Belangrijkste delen
register- Connect this system to Red Hat (or Satellite).
unregister- Remove the system from the account and delete its identity.
status- Show if the system is registered and its content access state.
identity- Show the system ID and the organization.
repos- List, enable and disable repositories.
refresh- Get the newest data from the server.
release- Pin the system to a minor release (like 10.0) or remove the pin.
syspurpose- Set role, usage and service level of the system.
facts- Show the hardware and system facts that are sent to the server.
config- Show or change the settings in /etc/rhsm/rhsm.conf.
clean- Remove all local subscription data (without telling the server).
version- Show the versions of the tool and the server.
Opties 23
Meest gebruikt
register
repos
release
Niets past bij dit filter.
Voorbeelden 12
$ als gewone gebruiker# als root (of met sudo)
1Register with your Red Hat account
subscription-manager register --username your-rh-userThe password is asked. After this, the BaseOS and AppStream repositories work.
2Register with an activation key (for automation)
subscription-manager register --org 1234567 --activationkey web-serversNo personal password in scripts. The key decides which repositories and settings the system gets.
3Check if the system is registered
subscription-manager statusShows "Content Access Mode is set to Simple Content Access" on a working system.
4List the enabled repositories
subscription-manager repos --list-enabledFaster than the full list. Compare with
dnf repolist.5Enable an extra repository
subscription-manager repos --enable codeready-builder-for-rhel-10-x86_64-rpmsCodeReady Builder has development packages that some build tools need.
6Disable all repositories, then enable only what you need
subscription-manager repos --disable '*' --enable rhel-10-for-x86_64-baseos-rpms --enable rhel-10-for-x86_64-appstream-rpmsA small set of repositories means a smaller attack surface and predictable updates.
7Pin a server to one minor release
subscription-manager release --set=10.0 dnf clean allSome certified software supports only one minor release. The pin stops updates to 10.1 until you remove it.
8Show the system ID
subscription-manager identityNeeded when you open a support case or remove an old system from the account.
9Register again after cloning a virtual machine
subscription-manager clean subscription-manager register --org 1234567 --activationkey web-servers --forceA cloned VM keeps the identity of the original. Clean it so both systems are not counted as one.
10Remove the system from the account before you delete it
subscription-manager unregisterKeeps the inventory in your Red Hat account clean.
11Register through a proxy
subscription-manager register --org 1234567 --activationkey web-servers --proxy proxy.example.com:3128Servers in a protected network often reach the internet only through a proxy.
12Show which facts are sent to Red Hat
subscription-manager facts --list | head -20Good to know for a privacy or security review.
Niets past bij dit filter.
Let op
- The exam systems are not registered. Software comes from repositories that the exam gives you.
--passwordon the command line ends up in the shell history. Leave it out so it is asked, or use an activation key.- After
clean, the server still thinks the system exists. Useunregisterwhen the system is still online. - Pinning a release stops security updates of newer minor releases. Remove the pin when the reason is gone.
Bestanden
/etc/rhsm/rhsm.conf- Settings: server, proxy, repository options.
/etc/pki/consumer/- The identity certificate of the registered system.
/etc/yum.repos.d/redhat.repo- The Red Hat repositories, written by subscription-manager.
/var/log/rhsm/rhsm.log- Log file of the subscription tools.
Tips om te onthouden
- Order: register → status → repos → dnf upgrade.
- Company servers: org + activation key. Your lab: username.