-->
Page 299
Page 300
This chapter covers the basics of getting started on a Red Hat Linux installation and takes a look at the organization of the file on a system along with the installation of packaged software using Red Hat Package Manager.
A Red Hat Linux installation is usually very nicely organized and fully featured, in comparison with other UNIX and Linux distributions. This is because Red Hat complies with the Linux filesystem standard (FSSTND). A complete description of the standard is available at http://www.pathname.com/fhs/.
A feature of FSSTND is that the root directory, /, is very clean and only holds the most essential files. My / looks something like the following:
bin/ etc/ lost+found/ sbin/ var/ boot/ home/ mnt/ tmp/ dev/ lib/ proc/ usr/
The following sections cover the types of files contained in most of these directories. The /dev, /proc, and /boot directories and their contents are covered in Chapter 11, "Filesystems, Disks, and Other Devices."
Most of the essential programs for using and maintaining a UNIX or Linux system are stored in the /bin and /sbin directories. The bin in the names of these directories comes from the fact that executable programs are binary files.
The /bin directory is usually used to hold the most commonly used essential user programs, such as
In addition to these types of programs, the /bin directory might also contain GNU utilities like gzip and gunzip.
The /sbin directory is used to hold essential maintenance or system programs such as the following:
Page 301
The main difference between the programs stored in /bin and /sbin is that the programs in /sbin are executable only by root.
The /etc directory is normally used to store the systemwide configuration files required by many programs. Some of the important files in /etc are as follows:
The first two files in this list, /etc/passwd and /etc/shadow, are files that define the authorized users for a system. The /etc/passwd file contains all of the information about a user except for the encrypted password, which is contained in /etc/shadow. This is done for security reasons. Manually editing these files is not recommended. To add or change user information, follow the procedures covered in Chapter 19, "User Accounts and Logins."
The next file on the list, /etc/fstab, contains a list of devices that the system knows how to mount automatically. A line from this file looks something like the following:
/dev/hda1 / ext2 defaults 1 1
The first part, /dev/hda1, indicates the device to mount (in this case the first partition of the internal hard drive, hda). The second part, /, indicates where to mount the device. The entry, ext2, indicates what type of filesystem the device contains, while the rest of the entries are mount options (the default options are specified for this device).
This file will contain at least two other entries, one for swap and another for /proc. On many systems,/etc/fstab also contains entries for CD-ROMs, floppy disks, Zip disks, and other mountable media.
Page 302
To add, delete, or change mount information, use Red Hat's fstool, covered in Chapter 11.
The file /etc/hosts contains a list of IP addresses and the corresponding hostnames (and aliases). This list is used to resolve the IP address of a machine when its name is given. A sample entry might look like the following:
10.8.11.2 kanchi
/etc/motd is the file in which the system administrator puts the message of the day (hence the name motd). Usually, it contains information related to the system such as scheduled downtime or upgrades of software, but it can contain anything. The contents of this file are usually displayed at login.
/etc/profile is the default initialization file for users whose shell is either sh, ksh, or bash. Mostly it is used for settings variables like PATH and PS1, along with things like the default umask. It is not meant to be used in place of personal initialization files and should be kept small because it is used by scripts as well as users.
The file /etc/shells also pertains to shells. It is a list of "approved" shells for users. One of its primary uses is to prevent people from accidentally changing their shells to something unusable.
In /etc/services is a list of all of the services that run on the various ports on the system. The entries will look something like the following:
telnet 23/tcp http 80/tcp
The first entry is the name of the service, the second entry is the port on which the service runs, and the final entry is the type of service. From the preceding lines you can see that Telnet runs on port 23 and HTTP runs on port 80, which are the standard ports for those services.
The last file on the list is /etc/lilo.conf. This file contains a description of the behavior of the system at boot time, along with listing all the bootable images on the system.
There are also two important subdirectories in /etc:
The X11 subdirectory of /etc contains the configuration files for the X server and the various window managers like fvwm, mwm, and twm. Most window manager packages will add their configuration files into a directory located under /etc/X11. An exception to this is a Red Hat Linux installation with the CDE (Common Desktop Environment) installed. The CDE is covered in Chapter 6, "Common Desktop Environment."
The rc.d subdirectory of /etc contains initialization scripts that run when Linux is loaded or shut down. Some of the scripts contain commands to load modules, while others handle general boot behavior.