This article link: http://blog.csdn.net/kongxx/article/details/44003721
With the previous two blogs, we can already use spacewalk to install the system, but in real-world scenarios we often need to manage packages through spacewalk, such as installing, upgrading, and removing packages, so let's take a look at how to implement these features through spacewalk.
Installing packages
Access Systems-> Systems-> selected machines-> Software-> Packages->
* In the Filter input telnet (here we assume that we need to install the Telnet tool on the client) and select the Telnet package (for example: TELNET-0.17-48.EL6)
* Click on the "Install Selected Packages" button
* On the "Confirm Package Install" page directly point Confirm button
* Then in Systems-> Systems-> Select machine-> Events-> Pending page will appear a Pending event
* Log on to the client and then run the Rhn_check command, which executes the pending event of the previous step
* Then the client can use the Rpm-qa | grep telnet to see the results. In the spacewalk can also observe Pending event is not, and in History event in a more than a record after the completion of the execution.
Upgrade Packages
For software that has already been installed, if there is a new software version in the repositories included in the spacewalk Channel, then the-> column of the machine in the list displays the software that needs to be upgraded when accessing Systems Systems Packages Number. Access Systems-> Systems-> selected machines-> Software-> Packages->
* Select the packages that need to be upgraded and click on the "Upgrade Packages" button
* On the "Confirm Package Upgrade" page directly point Confirm button
* Then in Systems-> Systems-> Select machine-> Events-> Pending page will appear a Pending event
* Log on to the client, and then run the Rhn_check command.
removing packages
Access Systems-> Systems-> selected machines-> Software-> Packages->
* Enter the package to be deleted in Filter and select
* Select the packages that need to be upgraded and click the "Remove Packages" button
* On the "Confirm Package Removal" page directly point Confirm button
* Then in Systems-> Systems-> Select machine-> Events-> Pending page will appear a Pending event
* Log on to the client, and then run the Rhn_check command.
Finally, because of the need to execute the rhn_check command on the client computer for installation, upgrade, and deletion of the package, we can automate execution by writing a cron job.
Like we write a script file to execute the rhn_check command.
# Cat My_rhn_check.sh
#!/bin/bash
ret= ' ps-ef | grep python | grep rhn_check | wc-l '
if [$ret = 0]; then
/usr/sbin/rhn_check
Fi
Then set a cron job to run the check every minute
# CRONTAB-E
* * * * */root/my_rhn_check.sh * * *
Finally restart the Crond service
# Sudo/etc/init.d/crond Restart