Chapter 2. System Administration

This chapter provides an overview of the Red Hat Linux system. This overview is intended to provide guidance on certain aspects of Red Hat Linux that you may not know. Additionally, this chapter will point out some of the differences between Red Hat Linux and other UNIX systems.

Filesystem Structure

Red Hat is committed to the Filesystem Hierarchy Standard (FHS), a collaborative document that defines the names and locations of many files and directories. We will continue to track and follow the standard to keep Red Hat Linux compliant.

The current FHS document is the authoritative reference to any FHS compliant filesystem, but the standard leaves many areas undefined or extensible. In this section we provide an overview of the standard and a description of the parts of the filesystem not covered by the standard.

The complete standard can be viewed at:

http://www.pathname.com/fhs/

Compliance with the standard means many things, but the two most important are compatibility with other compliant systems, and the ability to mount the /usr partition as read-only (because it contains common executables and is not meant to be changed by users). Since /usr can be mounted read-only, /usr can be mounted from the CD-ROM or from another machine via read-only NFS.

Overview of the FHS

The directories and files noted here are a small subset of those specified by the FHS document. Check the latest FHS document for the most complete information.

The /dev Directory

The /dev directory contains filesystem entries which represent devices that are attached to the system. These files are essential for the system to function properly.

The /etc Directory

The /etc directory is reserved for configuration files that are local to your machine. No binaries are to be put in /etc. Any binaries that were formerly put in /etc should now go into /sbin or possibly /bin.

The X11 and skel directories should be subdirectories of /etc:

/etc
  |- X11
  +- skel

The X11 directory is for X11 configuration files such as XF86Config. The skel directory is for "skeleton" user files, which are used to populate a home directory when a user is first created.

The /lib Directory

The /lib directory should contain only those libraries that are needed to execute the binaries in /bin and /sbin.

The /proc Directory

The /proc directory contains special files that either extract information or send information to the kernel. /proc provides an easy method of accessing information about the operating system using the cat command.

The /sbin Directory

The /sbin directory is for executables used only by the root user. The executables in /sbin are only used to boot and mount /usr and perform system recovery operations. The FHS says:

"/sbin typically contains files essential for booting the system in addition to the binaries in /bin. Anything executed after /usr is known to be mounted (when there are no problems) should be placed in /usr/sbin. Local-only system administration binaries should be placed into /usr/local/sbin."

At a minimum, the following programs should be in /sbin:

arp, clock, getty, halt, init, fdisk,
fsck.*, ifconfig, lilo, mkfs.*, mkswap, reboot,
route, shutdown, swapoff, swapon, update
	  

The /usr Directory

The /usr directory is for files that can be shared across a whole site. The /usr directory usually has its own partition, and it should be mountable read-only. The following directories should be subdirectories of /usr:

/usr
  |- X11R6
  |- bin
  |- doc
  |- etc
  |- games
  |- include
  |- lib
  |- libexec	    
  |- local
  |- sbin
  |- share
  +- src

The X11R6 directory is for the X Window System (XFree86 on Red Hat Linux), bin contains executables, doc contains non-manpage documentation, etc contains site-wide configuration files, games is for (you guessed it!) games, include contains C header files, lib contains libraries, libexec contains small helper programs called by other programs, sbin is for system administration binaries (those that do not belong in /sbin), share contains files that aren't architecture-specific, and src is for source code.

The /usr/local Directory

The FHS says:

"The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of machines, but not found in /usr."

The /usr/local directory is similar in structure to the /usr directory. It has the following subdirectories, which are similar in purpose to those in the /usr directory:

/usr/local
       |- bin
       |- doc
       |- etc
       |- games
       |- info
       |- lib
       |- man
       |- sbin
       +- src

The /var Directory

Since the FHS requires that you be able to mount /usr read-only, any programs that write log files or need spool or lock directories probably should write them to the /var directory. The FHS states /var is for:

"…variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files."

The following directories should be subdirectories of /var:

/var
  |- cache
  |- db
  |- ftp
  |- gdm
  |- lib
  |- local
  |- lock
  |- log
  |- named
  |- nis
  |- opt
  |- preserve
  |- run
  +- spool
       |- anacron
       |- at
       |- cron
       |- fax
       |- lpd
       |- mail
       |- mqueue
       +- news
       |- rwho
       |- samba
       |- slrnpull
       |- squid
       |- up2date
       |- uucp
       |- uucppublic
       |- vbox
       |- voice
  |- tmp
  |- yp

System log files such as wtmp and lastlog go in /var/log. The /var/lib directory also contains the RPM system databases. Lock files go in /var/lock. The /var/spool directory has subdirectories for various systems that need to store data files.

/usr/local in Red Hat Linux

In Red Hat Linux, the intended use for /usr/local is slightly different from that specified by the FHS. The FHS says that /usr/local should be where you store software that is to remain safe from system software upgrades. Since system upgrades from Red Hat are done safely with the RPM system and Gnome-RPM, you don't need to protect files by putting them in /usr/local. Instead, we recommend you use /usr/local for software that is local to your machine.

For instance, let's say you have mounted /usr via read-only NFS from beavis. If there is a package or program you would like to install, but you are not allowed to write to beavis, you should install it under /usr/local. Later perhaps, if you've managed to convince the system administrator of beavis to install the program on /usr, you can uninstall it from /usr/local.