How to register a system to RHN Classic during kickstart installation?
Environment
- Red Hat Enterprise Linux(RHEL) 6
- Red Hat Enterprise Linux(RHEL) 5
- Red Hat Enterprise Linux(RHEL) 4
- Red Hat Network(RHN) Classic
- Kickstart
Issue
- How do I use
rhnreg_ksto automatically register my system with RHN during kickstart installation?
- How to register a RHEL server to RHN during kickstart installation?
- We have kickstart anaconda configured to install Red Hat Enterprise Linux servers, how can we automate the registration of new installed server to Red Hat Network so as we can use
yumto install packages and get updates released by Red Hat? - How to register my RHEL workstation to Red Hat while kickstarting the system?
- Is there any way to register system in kickstart's
postscript?
Resolution
README
Following the Red Hat Network (RHN) UI shutdown in July 2017, Red Hat is blocking new systems from registering to RHN beginning Oct. 31, 2017. Beginning March 31, 2018, Red Hat will also block systems that are still checking in from updating, as well as shut down access to all RHN APIs including security patching. If you have not transitioned to Red Hat Subscription Management (RHSM) yet, you need to do so to continue receiving support for your subscriptions. Please refer to [Red Hat Subscription Management Migration FAQ](https://access.redhat.com/articles/2979901) and [Red Hat Subscription Management - Migrating to RHSM](https://access.redhat.com/products/red-hat-subscription-management/#migration) for more information.
We also have an online tool to assist you in selecting the most appropriate registration technology for your system - [Red Hat Labs Registration Assistant](https://access.redhat.com/labs/registrationassistant/).
Introduction to
rhnreg_ks
The rhnreg_ks command is a utility for registering a system with the Red Hat Network. It is designed to be used in a non-interactive environment (a kickstart style install, for example). All the information can be specified on the command line or stdin. Generally this command is used when you have created an activation key and you want to register a system using a key.
Using Activation Keys
The syntax to use the `rhnreg_ks` command to register a system using an activation key is:
rhnreg_ks --activationkey=<activationkey>
The example below will register a system to RHN using the activation key 1-2b48feedf5b5a0e0609ae028d9275c93:
rhnreg_ks --profilename=my_rhel_system01 --activationkey=1-2b48feedf5b5a0e0609ae028d9275c93
Using the activationkey option like it's shown above, you can place the rhnreg_ks command in a kickstart's %post section to register the system. Note that a kickstart file generated from a Red Hat Satellite server will have the registration command in it automatically.
Using RHN Credentials
You can also specify `username`, `password`, and `profilename`.The example below will register a system to RHN with the profile name "`my_rhel_system01`", using an RHN `username` of "myusername" whose password is "mypw1234".
rhnreg_ks --profilename=my_rhel_system01 --username=myusername --password=mypw1234
Note: If the RHN username and password were entered on the command line they may have been saved in the shell's history. The shell's entire history can be cleared by running the command history -c. Its possible to remove a single line from the shell's history by running the command history -d <line>. The exact line in the shell's history can be found by simply running the history command. The clear command can be issued to clear the login credentials from the screen.
For details on how to create an activation key you can refer This content is not included.How do I create an RHN activation key for secure registration of my systems?
RHEL Systems Registration Guide
- This document is part of a collection covering RHEL System Registration.
- If this is not the right solution for your registration needs or;
- If you wish to make a different registration choice;
- then you can return to the RHEL Systems Registration Guide.
Red Hat Labs Registration Assistant
We also have an online tool to assist you in selecting the most appropriate registration technology for your system. If you would prefer to use this tool, please visit [https://access.redhat.com/labs/registrationassistant/](https://access.redhat.com/labs/registrationassistant/).
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.