How to add child channels to the system registered to Red Hat Satellite 5 server from command line?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Red Hat Enterprise Linux 8
  • Red Hat Satellite 5.x

Issue

  • What is the command rhn-channel and how is it used?
  • What is the command spacewalk-channel and how is it used?
  • How to add channels to the system from the command line?
  • Is it possible to use rhn-channel and spacewalk-channel commands supplying an encrypted password instead of plain text, or without entering a password?

Resolution

  • To use the command rhn-channel or spacewalk-channel the server must be registered. These commands let you register your server in secondary channels from the command line. These commands are provided by package rhn-setup.

  • It is not possible to use rhn-channel and spacewalk-channel commands to modify or list available channels without entering a password, or supplying an encrypted password instead of plain text. However rhn-channel -l can be used to list channels, with no username/password.

Command Options:

-c CHANNEL, --channel=CHANNEL - name of channel you want to (un)subscribe
-a, --add - subscribe to channel
-r, --remove - unsubscribe from channel
-l, --list - list subscribed channels
-L, --available-channels - list available channels
-v, --verbose - verbose output
-u USER, --user=USER - your user name
-p PASSWORD, --password=PASSWORD - your password

Please note -L, --available-channels is not available in Red Hat Enterprise Linux 5.

Examples:

Subscribe to a channel:

# rhn-channel --add --channel=<channel-name> --user=<rhn-username> --password=<rhn-password>
# rhn-channel -a -c <channel-name> -u <rhn-username> -p <rhn-password>

Unsubscribe from a channel:

# rhn-channel --remove --channel=<channel-name> --user=<rhn-username> --password=<rhn-password>
# rhn-channel -r -c <channel-name> -u <rhn-username> -p <rhn-password>

List all available child channels for your subscription. This is a new option available in Red Hat Enterprise Linux 6:

# rhn-channel -L -u <rhn-username> -p <rhn-password>

List the channels you are subscribed to:

# rhn-channel -l

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

5 Comments

This command is in RHEL5.7 via rhn-client-tools-0.4.20-56.el5.src.rpm

"List all available child channels for your subscription" is not working.

rhn-channel -L -u user -p pass

usage: rhn-channel [options]

rhn-channel: error: no such option: -L

cat /etc/redhat-release

Red Hat Enterprise Linux Server release 5.8 (Tikanga)
#

Correct. As mentioned just below the Command Options box above, "Please note '--available-channels' is not available in Red Hat Enterprise Linux 5.x systems."

This is the same as "-L" option, and is a new option available in RHEL 6.

For RH6: rhn-channel --add --channel=rhel-x86_64-server-optional-6.4.z --user=(your RHN login) --passord=(password)

how to get the channel-name?