Table of Contents
To be successful with the Linux Installation & Package Management topic of the exam, candidates should have a good understanding of disk partitioning, installing a boot loader as well as the various methods of installing programs and shared libraries. Your understanding of partitioning should go beyond just how to use fdisk and focus on designing a partition scheme with separate /, /boot, /home, /usr, /var and swap file systems. Since LPI exams strive to be distribution neutral you should understand all of the various boot loader and package management options. This includes configuration of both LILO and GRUB boot loaders as well as installation of packages distributed in RPM, DPKG, .tar.gz or source code.
Many times administrators of Linux systems will divide the hard
disks into several partitions. It is common to see separate partitions for
/var and swap. Dividing a
disk this way can help keep the root file system from filling up and
crashing the system. For example, if
/var/log/messages grows to an extremely large size
only the partition holding
/var will fill up.
If you have access to a system with multiple partitions, take a look at the sizes of various file systems by using the df command.
gnu-linux:~$ df Filesystem 1K-blocks Used Available Use% Mounted on /dev/md0 50627 11995 36018 25% / /dev/md1 199053 125479 63296 67% /usr /dev/md2 249839 97970 138970 42% /var /dev/md3 475953 299517 151848 67% /opt /dev/md4 2111188 356140 1647804 18% /home
The actual sizes of the disk partitions can vary quite a bit from one system to another, but the sizes in relation to each other is fairly consistent. For example the partition holding / is small compared to the partitions for /usr, /var and /home. If you are inexperienced with this type of partitioning scheme or just want more information, refer to the Partition-HOWTO.
Although not shown in the example above, it is sometimes necessary to create a separate /boot partition below the hard disk's 1024th cylinder. This is used as a work-around for older PC BIOSs that are unable to boot from a partition above the 1024th cylinder. Modern, LBA-capable BIOSs do not suffer from this limitation. For additional information, see the Large-Disk-HOWTO.
The two popular boot loaders for Linux systems are LILO and GRUB. All boot loaders for PC architecture work in essentially the same way.
The system powers up and the PC BIOS loads a 512-byte chunk of code called the Master Boot Record (MBR) from the first hard disk. This is the first stage.
Execution of the code from the MBR loads a larger, second-stage boot loader. This stage is not constrained to a 512-byte limit.
The second-stage boot loader then loads the operating system. For Linux systems this includes the Linux kernel and optionally an initial ramdisk (initrd) image.
The GRUB boot loader stores copies of boot loader files in
/boot/grub. Look at the example below and note the
gnu-linux:/boot/grub$ ls -l total 111 -rw-r--r-- 1 root root 7840 Nov 17 2004 e2fs_stage1_5 -rw-r--r-- 1 root root 480 Nov 17 2004 menu.lst -rw-r--r-- 1 root root 512 Nov 17 2004 stage1 -rw-r--r-- 1 root root 101586 Nov 17 2004 stage2
When the system administrator runs grub-install
stage1 file is written to the first sector of
the boot device. At boot-time the code from
will load and execute
stage2. The configuration of
kernel and ramdisk options is done by editing
Some systems use a file called
menu.lst. Do not be surprised to see
these filenames used interchangeably in exam questions.
LILO loads the kernel and ramdisk in two stages similar to GRUB,
but there are some important differences. LILO keeps some files in
/boot, but its configuration file,
is stored in the
/etc directory. LILO also requires
administrators to run
/sbin/lilo after any changes
are made to
/etc/lilo.conf or the kernel and
The first stage of the GRUB and LILO boot loaders does not always have to be installed in the Master Boot Record of the hard disk. Sometimes it is convenient to install the boot loader in the first sector, or superblock, of the root partition, particularly for systems that have multiple operating systems. Check the boot loader's man page for details on how to specify the installation location.
In an effort to be distribution-neutral, the LPI exams cover several types of package management systems. This includes DPKG, RPM and .tar.gz. You should study the man pages for each and familiarize yourself with the command-line syntax required to perform the following tasks:
Install a package
Remove a package
Upgrade a currently installed package with a new version
Find out what files a particular package contains
Given a filename, find out which package it came from
Determine dependencies for a package
Find the version number of a package
Check a package's signature to verify its integrity.
The best way to learn package management for the exam is to do it on a day-to-day basis. Forget about the GUI tools that come with your system and start working exclusively on the command-line.
Unfortunately, you will probably only be able to get hands-on experience for two out of the three types of packages since DPKG and RPM are generally not seen together on the same system.
Shared libraries contain the code to perform common system tasks. Almost every program on a Linux system is linked to at least one shared libraries and cannot function independently of it. Most of the time everything works fine and the end user never even knows that shared libraries exist. However, a good system administrator, and a successful LPI candidate, must understand the inner workings of shared libraries.
The ldd command will let you find out which libraries a program uses. Take a look at the sample output below.
gnu-linux:~$ ldd /usr/bin/bash libncurses.so.5 => /usr/lib/libncurses.so.5 (0x40015000) libdl.so.2 => /lib/libdl.so.2 (0x40050000) libc.so.6 => /lib/libc.so.6 (0x40053000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
From the ldd output you can see that
bash is linked to
ld-linux. At the bottom of the list ld-linux, the
dynamic loader, is in charge of locating and loading all of the other
libraries. If ld-linux is unable to find any one of the other libraries in
bash will not run.
There are several methods ld-linux uses to find shared libraries.
The easiest way to ensure a library can be found is to place it in either
ld-linux will look here by default. Other
directories to be searched can be added to the environmental variable
LD_LIBRARY_PATH or the file
A portion of a typical
ld.so.conf is shown
gnu-linux:~$ head -3 /etc/ld.so.conf /usr/X11R6/lib/Xaw95 /usr/X11R6/lib/Xaw3d /usr/X11R6/lib
New directories added to
ld.so.conf do not take
effect until the ldconfig
command is executed and the changes are written to
ld.so.cache. Most systems are configured to execute
ldconfig at boot-up, but savvy Linux admins will
execute it after making adjustments to ld.so.conf, because rebooting is
for Windoze users.
Occasionally, you may want to install a program that does not have a pre-compiled version available. When this happens you will need to know how to compile from source code. The basic steps involved are detailed below.
The best way to understand installing from source code is to do it. Download the hello program from ftp.gnu.org/gnu/hello and practice the steps for installation.
Thanks go out to Paul van der Vlis for providing dpkg questions.
You are planning a new Linux installation with separate partitions for /, /boot, /tmp and /usr. Which of the following file systems will be the largest?
What is the configuration file for LILO? (give the full path)
What is the directory that contains configuration files for GRUB? (give the full path)
You have accidentally deleted the file
/usr/lib/libm.so. It needs to be re-installed,
but you cannot remember what package it comes from. Which of the
following commands would help you find the package that contains
rpm -qf libm.so
rpm -e libm.so
rpm -ivh libm.so
rpm -qi libm.so
You have accidentally deleted the file
/usr/lib/zlib.so on a Debian system. Which of the
following commands would help you find the package that contains
dpkg -S zlib.so
dpkg -r zlib.so
dpkg -i zlib.so
dpkg -l zlib.so
Version 1.7 of your favorite web browser has just been released as an RPM package. You would like to install it while automatically un-installing any other versions. Which RPM command will allow you to install a new version of an RPM while automatically un-installing other versions?
Version 1.5 of your favorite instant messenging client has just been released as a Debian package. You would like to install it while automatically un-installing any other versions. Which dpkg command will allow you to install a new version of a dpkg while automatically un-installing other versions?
What function will be performed by the command rpm -ivh foo.rpm?
Verification of the files in
Recalculation of the MD5 hash value for
Installation of the package
Verification of the signature for
What will happen if you issue the command dpkg -iR /var/tmp/downloads?
You have just downloaded the latest binary version of your
favorite streaming audio server in a tarball called
llama-i386.tar.gz. Which command could you use to
extract the contents of
tar -zxf llama-i386.tar.gz
tar -xf llama-i386.tar.gz | gunzip -c
gunzip -c llama-i386.tar.gz | tar xf -
gunzip -c | tar xf - llama-i386.tar.gz
You have just installed the new wizbang-2.0 library and added
its library path to
/etc/ld.so.conf. What command
should be run after adding the new library path to
Of the partitions listed /usr will need to be the largest, so D is the correct answer. Answers A, B and C are incorrect, because the space requirements for / /boot and /tmp are small when compared to /usr.
LILO's configuration file is
GRUB keeps configuration files in the
The correct answer is A, rpm -qf will query a file to find out which package it came from. Answer B is incorrect because rpm -e is used to erase packages and cannot be used to find individual files. Answer C is incorrect since rpm -ivh is used to install packages, it has nothing to do with finding individual files. Answer D is incorrect because rpm -qi is used to query packages for information, not individual files.
The correct answer is A, dpkg -S will query a file to find out which package it came from. Answer B is incorrect because dpkg -r is used to remove packages and cannot be used to find individual files. Answer C is incorrect since dpkg -i is used to install packages, it has nothing to do with finding individual files. Answer D is incorrect because dpkg -l is used to list packages, not individual files.
The correct answer is B, rpm --upgrade will install the new version of an RPM and then un-install any other version. Answer A is incorrect, because while rpm --install will install a package it will not un-install other versions. Answer C is incorrect, because rpm --verify does not install or remove packages. Answer D is incorrect, rpm --erase removes packages.
The correct answer is B, dpkg --install will install the new version of a dpkg while removing any previous versions. Answer A is incorrect, because while dpkg --extract will extract a package it will not un-install other versions. Answer C is incorrect, because dpkg --new selects the binary format, but does not install anything. Answer D is incorrect, dpkg --purge removes packages.
The correct answer is C, rpm -ivh foo.rpm
will install the package
specifically it will install verbosely with hash marks to indicate the
installation progress. Answer B is incorrect, do not confuse hash
marks with hash values.
Answer D is incorrect as signatures verification is performed with
The command dpkg -iR ~/downloads will
recursively install all dpkg files found in the
The correct answers are A and C. Both tar -zxf
llama-i386.tar.gz and gunzip -c llama-i386.tar.gz |
tar xf - will extract the contents of the
llama-i386.tar.gz tarball. Answer B is incorrect,
because it reverses the order of things by attempting to un-tar before
decompressing. Answer D is incorrect, because the filename argument is
in the wrong place and therefore gunzip will not
pipe anything meaningful to tar.
The ldconfig command should be run after
adding new library paths to