More Linux Server Topics - Network Diagram - About This Site

 

Chapter 3

Installing RPM Software

 

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

In This Chapter

Chapter 3

Installing RPM Software

Where To Get Commonly Used RPMs

How to Easily Access CD RPMs With Automount

Downloading RPMS To Your Linux Box

Getting RPMs Using Web Based FTP

Getting RPMs Using Command Line Anonymous FTP

How To Install The RPMs

How to Install Source RPMs

How To List Installed RPMs

How Uninstall RPMs

RedHat Up2date

 

© Peter Harrison, www.linuxhomenetworking.com

 

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

A lot of Linux system software is available using RPM packages for default Linux installs, and source RPMs for non standard installations. As the procedure for installing source RPMs involves compiling source code, they more easily installed across a wide variety of Linux flavors, thereby making life easier for the software developer who wrote the package. 

Where To Get Commonly Used RPMs 

Here are three commonly used sources for RPMs:


 

RPMs On Your Installation CDs 

This is usually easier than having to download files from a remote website. See the section about using Automount to easily access your CDROM drive to obtain RPM files. 

RPMs Downloaded From Redhat

Advanced searches for all versions of RedHat can be done using this web link:

 

http://www.redhat.com/apps/download/advanced_search.html

 

RedHat also has a highly used FTP site, ftp.redhat.com, start your search in the /pub/redhat/linux/ directory and move down the directory tree. If you’re new to FTP, don’t worry, FTP downloading it’ll be explained later.

RPMs Downloaded From Speakeasy 

RedHat only has their approved software on their site. A good general purpose source is RPMfind. Always remember to select the RPM that matches your version of Linux

 

http://speakeasy.rpmfind.net/ 

 

How to Easily Access CD RPMs With Automount

Using the Linux installation CDs is usually easier, though you run the risk of some of the packages being obsolete due to newer releases on the RedHat website.

It is usually simplest to configure your system to Automount your CDROM. This makes the files on it immediately accessible whenever you access it without having to use the "mount" command. This will make your Linux system act more like Windows.

·    Autofs is the package that supports Automount is installed by default with newer versions of RedHat Linux. You can check this using the following commands.

 

[root@bigboy tmp]# rpm -qa | grep autofs
autofs-3.1.7-33
[root@bigboy tmp]#

 

·    You can then ensure that it runs when the system boots using the chkconfig command.

 

[root@bigboy tmp]# chkconfig --level 345 autofs on
[root@bigboy tmp]#

 

·    There are two automount configuration files in /etc, one called auto.master and the other called auto.misc. My auto.master looks like this:


/misc       /etc/auto.misc     --timeout 60

 

The default version of this file normally has this line commented out so you’ll have to remove the "#" at the beginning of the line for the configuration to take effect when autofs is restarted. The first entry is not the mount point. It's where the set of autofs mount points will be. The second entry is a reference to the default map file /etc/auto.misc and the third option says that the mounted filesystems will automatically unmount themselves 60 seconds after use.  

 

·    Edit your auto.misc file to include the CDROM. It should have an entry like this.

 

cdrom -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

 

You'll find other entries such as "floppy" and "zip" commented out with a "#". If you need them, just delete the "#". The first column (the "key") is the mount point under directory /misc, so in this case you'll be doing auto mounting when you access  /misc/cdrom.

Note: some versions of linux may refer to the CDROM drive in auto.misc as just cd and not cdrom as in the example above. In this case, you may have to find yourself referring to your automounting CDROM as /misc/cd instead.

 

·    Restart autofs.

 

[root@bigboy tmp]# /etc/init.d/autofs restart
Stopping automount:[ OK ]
Starting automount:[ OK ]
[root@bigboy tmp]#  

 

·    Insert the CDROM and take a look at the contents. Nothing will appear in /misc at first as the automounting isn’t triggered until you actually access the CDROM drive.

 

[root@rahtid root]# ll /misc          

total 0

[root@rahtid root]#

 

We access the drive, and everything appears.

 

[root@bigboy tmp]# ll /misc/cdrom

total 113

dr-xr-xr-x    2 root     root         2048 Sep 15  1999 BonusChapter

dr-xr-xr-x    8 root     root         2048 Sep 15  1999 stage

dr-xr-xr-x    3 root     root         2048 Sep 15  1999 Translations

[root@bigboy tmp]#

 

·    When finished, eject the CDROM

 

[root@bigboy tmp]# eject cdrom

Downloading RPMS To Your Linux Box

For casual searching and installing, I recommend using the http links above. If you are doing industrial strength stuff, then use a real FTP client such as (WSFTP or CuteFTP for GUI) or the command line.

Getting RPMs Using Web Based FTP 

Let’s say you are running RedHat 8.0 and need to download an RPM for the DHCP server.

RedHat

·        Use your web browser to go to the RedHat link above

·        Type in dhcp in the search box

·        Click the search button

·        Scroll down for the RPM you need for the DHCP server

·        Click on the appropriate "download" link

·        Click on the FTP link

·        Save the file to Linux box's hard drive

Speakeasy

·        Go to the Speakeasy link

·        Type in dhcp in the search box

·        Click the search button

·        Scroll down for the RPM that matches your version of RedHat

·        The right hand column has the links with the actual names of the rpm files

·        Click the link

·        Save the file to Linux box's hard drive

 

It is best to download RPMs to a directory named "RPM", so you can find them later.

 


 

Getting RPMs Using Command Line Anonymous FTP

The Web based method above transparently uses anonymous File Transfer Protocol (FTP). Anonymous FTP allows you to log in and download files from a FTP server using the username “anonymous” and a password that matches your email address. This way anyone can access the data.

 

·    Let's try to FTP the SSH package from ftp.redhat.com

 

[root@bigboy tmp]# ftp ftp.redhat.com
Trying 66.77.185.38...
Connected to ftp.redhat.com (66.77.185.38).
220 Red Hat FTP server ready. All transfers are logged.
Name (ftp.redhat.com:root): anonymous
331 Please specify the password.
Password:
230 Login successful. Have fun.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (66,77,185,38,50,122)
150 Here comes the directory listing.
drwxr-xr-x 5 0 0 4096 Jun 09 04:20 pub
226 Directory send OK.

ftp>

 

·    Let's see the available help commands

 

ftp> help
Commands may be abbreviated. Commands are:

 

!

$

account

append

ascii

bell

binary

bye

case

cd

cdup

chmod

close

cr

delete

debug

dir

disconnect

exit

form

get

glob

hash

help

idle

image

lcd

ls

macdef

Mdelete

mdir

mget

mkdir

mls

mode

modtime

mput

newer

nmap

nlist

ntrans

open

prompt

passive

proxy

sendport

put

pwd

quit

quote

recv

reget

rstatus

rhelp

rename

reset

restart

rmdir

runique

send

site

size

status

struct

system

sunique

tenex

tick

trace

type

user

umask

verbose

?

 

ftp>

 

·    The commands you'll most likely use are:

 

FTP Commands

 

Command

Description

binary

Copy files in binary mode

cd

Change directory on the FTP server

dir

List the names of the files in the current

remote directory

exit

Bye bye

get

Get a file from the FTP server

lcd

Change the directory on the local machine

ls

Same as dir

mget

Same as get, but you can use wildcards like "*"

mput

Same as put, but you can use wildcards like "*"

passive

Make the file transfer passive mode

put

Put a file from the local machine onto the FTP server

pwd

Give the directory name on the local machine

 

 

·    By using the search feature on the website ahead of time, I know that the RedHat 8.0RPMs are located in the pub/redhat/linux/8.0/en/os/i386/RedHat/RPMS directory.

 

ftp> cd pub/redhat/linux/8.0/en/os/i386/RedHat/RPMS
250 Directory successfully changed.
ftp> ls open*
227 Entering Passive Mode (66,77,185,38,45,180)
150 Here comes the directory listing.
-rw-r--r-- 1 0 0   11191  Sep 03 21:32 open-1.4-16.i386.rpm
-rw-r--r-- 1 0 0 2006950  Sep 03 21:32 openh323-1.9.3-4.i386.rpm
-rw-r--r-- 1 0 0  256971  Sep 03 21:32 openh323-devel-1.9.3-4.i386.rpm
...
...
-rw-r--r-- 1 0 0  217326  Sep 03 21:33 openssh-3.4p1-2.i386.rpm
...
...
226 Directory send OK.

ftp>
 

·    Get the file we need and place it in the local directory /usr/rpm. Also print "#" hash signs on the screen during the download.

 

ftp> hash
Hash mark printing on (1024 bytes/hash mark).
ftp> lcd /usr/rpm
Local directory now /usr/rpm
ftp>

ftp> get openssh-3.4p1-2.i386.rpm
local: openssh-3.4p1-2.i386.rpm remote: openssh-3.4p1-2.i386.rpm
227 Entering Passive Mode (66,77,185,38,57,102)
150 Opening BINARY mode data connection for openssh-3.4p1-2.i386.rpm (217326 bytes).
#####################################################################

#####################################################################

####################################################################
226 File send OK.
217326 bytes received in 87.7 secs (2.4 Kbytes/sec)
ftp>

 

·    Bye bye


ftp> exit
221 Goodbye.
[root@bigboy tmp]#

  

How To Install The RPMs 

Using Downloaded Files

·        Download the source RPMs which usually have a file extension ending with (.rpm) into a temporary directory such as /tmp

·        As user root, issue the following command:

 

[root@bigboy tmp]# rpm -Uvh filename.rpm

 

Using CDROMs

·        Insert the CDROM and check the files in /misc/cdrom/RedHat/RPMS

 

[root@bigboy tmp]# cd /misc/cdrom/RedHat/RPMS
[root@bigboy RPMS]# ls filename*
filename.rpm
[root@bigboy RPMS]# rpm -Uvh filename.rpm

 

·        When finished, eject the CDROM

 

[root@bigboy RPMS]# cd /tmp
[root@bigboy tmp]# eject cdrom
[root@bigboy tmp]#
 

 

How to Install Source RPMs

Sometimes the packages you want to install need to be compiled in order to match your kernel version. This requires you to use source RPM files.

·    Download the source RPMs or locate them on your CD collection. They usually have a file extension ending with (.src.rpm)

·    Run the following commands as root:  

Newer Linux Versions

Compiling and installing source RPMs with newer RedHat Linux versions can be done simply with the rpmbuild command

 

[root@bigboy tmp]# rpmbuild --rebuild filename.src.rpm

 

o       Here is an example in which we install the tacacs plus package.

 

[root@bigboy rpm]# rpmbuild --rebuild tac_plus-4.0.3-2.src.rpm

Installing tac_plus-4.0.3-2.src.rpm

Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.61594

+ umask 022

+ cd /usr/src/redhat/BUILD

+ cd /usr/src/redhat/BUILD

+ rm -rf tac_plus-4.0.3

+ /usr/bin/gzip -dc /usr/src/redhat/SOURCES/tac_plus-4.0.3.tgz

+ tar -xvvf -

drwxr-xr-x nsen/25           0 1999-08-04 00:33:15 tac_plus-4.0.3/

-rw-r----- root/root      9029 1999-04-02 22:03:45 tac_plus-4.0.3/CHANGES

...

...

...

...

...

...

Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/tacacsd

Wrote: /usr/src/redhat/RPMS/i386/tac_plus-4.0.3-2.i386.rpm

Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.60207

+ umask 022

+ cd /usr/src/redhat/BUILD

+ cd tac_plus-4.0.3

+ rm -rf /var/tmp/tacacsd

+ exit 0

Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.60207

+ umask 022

+ cd /usr/src/redhat/BUILD

+ rm -rf tac_plus-4.0.3

+ exit 0

[root@bigboy rpm]#

 

o       Here we see that the regular RPM file, not the source RPM, has been installed correctly.

[root@bigboy rpm]# rpm -qa | grep tac_plus

tac_plus-4.0.3-2

[root@bigboy rpm]#

 

Older Linux Versions 

The process is more complicated with older RedHat Linux versions as can be seen below.

o       The source files are first exported into the directory /usr/src/redhat/SPECS with the rpm command.

o       You then have to run the  rpm command again to compile the source files into a regular RPM file which will be placed in either the /usr/src/packages/RPMS/i386/ or the /usr/src/redhat/RPMS/i386/ directories.

o       You then have to install the new RPM file from this directory.

 

[root@bigboy tmp]# rpm -Uvh filename.src.rpm

[root@bigboy SPECS]# cd /usr/src/redhat/SPECS
[root@bigboy SPECS]# rpm –ba filename

[root@bigboy tmp]# cd /usr/src/redhat/RPM/i386
[root@bigboy i386]# rpm -Uvh filename.rpm

 

How To List Installed RPMs

·    The rpm –qa command will list all the packages installed on your system

[root@bigboy tmp]# rpm –qa

perl-Storable-1.0.14-15

smpeg-gtv-0.4.4-9

e2fsprogs-1.27-9

libstdc++-3.2-7

audiofile-0.2.3-3

[root@bigboy tmp]#

 

·    You can also pipe the output of this command through the grep command if you are interested in only a specific package. In this example we are looking for all packages containing the string “ssh” in the name, regardless of case (“-i” meaning ignore case)

[root@bigboy tmp]# rpm -qa | grep -i ssh

openssh-server-3.4p1-2

openssh-clients-3.4p1-2

openssh-askpass-gnome-3.4p1-2

openssh-3.4p1-2

openssh-askpass-3.4p1-2

[root@bigboy tmp]#

How Uninstall RPMs

·    The rpm –e command will erase an installed package. The package name given must match that listed in the rpm –qa command as the version of the package is important.

[root@bigboy tmp]# rpm –e package-name

 

 

RedHat Up2date

RedHat has a program called up2date which will update your Linux installation with the latest revisions of the RPMs from the RedHat website via a HTTPS/SSL connection running in the background. Here’s what to do:

 

·    After installing the operating system issue the up2date command. It will prompt you to change the initial settings. Just quit by typing “q” and up2date will give you the command to run to get the encryption keys from RedHat.

[root@bigboy tmp]# up2date

0.  debug              No                                                       

1.  isatty             Yes                                                     

2.  depslist           []

 

Enter number of item to edit <return to exit, q to quit without saving>:

Your GPG keyring does not contain the Red Hat, Inc. public key.

Without it, you will be unable to verify that packages Update Agent downloads are securely signed by Red Hat.

 

Your Update Agent options specify that you want to use GPG.

 

To install the key, run the following as root:

 

    rpm --import /usr/share/rhn/RPM-GPG-KEY

 

[root@bigboy tmp]#

 

·    Issue the rpm command to get the keys

[root@bigboy tmp]# rpm --import /usr/share/rhn/RPM-GPG-KEY

[root@bigboy tmp]#

 

·    Issue the up2date command again and it will prompt you through a number of registration screens which will ask for information such as:

o       The login name & password of your choice

o       Your, name, address and email address

o       A profile name for your server

 

·    It will then present you with a list of all the packages installed on your server and ask you whether you want to register this software information with RedHat

·    The up2date updater will then register your system and exit back to the command prompt.

·    Now you have to actually update the software using up2date. This is done with the up2date –u command. This is what it looks like:

[root@bigboy tmp]# up2date -u

 

Fetching package list for channel: redhat-linux-i386-8.0...

########################################

 

Fetching Obsoletes list for channel: redhat-linux-i386-8.0...

########################################

 

Fetching rpm headers...

#######################################

 

Testing package set / solving RPM inter-dependencies...

########################################

cups-libs-1.1.17-0.2.i386.r ########################## Done.                   

Preparing          ########################################### [100%]

 

Installing...

   1:cups-libs     ########################################### [100%]

   2:cvs           ########################################### [100%]

   3:cyrus-sasl    ########################################### [100%]

   …

   …

   …

  


 

The following Packages were marked to be skipped by your configuration:

 

Name                          Version        Rel  Reason

---------------------------------------------------------------------

kernel                        2.4.18         24.8.0Pkg name/pattern

 

[root@bigboy tmp]#

Some Necessary Facts About up2date

o       You can update your contact information afterwards using the link http://www.redhat.com/network

o       RedHat will regularly send you emails with the packages you need to update. You can selectively update the package mentioned in each email using the command:

[root@bigboy tmp]# up2date package-name

o       Only one profile per login name is free. All additional profiles under the login name have an annual fee.

o       up2date uses HTTPS/SSL to do its updating. If you have a firewall protecting your system, you will need TCP port 443 access to the internet

o       Updating packages could cause programs written by you to stop functioning especially if they rely on the older version’s features or syntax.

o       Some RPMs won’t install unless other RPMs have been installed previously. up2date automatically figures out these package inter-dependencies and will install all the required foundation packages as well.

o       You can write a small script to periodically update your system. The “–u” switch will update all packages and the “-p” will register any additional packages you have installed without using up2date. Here is a sample script that you can run weekly using cron

 

#!/bin/sh

#

# Updates system every week

#

up2date -p

up2date -u