Cybersecurity
DevOps Cloud (ADM)
IT Operations Cloud
Overview:
A script to easily register Open Enterprise Servers or SLES severs.
Symptom:
It is important to keep your servers at the current patch level. Usually there are many bugs fixed and if you come across a new issue it helps Novell Support the Developers.
I like to use the command line to register my servers. It is easy and relatively fast compared to the GUI. Even easier is to use a script. The register script will do just that. Run the script, enter your e-mail and activation codes, then sit back while the script registers the server. Just copy the script to the server, modify the e-mail account and registration codes and run the script. If something happens to the update services and repositories just run the script to clean up the old and re-register.
Details:
Registering a server with command line is easy to do when you know the commands and even easier when the commands are executed for you in a script. Here are some commands to manually register a server whether it be OES or only SLES.
The command to register a OES server and log the event is
suse_register -a email=<user@email.com> -a regcode-sles=<your sles code> -a regcode-oes=<your oes code> -L /var/log/register.log
Add -d 3 for debugging
suse_register -d 3 -a email=<user@email.com> -a regcode-sles=<your sles code> -a regcode-oes=<your oes code> -L /var/log/register.log &> /var/log/register-debug.log
List All Defined Services
zypper sl
List All Defined Repositories
zypper lr
List Only Update Repositories
zypper lr |grep -i updates
Remove a Service – Run zypper sl to get the number to remove
zypper sd N – where N is the number from the first column when running zypper sl
Refresh Repositories
zypper ref
To automate the process of registering an server and retain registration codes to easily use again, use the registration script. This is what the registration script will do:
Once the values for the variables are set, they will be stored in the script. This script can then be copied to other server and easily used register servers saving you time and making the registration process easy.
The script only works with SLES 10.x and 11.x servers and OES 2.x and 11.x servers.
I have not tested, but assume if you search for $suse_release = 11 and change to $suse_release = 12 this script can be used to register SLES 12 servers. Eventually I will get around to adding SLES 12 and OES 2015 registration capabilities.
Do not populated the registration variables and then send the script to some one you do not want using your registration codes.
Install:
Download register-1.1.tar.gz
Extract with the command tar -zxvf register-1.1.tar.gz
The -z is to gunzip, -x extract, -v verbos, and -f the file name
Usage:
Make the script executable using chmod and then run the script.
Below is an example of running the script the first time. Once the script is ran the codes will be written to the script and store for future use.
OES:~ # chmod x register-1.1.sh Adds executable to script
OES:~ # ./register-1.1.sh Runs the script
Here is an example of running the SLES and OES Register Server Script:
Please enter an e-mail account: myemail@novell.com
The e-mail recipient is myemail@novell.com
Please enter the SLES activation code: slesActivationCode
The e-mail recipient is slesActivationCode
Please enter the OES activation code: oesActivationCode
The e-mail recipient is oesActivationCode
Removing old registration files...
Server SLES 11.x OES 11.x
Registering Server for both OES and SLES update repositories...
Please be patient, this can take several minutes...
Repository 'OES11-SP1-Pool' is up to date.
Repository 'OES11-SP1-Updates' is up to date.
Repository 'SLES11-SP1-Pool' is up to date.
Repository 'SLES11-SP1-Updates' is up to date.
Repository 'SLES11-SP2-Core' is up to date.
Repository 'SLES11-SP2-Extension-Store' is up to date.
Repository 'SLES11-SP2-Updates' is up to date.
All repositories have been refreshed.
List all Defined Services
# | Alias | Name | Enabled | Refresh | Type
-- --------------------------------------------------- -------------------------------------- --------- --------- ------
1 | nu_novell_com | nu_novell_com | Yes | No | ris
2 | Novell-Open-Enterprise-Server-11-SP1_11.1.1-1.153 | Novell Open Enterprise Server 11 SP1 | Yes | Yes | yast2
List Update Repositories
3 | nu_novell_com:OES11-SP1-Updates | OES11-SP1-Updates | Yes | Yes
5 | nu_novell_com:SLE11-SP1-Debuginfo-Updates | SLE11-SP1-Debuginfo-Updates | No | Yes
7 | nu_novell_com:SLE11-SP2-Debuginfo-Updates | SLE11-SP2-Debuginfo-Updates | No | Yes
9 | nu_novell_com:SLE11-WebYaST-SP2-Updates | SLE11-WebYaST-SP2-Updates | No | Yes
12 | nu_novell_com:SLES11-SP1-Updates | SLES11-SP1-Updates | Yes | Yes
15 | nu_novell_com:SLES11-SP2-Updates | SLES11-SP2-Updates | Yes | Yes
Logs for this process can be found at:
/var/log/register.log
/var/log/register-debug.log