Linux system management with Ximian redcarpet

by Marion Bates <mbates at whoopis.com>


Ximian's Redcarpet is a free alternative to RedHat Network for easily locating, downloading, and installing package updates to your Linux system. Redcarpet is available for all of the RPM-based distributions; I have used it successfully under RedHat 7 and 9, Mandrake 9 and 10, and Fedora Core 1 and 2. Redhat/Fedora-specific details will be described here, but the steps are largely the same for all RPM-based distros.

Note that redcarpet, like RHN and Debian's apt-get, can only install and update packages within the standard distribution tree for your distro (plus whatever other channels you choose to subscribe to -- more on this later.) In other words, redcarpet won't know how to update programs that were installed from source, or were custom-built or modified RPMs.

Prerequisites:
redhat-release (to determine your version; I assume other distros have an equivalent package)
gnupg (to verify downloaded packages)

Steps to install and use redcarpet:

  1. Determine what version of the redcarpet suite you need. Redcarpet2 is preferred whenever possible, for speed and reliability, but if you're using an older distro, you may only be able to use redcarpet version 1. Note that in all the instructions below, if you're using rc 1, you may need to substitute "rc" in place of "rug".

    At the time of this writing, RC 2 is available for the following distros/versions:

    fedora-1-i386
    fedora-2-i386 (but get it from slightly.off.net -- see refs for link)
    mandrake-91-i586
    mandrake-92-i586
    redhat-72-i386
    redhat-73-i386
    redhat-80-i386
    redhat-9-i386
    rhel-21as-i386
    rhel-21es-i386
    rhel-21ws-i386
    rhel-3as-i386
    rhel-3es-i386
    rhel-3ws-i386
    sld-10-i586
    sles-8-i386
    sles-8-ppc
    sles-8-s390
    sles-8-s390x
    suse-82-i586
    suse-90-i586
    suse-91-i586
    

    RC 1 is available for:

    debian-potato-i386
    debian-woody-i386
    mandrake-81-i586
    mandrake-82-i586
    mandrake-90-i586
    mandrake-91-i586
    redhat-62-i386
    redhat-71-i386
    redhat-72-i386
    redhat-73-i386
    redhat-80-i386
    redhat-9-i386
    rhel-21as-i386
    rhel-21es-i386
    rhel-21ws-i386
    sld-1-i586
    sld-10-i586
    slec-1-i586
    sles-8-i386
    suse-73-i386
    suse-80-i386
    suse-81-i386
    suse-82-i586
    

    As you can see, there is some overlap of the two rc versions; again, use rc 2 if you can.

  2. Install required packages. In the directory for your distro, you will see some or all of the following packages:
    • packageinfo.xml.gz -- describes all the packages in the suite. If you want more details, gunzip and read this.
    • rcd -- the redcarpet daemon
    • rug -- the command line client
    • red-carpet -- the X-based GUI client
    • rcd-modules -- modules for the RC daemon that enable centralized management from a Redcarpet Enterprise server.

    The rest (rcd-devel, libredcarpet, libredcarpet-tools, and libredcarpet-python) are for redcarpet software development.

    The minimum packages you need are rcd and rug. I have not really used the GUI client.

    Note: In all the examples below, commands I typed are left-justified, and output is indented.

  3. Configure. Start the daemon:
    sudo /etc/init.d/rcd start

    The daemon should now be connected to the redcarpet servers (which are synchronized nightly with the official mirrors of all the supported distros). Now, issue the following commands, as root:

    rug refresh

    This will download the most current channel information. NOTE if you're using Fedora Core 2, you may need to issue this command first:

    rug service-add http://slightly.off.net/rc-fc2

    After the refresh is complete, run

    rug channels

    This should show a list of available "channels" (software distribution trees) and whether or not you're subscribed to them. It will look something like this:

    [root@localhost root]# rug channels
    
    	subd? | Alias                        | Name                                  
    	------+------------------------------+---------------------------------------
    		  | evolution-devel-snapshot     | Evolution Development Snapshot        
    		  | evolution-snapshot           | Evolution Snapshot                    
    		  | redcarpet                    | Red Carpet                            
    		  | redcarpet2                   | Red Carpet 2                          
    		  | redhat-9-i386                | Red Hat Linux 9                       
    		  | ximian-connector             | Ximian Connector                      
    		  | ximian-connector-devel-snaps | Ximian Connector Development Snapshots
    		  | xd2                          | Ximian Desktop 2                      
    		  | ximian-evolution             | Ximian Evolution                      
    		  | mono                         | mono                                  
    		  | ooo-snapshot                 | ooo-snapshot                          
    		  | rcd-snaps                    | rcd snapshots                         
    
    [root@localhost root]# 
    

    If instead you get the following error:

    ERROR: Unable to connect to the daemon: (111, 'Connection refused')
    ERROR: Please ensure that the service is running.
    

    Then (re)start rcd and try again. If you still get the error, and you know rcd is running, wait a minute or so and try again; sometimes there is a delay because the Ximian servers are overloaded.

    Now, choose the channel(s) you want to subscribe to. For example, from the list above, I might do:

    rug sub redhat-9-i386
    	Subscribed to channel 'redhat-9-i386'
    rc sub redcarpet2
    	Subscribed to channel 'redcarpet2'
    

    If it says "Warning: Invalid channel: 'whatever'" then check the spelling and try again. Type "rug channels" again to see that you're subscribed (a "Yes" in the "subd?" column.) If you want to unsubscribe from a channel, type "rug unsub channelname".

    NOTE If you're using slightly.off.net for Fedora Core 2, there are several channel choices. What you choose to subscribe to, depends on how bleeding-edge you want to be; the ones I use are

    fedora-2-i386-mirror
    fedora-stable
    fedora-updates
    rcfc2
    

    Your mileage may vary.

  4. Update. Now, to update all the packages you have installed on your system, just type:
    rc update -y
    

    The -y option tells rug to just go ahead, rather than prompt you to approve each update. If it says "No packages to update", then your versions are up-to-date (at least, according to the redcarpet channel list).

    When you run the update command, redcarpet will compare your installed RPM versions with the current ones on its mirror server. It will then download any newer versions, verify them, resolve and download/verify any dependencies, and install the RPMs for you. It will print the list of packages it's installing.

  5. Automate. To set up automatic nightly updating, edit the root crontab to include a line like the following:
    5 0 * * * sleep $[ $RANDOM / 16 ] ; rug update -y | mail -s "rcd update for `hostname`" youremail@domain.com

    This will cause the rug update command to be run every day at 5am plus a random interval of minutes (this way, if you place this cron job on several servers, they won't all update simultaneously and choke your/Ximian's bandwidth too horribly.)

  6. Using redcarpet to install new packages. Updating your current software is only one of redcarpet's abilities. Like the Debian apt-get package manager, redcarpet can also fetch and install new packages for you:
    rug install packagename
    

    If there are dependencies, it will resolve them.

    If you don't know the exact name of a package you need, you can search for it. For example, if I wanted to install a source package and it whined about needing some libgtk-3.1.2.1.5.blah thing, I might try

    rug install libgtk-3.1.2.1.5.blah
    	
    	ERROR: Unable to find package 'libgtk-3.1.2.1.5.blah' in any subscribed channel
    

    Bummer. Let's try

    rug search libgtk-3.1.2.1.5.blah
    	
    	--- No packages found ---
    

    Darn! Okay, how about

    rug search gtk
    
    	S | Channel             | Name             | Version            
    	--+---------------------+------------------+--------------------
    	  | Ximian Evolution    | libgtkhtml3.0_2  | 3.0.9-0.ximian.6.1 
    	  | Evolution Snaps     | libgtkhtml3.0_2  | 2004-02-19, 07:59  
    	  | Ximian Evolution    | libgtkhtml3.0_4  | 3.0.10-0.ximian.6.1
    	  | Evolution Snaps     | libgtkhtml3.0_4  | 2004-05-02, 06:58  
    	  | Evolution Dev Snaps | libgtkhtml3.1_10 | 2004-06-26, 06:27  
    	  | Evolution Dev Snaps | libgtkhtml3.1_11 | 2004-08-05, 06:30  
    	  | Evolution Dev Snaps | libgtkhtml3.1_3  | 2004-03-04, 19:14  
    	  | Evolution Dev Snaps | libgtkhtml3.1_6  | 2004-04-02, 15:55  
    	  | Evolution Dev Snaps | libgtkhtml3.1_7  | 2004-05-17, 12:48  
    	  | Evolution Dev Snaps | libgtkhtml3.1_9  | 2004-06-02, 14:42  
    

    Aha! You can do partial searches like this with redcarpet to track down packages whose name doesn't precisely match what you're looking for. Also, you can do "rug search packagename" to see if you already have the package installed or not.

    Another useful redcarpet feature is the file-list option:

    rug file-list wget
    
    	/etc/wgetrc
    	/usr/bin/wget
    	/usr/share/doc/wget-1.8.2
    ...
    

    This only works for packages you have installed, as far as I can tell. It lists all the files that were installed from the RPM.

    To get a summary of a package (installed or no), you can type:

    rug info evolution
    
    	Using evolution 1.4.5-7 from the 'fedora-1-i386' channel
    	
    	Name: evolution
    	Version: 1.4.5
    	Release: 7
    	Installed: No
    	Package size: 10173671
    	Summary: GNOME's next-generation groupware suite
    	Description: 
    	Evolution is the GNOME mailer, calendar, contact manager and
    	communications tool.  The tools which make up Evolution will
    	be tightly integrated with one another and act as a seamless
    	personal information-management tool.
    

    You can use redcarpet to find out which package installed a particular file on your system. For example, if I wanted to know which package installed /etc/mime.types, I'd type

    rug package-file /etc/mime.types 
    
    	mailcap 2.1.14-1.1
    

    The command

    rug packages channelname
    
    will output a list of all available packages in that channel, and tell you which ones you have installed. Pipe this to grep to look for packages (alternate to using rug search).


There are lots of other options and tricks available; these are just the simplest ones. Type just "rug" by itself to see these plus some other basic commands; try "rug help" for a very extensive list of commands and options.


References: