CSCI 2150
Linux Package Installation Lab

The following set of steps takes you through the installation of software using the Red Hat Package Manager. It uses the text-based command line terminal, which due to the overwhelming majority of programs that use a graphical user interface (GUI), may be unfamiliar to most people.

For the most part, there are a few things you need to know about using the terminal interface for Linux.

Important: Some of the operations you will be performing in this lab require that you are logged in as the "superuser" or "root". If you have not logged into your system as root, type su at the command prompt. You will then be asked for the root password. After entering it, you will be logged into the terminal as the superuser.

Make the DOS floppy visible to the Linux operating system

Linux treats everything including disk drives as subdirectories of "/". Therefore, in order to read a floppy diskette, we need to make a directory for the floppy drive to be visible through. To do this, we must create an empty directory that we can mount to the floppy drive. (Mount simply means to connect or enable the resource to make the it available.)

First, make the directory to connect the floppy to.

  1. Your installation of Linux may have already created this directory. (This is because mounting a floppy drive is a common practice.) To find out if this is the case, type ls /mnt. (Don't include the period; it was used simply to complete the sentence.) You should see a list of names. If one of them is "floppy", proceed to step 6. If "floppy" does not appear or if you get the message "No such file or directory," go to the next step.
  2. Move to the top directory in the directory structure by typing cd / then pressing Enter.
  3. I usually create a subdirectory called mount under which I add the directories that I will be mounting my devices to. To do this, type mkdir mnt then press Enter.
  4. Make the current or active directory the mount directory by typing cd /mnt then pressing Enter.
  5. Now that you're inside the mount directory, we can create the directory that we will be connecting the floppy to. Type mkdir floppy then press Enter.

Now that we've created the directory to connect the floppy to, we now need to tell Linux to go connect to the floppy. It is important to note that in this case, our diskette is a Microsoft DOS diskette, not a Linux diskette. It will be explained later how to address this.

  1. Place the floppy disk that you received from me in the A-drive.
  2. Type mount -t vfat /dev/fd0 /mnt/floppy and press Enter.

Next, copy the file from the floppy that you'll need for this installation.

  1. First, let's make the current or active directory the one that we defined for the floppy. Type cd /mnt/floppy then press Enter.
  2. To see what files are on this disk, type ls -l then press Enter. (The character after the dash is a lowercase L. The -l makes ls show the details of each of the files.) A list of the files and folders that are contained in the top folder of the floppy should appear. There should only be one file on the diskette you received. It is listed with its modification date and time, the userid of the person who created the file, and the privileges associated with the file.
  3. The command "cp" is used to copy files from one location to another. Type cp faq-6.2-1.noarch.rpm /root/ then press Enter. This will copy the file faq-6.2-1.noarch.rpm to your directory /root.
  4. Lastly, to release the mounted floppy diskette from the operating system, we must use the umount command. Before we can release it, we must be out of the directory it is mounted to. Type cd / and Enter, then type umount /mnt/floppy then press Enter. This must be done before you eject the diskette.

Installing Software Using RPM

Although the installation seemed to take forever and it seems like everything you'd ever need is included in your Linux installation, you may want to install other applications or files later on. One of the simplest ways to do this is to use a tool called the Red Hat Package Manager (RPM).

Packages are groups of files including applications, settings, configurations, etc. that the developer or distributor has compiled into a single file for installation. (Not all Linux software comes as a package.) The file that you copied to the /root directory was a package, not of applications, but of HTML files. Specifically, it is a set of HTML files that are Frequently Asked Questions (FAQs) about Linux. Follow these steps to install the files.

  1. Change your current directory to /root by typing cd /root the pressing Enter.
  2. Next, use the ls command to verify that the file faq-6.2-1.noarch.rpm was successfully copied to the directory. Unless you've added other files to your /root directory, it should be the only file present.

You will be using RPM to install these files. Some basic formats of the RPM command are shown in the table below.

Command Action performed
rpm -ivh packagename Install a package
rpm -e applicationname Uninstall a package
rpm -qa List all installed packages
rpm -Va Check that all packages are installed correctly
rpm -qpl packagename See the names of the files installed by the RPM
rpm -qpi packagename Get general information about a package
rpm -q -whatrequires filename Find out which packages rely on a file
  1. Type rpm -qa then press Enter. According to the table above, this will produce a list of all of the packages that have been installed on your machine. There should be quite a few of them.
  2. To install software, the table above indicates that we should use the command rpm -ivh packagename where packagename is replaced with the name of the package we wish to install. Type rpm -ivh faq-6.2-1.noarch.rpm then press Enter. If the installation was successful, you should see a line of text appear on your screen similar to the one shown on the following page.

faq ########################################

Using the Installed Software

So where did it all go? In order to use the software, it would be nice to know where RPM put it. According to the table above, the command rpm -qpl packagename will list all of the files installed by RPM where packagename is replaced with the name of the package we installed.

  1. Type rpm -qpl faq-6.2-1.noarch.rpm then press Enter. You should see a list of files fly by, and in that list you should see that the HTML files were installed in a directory /usr/doc/FAQ/html.
  2. Change to this directory by typing cd /usr/doc/FAQ/html and pressing Enter. Typing ls should reveal all of the files that were installed here.
  3. The files that you installed comprise a set of FAQs on Linux topics. There is a simple text-based HTML browser called lynx that you can use to view these files. Type lynx Linux-FAQ.html then press Enter to view them. Many of you may not have this browser installed. In this case, use the graphical web browser that you access from your desktop.

The following is a brief tutorial on the use lynx, a text only browser that came with your installation of Linux.

Call me over to verify that your installation was successful.

If you wish to uninstall the HTML files that you just installed, type rpm -e faq then press Enter. Note that faq is the package name, the same name which was displayed when you installed the software.

Compressed Packages

Linux typically delivers groups of files and directories in a package that has been compressed to reduce the overall size of the package. There are actually two steps to restoring these files before they can be used on a Linux system.

To begin with, when a software developer has completed a set of files and is ready to ship them, he or she groups them together using a program referred to as tar. The name tar stands for "tape archive" and was originally used to make it easier to move a large group of files as a whole.

The next thing the software developer does is to compress the "tar-ed" file into a smaller package. The following file extensions are used to distinguish the different types of files.

Therefore, in order to restore the files you have downloaded from a developer, you must perform the reverse set of operations. First, you must uncompress the files in order to retrieve the original tar file. Then, you must apply the tar program in order to restore the files and directory structure that the developer created.

  1. Using steps 6 through 9, mount the diskette containing the compressed and archived file onto the /mnt/floppy directory
  2. Using the command "cp", copy the compressed and archived file "shed-1.10.tar.gz" to the root directory. This is done by typing cp /mnt/floppy/shed-1.10.tar.gz /root/ then pressing Enter.
  3. Release the mounted floppy diskette from the operating system using the "umount" command. Do this by entering the command cd / to get out of the floppy directory then entering the command umount /mnt/floppy. Remember that this must be done before you eject the diskette.

With the correct switches, later versions of tar can be used to uncompress the package and unpack all of the files and directories.

  1. Move to the /root directory by typing cd /root. (Do not include the period.)
  2. Now that the file has been copied this directory, uncompress it using the command tar -xvzf shed-1.10.tar.gz. (Do not include the period.)
  3. Take a directory using ls -l, and you should see a new directory/folder has been created called shed-1.10. This contains all of the files we will be using to install a simple application.

Using Make

The files you uncompressed in the previous section are for a program called shed. Shed, which stands for "simple hex editor", will allow you to open a file and view its contents in ASCII, hexadecimal, decimal, octal, and binary. (You can download your own copy from the URL http://sourceforge.net/projects/shed.) The following instructions show how to install shed from the downloaded package.

  1. To install it, move into the directory shed-1.10 by typing cd shed-1.10.
  2. The installation instructions say to run the command ./configure (the "./" tells Linux that the program or script that you are running is in the same directory as the one you are currently in.). This command prepares your files to be compiled into an application for your system.

As a convenience to programmers and the end users who might be compiling software, almost all software development environments come with a method to maintain all of the settings including a list of all of the files needed to create an application. For command line compilers, this operation is usually called "make". When you installed the development packages for Linux, make came as part of that package. The parameters for the make that you have on your Linux installation are contained in a text file called "Makefile". (Type cat Makefile to see these parameters sent to the screen.)

  1. To make your shed application, type the command make while you are in the shed-1.10 directory.
  2. Typing ls -1 should reveal a program called shed in your directory.

If you are interested in seeing shed run, type ./shed README to open the text file README and see what the different characters are equal to in ASCII, hex, decimal, octal, and binary.