четверг, 26 ноября 2009 г.

LPI exam 101 prep: Linux installation and package management

В рамках подготовки к сдаче экзамена 101 уровня Junior Level Linux Professional LPIC-1 публикую краткие описания команд и фактов из подготовительных материалов IBM к этому экзамену.

Linux installation and package management - topic 102

Hard disk layout

/bin - Essential command binaries
/boot - Static files of the boot loader
/dev - Device files
/etc - Host-specific system сonfiguration
/lib - Essential shared libraries and kernel modules
/media - Mount point for removable media
/mnt - Mount point for mounting a filesystem temporarily
/opt - Add-on application software packages
/sbin - Essential system binaries
/srv - Data for services provided by this system
/tmp - Temporary files
/usr - Secondary hierarchy
/var - Variable data

A hard drive is formatted into 512 byte sectors.

The partitions
have names like /dev/hda1, /dev/hda2, /dev/hda3, /dev/sda1, and so on. IDE drives
are limited to 63 partitions, while SCSI drives are limited to 15.

use of the cat command to display
/proc/ide/hda/geometry, followed by the informational messages produced by use of
the parted partitioning tool.

use of the cat command to display
/proc/ide/hda/geometry, followed by the informational messages produced by use of
the parted partitioning tool.

Linux numbers primary or extended partitions as 1 through 4, so dev hda may have
four primary partitions, /dev/hda1, /dev/hda2, /dev/hda3, and /dev/hda4. Or it may
have a single primary partition /dev/hda1 and an extended partition /dev/hda2. If
logical partitions are defined, they are numbered starting at 5, so the first logical
partition on /dev/hda will be/dev/hda5, even if there are no primary partitions and
one extended partition (/dev/hda1) on the disk.

parted subcommand p, which displays the
partition information for the disk

Regardless of whether you are configuring a workstation or a server, you will have
certain files that are unique for each system located on the local drive. Typically,
these include /etc for system parameters, /boot for files needed during boot, /sbin for
files needed for booting or system recovery, /root for the root user's home directory,
/var/lock for lock files, /var/run for running system information, and /var/log for log
files for this system. Other filesystems, such as /home for user home directories,
/usr, /opt, /var/mail, or /var/spool/news may be on separate partitions, or network
mounted, according to your installation needs and preferences.

Boot managers

This code that is loaded by BIOS from this
first sector is called the first stage boot loader or the stage 1 boot loader.

systems checks the partition table to find a primary partition on the boot drive that is
marked as active, loads the first sector from that partition, and passes control to the
beginning of the loaded code. This new piece of code is also known as the partition
boot record.

This new
code is called the stage 2 boot loader. As used by MS-DOS and PC-DOS, the stage
2 loader proceedes directly to load the rest of operating system.

The primary function of lilo command, located in /sbin/lilo, is to write a stage 1
boot record and create a map file (/boot/map) using configuration information that is
normally located in /etc/lilo.conf.

lilo -q
will display information from the map file
lilo -R
will set lilo to automatically boot the specified system on the next reboot only.
This is very convenient for automatically rebooting remote systems.
lilo -I
will display information about the path of a kernel
lilo -u
will uninstall lilo and restore the previous boot record.

GRUB has a configuration file which is usually stored in /boot/grub/grub.conf. If your
filesystem supports symbolic links, as most Linux filesystems do, you will probably
have /boot/grub/menu.lst as a symbolic link to /boot/grub/grub.conf.

remember that
counting starts at 0, so the first Red Hat system which is specified as root
(hd0,6) is actually on partition 7 the first hard drive (/dev/hda7

Make and install programs

The
tar (for Tape ARchive) command is used to create and manipulate archives from
the files in a directory tree.

The tar command can be used in conjunction
with a compression program, normally gzip or bzip2 to create a compressed
archive which saves storage space as well as transmission time. Such a
compressed archive is a tarball.

[ian@localhost ~]$ ls drgeo*
drgeo-1.1.0.tar.gz
[ian@localhost ~]$ gunzip drgeo-1.1.0.tar.gz
[ian@localhost ~]$ ls drgeo*
drgeo-1.1.0.tar

To extract the files from the tar archive, you use the tar command. The usual form,
tar -xvf filename.tar

The -x option tells tar to extract the files. The -v option tells tar to give verbose
output. And the -f option , in conjunction with a file name (drgeo-1.1.0.tar in this
case) tells tar what archive file to extract files from.

If you add the -z
option to the tar command it can decompress and extract gzipped archives with a
single command. For example:
tar -zxvf drgeo-1.1.0.tgz
or
tar -zxvf drgeo-1.1.0.tar.Z

To accomplish the same thing with an archive compressed with bzip2, use the -j
option instead of the -z option . For example:
tar -jxvf drgeo-1.1.0.tar.bz2

Remember to
add ./ before the configure command as your project directory will probably not be
in your path. For example, you might run
./configure
or
./configure --prefix /usr/local

make
with no options will just build the program. Technically this will build a default
target, which usually means just build the program from sources.
make install
will install the program you built. You may need root authority for this if you are
installing in /usr/local.

make clean
will erase files created by the make process.
make all
is sometimes used to perform the bulk of the make file's function with a single
target.

Manage shared libraries

ldd command
which displays information about the library requirements of an executable.

Loading of programs needs to be fast, so the ld.so.conf file is processed to the
ldconfig command to process all the libraries from ld.so.conf.d as well as those
from the trusted directories, /lib and /usr/lib.

Debian package management

We can install that using the apt-get
command

We can use the -s (for
simulate) option on apt-get. There are several other options with equivalent function,
such as --just-print and \--dry-run.

apt-get read a package list from somewhere. That somewhere is
/etc/apt/sources.list.

packages,most of which have not yet been updated. In this case, you can use the
command
apt-cdrom add
to add your CD-ROM to the list of package sources.

If you update your
/etc/apt/sources.list file, then you should run
apt-get update

If you installed a package and later want to uninstall it, you use the remove option
with apt-get.

Another tool that is part of the APT system is the dpkg tool

Configuration of dpkg may be controlled by
/etc/dpkg/dpkg.cfg.

dpkg -s to display the status of the guile
package after we installed it.

dpkg -L
to list the files (including directories) installed by the guile package.

To find which package contains a specific file, use the -S option of dpkg,

A
recent addition to Linux systems is the alternatives system which is managed using
the update-alternatives command.

status for packages is kept in /var/lib/dpkg/status.

dselect command which provides a text-based
full-screen interface (using ncurses) to the package management functions of dpkg.

apt-cache, which is useful for searching
package information on your system.

If you do find and download a .deb file, you can install it using dpkg -i.

Red Hat Package Manager (RPM)

installation of the guile-devel package using
the rpm -ivh command

Note that the -v option gives verbose output and the -h option shows hash marks (#)
to indicate progress.

-e option to remove (or erase) the rp

forcibly install the rpm using the --force option

There is an alternative to forcible install with the --force option that you may need
on some occasions. You can remove an rpm using the --nodeps option which
disables the internal dependency checking.

upgrading an
RPM to a newer level. This is similar to installing, except the we use the -U or the
the -F option instead of the -i option.

The -a option applies your query to all installed packages.

rpm command
provides a -f option to help you locate the package that owns a file.

the rpm
command provides an option to interrogate installed packages or package files to
find out what capabilities they depend on or require.This is the --requires option,
which may be abbreviated to -R.

To check the integrity of an RPM package file use the
--checksig (abbreviated to -K) option of rpm.

1 комментарий:

Анонимный комментирует...

It was very interesting for me to read the article. Thanx for it. I like such themes and anything that is connected to this matter. I would like to read a bit more soon.
Alex
Phone jammer