The following set of steps takes you through the installation of software using the Red Hat Package Manager and by compiling source code using make. 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 with the username "root". If you have not logged into your system as root, type "su" at the command prompt (without the quotes). You will then be asked for the root password. After entering it, you will be logged into the terminal as the superuser. To determine who you are logged into a terminal as, type "whoami" without the quotes.
First, we will need to get access to the files to be installed. Virtual PC makes it difficult to access the physical drives of the machine, so what I have done is created an image of a floppy disk with the required files. To make the Linux virtual machine see this file as a floppy diskette, you will need to "capture floppy disk image." To do this, click on the "Floppy" menu item and select "Capture Floppy Disk Image..." This will open a file window which will allow you to select the image you downloaded from the above link. All that this did was to act like you inserted a disk in the floppy disk drive. Linux does not see it yet. To do this, you need to mount the floppy disk.
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.)
Your install of Linux has probably already done this for you. Enter the command
ls /mnt/floppy
"ls" is a command to list all of the files and folders in a specific folder, so ls /mnt/floppy
tried to list the contents of the folder /mnt/floppy. If the command executed without an error (most likely there would have been no output), that folder exists. If there was an error, something like, "No such file or directory," then follow the following instructions.
cd /
then pressing Enter. mkdir mnt
then press Enter. If an error like, "mkdir: cannot create directory '/mnt/': File exists," appears, then the /mnt/ folder already exists.cd /mnt
then pressing Enter.mkdir floppy
then press Enter."cd" is a command to change the current directory or folder. It allows you to pass from folder to folder in a system.
Now that we've verified that the directory to connect the floppy to exists, we need to tell Linux to go connect to the floppy. It is important to note that the diskette image you downloaded is of a Microsoft DOS diskette, not a Linux diskette. It will be explained later how to address this.
mount -t vfat /dev/fd0 /mnt/floppy
and press Enter.
ls /mnt/floppy/
to see if the files appear. You should see two files: faq-6.2-1.noarch.rpm and shed-1.10.tar.gz.What we want to do now is copy these two files to your root directory so that we can use them for our two installations. Perform the following steps to copy the files from the floppy.
cd /mnt/floppy
then press Enter.ls
-l
then press Enter. (The character after the dash is a lowercase
L, not a one. The -l makes ls show the details of each of the files.) Once again, a list of the files
and folders that are contained in this folder should appear, but this time it will have details such as the last store dates and times, the file sizes, the userid of the person who created the file,
and the privileges associated with the file. Your list should look somewhat like the list shown below.-rwxr-xr-x 1 root root 393115 Oct 30 19:38 faq-6.2-1.noarch.rpm
-rwxr-xr-x 1 root root 30869 Oct 30 19:38 shed-1.10.tar.gz
cp faq-6.2-1.noarch.rpm
/root/
then pressing Enter will copy the file faq-6.2-1.noarch.rpm
to your directory /root. Remember to use Tab when entering the file name. For example, type "faq" then hit Tab. This will make it so that the file name will not have any typos. It will also mean that any type I've created in this set of instructions will not be transferred to your lab.cd
/
and Enter, then type umount
/mnt/floppy
then press Enter. This must be done before you
eject the diskette. Note: The command is "umount", not "unmount."At this point, you should have the correct files loaded to your virtual machine's hard drive to continue with the rest of the lab.
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.
cd
/root
the pressing Enter.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 |
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.rpm -ivh packagename
where "packagename" is the name of the package
we wish to install. Type rpm
-ivh faq-6.2-1.noarch.rpm
then press Enter. Remember again to use the Tab key to complete the typing of the file name.
Preparing... ######################################## [100%]
1:faq ######################################## [100%]
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.
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
.cd
/usr/doc/FAQ/html
and pressing Enter. Typing ls
should reveal
all of the files that were installed here.lynx Linux-FAQ.html
then pressing Enter will display them. Many of you may not have this browser
installed. In this case, use the graphical web browser that you access from
your desktop or type cat Linux-FAQ.html
to simply dump the HTML file to the screen.If you have the text-only browser lynx, the following is a brief tutorial on its use.
If you wish, you may 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 application name,
the same name which was displayed when you installed the software.
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. With the correct switches, later versions of tar can be used to uncompress the package and unpack all of the files and directories.
cd /root
. (Do not include the period.)tar -xvzf shed-1.10.tar.gz
.
(Do not include the period.) Remember to use Tab!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 the simple application by compiling it.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.
cd shed-1.10
../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. Each compilable program contains the parameters for make that in a text file called "Makefile". (Type cat Makefile
to type these parameters to the screen.)
make
while you are in the shed-1.10 directory.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.
Developed by David Tarnoff for all sections of CSCI 2150 at ETSU