General Information

Spacewalk provides centralized management of Red Hat systems.

Spacecmd is the command line interface to the server and is much faster than logging into the web portal.


  • Distro(s): Enterprise Linux
  • Other: Spacewalk server setup
  • Other: Spacewalk user account created

  • Add spacewalk client repo
    • CentOS 6
      rpm -Uvh
    • CentOS 7
      rpm -Uvh
  • Install spacecmd
    • yum install spacecmd

Setting up the spacecmd config file greatly shortens the command, as you do not have to specify server, username, and password each time.

Create the file ~/.spacecmd/config

mkdir ~/.spacecmd
chmod 700 ~/.spacecmd
touch ~/.spacecmd/config
chmod 600 ~/.spacecmd/config

Edit the file

vim ~/.spacecmd/config

Verify configuration by testing connectivity


It is also useful to create the following alias in your ~/.bashrc file

alias spacecmd='spacecmd -q'

This will always execute spacecmd with the quiet option. This will not show logging into the server info, which just gets in the way if you are trying to pipe output to other commands.

Spacecmd creates a local cache of system queries to improve performance. This can leave you with outdated information when working at the CLI in some situations.

To clear the local cache

spacecmd clear_caches

List system groups

spacecmd group_list

List systems in a group

spacecmd group_listsystems <GROUP>

Add systems to a group (SYSTEMS space separated)

spacecmd group_addsystems <GROUP> <SYSTEMS>

Remove systems from a group (SYSTEMS space separated)

spacecmd group_removesystems <GROUP> <SYSTEMS>

List all systems (good for piping to grep)

spacecmd system_list

Delete system(s) from Spacewalk (SYSTEMS space separated)

spacecmd system_delete <SYSTEMS>

List a System's Base Channel

spacecmd system_listbasechannel <SYSTEM>

List a System's Child Channels

spacecmd system_listchildchannels <SYSTEM>

Set an entire group's base channel

spacecmd -y system_setbasechannel group:<GROUP-NAME> <BASE-CHANNEL-NAME>

List systems in a group and all errata except kernel:

spacecmd system_listerrata group:<GROUP-NAME> | grep -vi "kernel"

Errata install command:

spacecmd -y system_applyerrata group:<GROUP-NAME> <ERRATA-NAME>

List installed packages, grep for glibc:

spacecmd system_listinstalledpackages <SYSTEM>  | grep glibc

Systems Not in Any Group

spacecmd report_ungroupedsystems

Systems Not Checking In and Last Checkin Time

spacecmd report_inactivesystems

  • linux_wiki/spacecmd_spacewalk_cmd_line.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)