Библиотека сайта rus-linux.net
Linux System Administrator's Survival Guide lsg01.htm
Introduction to Linux
The Linux operating system has become immensely popular. USENET newsgroups dedicated to the Linux operating system have hundreds of messages a day, CD-ROMs of Linux archives are sold by the thousands, and even more DOS users are wandering around trying to figure out UNIX syntax and Linux installation problems. In many ways, the interest in Linux brings back the heady hacker days and the excitement of CP/M and early DOS machines.
Linux does have its problems though. One problem is the wide variety of Linux versions available, some of which are not very stable. The quality of the installation and configuration utilities also varies widely from Linux version to Linux version. Another problem is supporting documentation. Although this problem is decreasing as more people get involved, most available Linux documentation can be intimidating for first-time users (and some veterans). Commercial books dedicated to beginning Linux users are helping by offering a smoother explanation, but most books are simply rehashed Linux documents.
Although this book also uses the Linux documentation as a basis, it also uses almost two decades of UNIX system administration experience, years of working with Linux, and a lot of advice from other users. This book is not designed for a new Linux user who can't find their way around a filesystem, although readers with any knowledge of UNIX will feel quite at home. Instead, this book is for Linux users who want to expand their systems, optimize them, and learn more about system administration.
<NOTE>Two schools of thought exist on pronouncing Linux. Because Linux is similar to UNIX and was originally developed by a programmer with the first name Linus, many assume the long i, as in line-ucks, is correct. On the other hand, Linux was developed to replace a UNIX workalike called Minix (with a short i), so the rest of the Linux community calls the operating system lih-nicks. Which is correct? The original developers used the latter pronunciation, while most North Americans prefer the former. Choose whichever you wish.<NOTE>
What Is Linux?
Linux is a freely distributed, multitasking, multiuser operating system that behaves like UNIX. Designed specifically for the PC, Linux takes advantage of the PC's architecture to give you performance similar to UNIX workstations of a couple of years ago. Linux isn't a small, simple operating system like DOS (even in its latest incarnations). The development of UNIX has resulted in a mish-mash of files and directories, all of which are carried over to Linux for compatibility and programming reasons.
Linux includes a bunch of files for the operating system itself (called the kernel), a ton of utility programs, documentation files, add-on emulators for other operating systems, and much more. The following sections explain what you get when you install Linux on your system. Future chapters expand on these topics.
Linux is a complete multitasking, multiuser operating system that behaves like the UNIX operating system in terms of kernel behavior and peripheral support. Linux has all the features of UNIX, plus several recent extensions that add new versatility to Linux. All source code for Linux and its utilities is freely available.
The Linux kernel was originally developed for the Intel 80386 CPU's protected mode. The 80386 was designed with multitasking in mind (despite the fact that most of the Intel CPUs are used with single-tasking DOS), and Linux makes good use of the advanced features built into the CPU's instruction set. Memory management is especially strong with the 80386 (compared to earlier CPUs). A floating-point emulation routine allows Linux to function on machines that do not have math coprocessors (such as the SX series of Intel CPUs).
Linux allows shared executables so that if more than one copy of a particular application is loaded (either by one user running several identical tasks, or several users running the same task), all the tasks can share the same memory. This process, called copy-on-write pages, makes for much more efficient use of RAM.
The Linux kernel also supports demand paging, which means that only sections of a program that are necessary are read into RAM. To further optimize memory usage, Linux uses a unified memory pool. This pool enables all free memory on the system to be used as disk cache, effectively speeding up access to frequently used programs and data. As memory usage increases, the amount of cache is automatically adjusted.
To support large memory requirements when only small amounts of physical RAM are available, Linux supports swap space. Swap space enables pages of memory to be written to a reserved area of a disk and treated as an extension of physical memory. By moving pages back and forth between the swap space and RAM, Linux can effectively behave as if it had more physical RAM than it does, albeit at the cost of some speed due to the hard drive's slower access.
Linux uses dynamically shared libraries extensively. Dynamically shared libraries use a common library section for many different applications, effectively reducing the size of each application. Linux does allow full library linking (called statically linked libraries) for portability to machines that may not have the dynamic libraries.
To make Linux widely acceptable, it supports a number of different filesystems, including those compatible with DOS and OS/2. Linux's own primary filesystem, called ext2fs, is designed for optimal use of the disk.
Linux is ideally suited for application development and experimentation with new languages. Several different compilers, including C, C++, Fortran, Pascal, Modula-2, LISP, Ada, Basic, and Smalltalk, come with the distribution software. Many of the Linux compilers, tools, debuggers, and editors are from the Free Software Foundation's GNU project.
GNU (a recursive acronym for Gnu's Not UNIX) was developed by the Free Software Foundation(FSF) to provide royalty-free software to programmers and developers. Since it was created, many programmer packages and toolkits have been developed and assigned to FSF for distribution. Most of the GNU software mirrors(and often improves upon) commercially available software.
Linux includes many GNU utilities, including the languages mentioned earlier, debuggers, and compiler tools. Text processors, print utilities, and other GNU tools are also included with most Linux distributions. As more software becomes available from FSF, it can be ported and compiled under Linux because Linux behaves as a standard UNIX operating system.
X (sometimes improperly called X Windows) is a graphical user interface(GUI) designed at MIT to provide portable GUI applications across different platforms. The version of X supplied with Linux is called XFree86 and is a direct port of the standard X11R5 system to 80386-based architectures. (Updates to the latest version of X, called X11R6, are beginning to appear, too.) XFree86 has been extended to provide compatibility with some other GUIs, including Open Look.
XFree86 supports several different video cards at a number of resolutions, offering a high-resolution graphical interface. Any X application can be recompiled to run properly under Linux, and a number of games, utilities, and add-ons have been developed and supplied as part of the X system. The XFree86 system also includes application development libraries, tools, and utilities. With these features, programmers can write applications specifically for X without having to invest in expensive software development kits or libraries.
Because Linux is designed for PCs, some compatibility with Microsoft MS-DOS is naturally part of the operating system. Linux provides a DOS emulator, which allows many DOS applications to be executed directly from within Linux, as part of the distribution system. Don't expect complete portability of DOS applications, though, as some applications are written to access peripherals or disk drives in a manner that Linux can't handle. The WINE (WINdows Emulator) project has developed a Microsoft Windows emulator for Linux, which enables Windows applications to be run from within Linux.
Although Linux can emulate DOS and Windows, the emulation feature is not intended to support full DOS usage. Instead, it provides the occasional DOS user with the ability to run an application under Linux. For heavy DOS use, your system should be set up with both DOS and Linux in separate partitions, enabling you to enter either one at boot time. Chapter 2 explains how to set this up.
Linux does allow you to transfer files seamlessly between the Linux filesystem and DOS by accessing the DOS partitions on a hard disk directly, if so configured. This capability makes it easy to move files and applications back and forth between the two operating systems.
TCP/IP (Transmission Control Protocol/Internet Protocol) is the primary networking system used by UNIX and Linux. TCP/IP is a full family of protocols that were developed for the Internet, and you must use TCP/IP when you venture out onto the Internet. If you want to connect with other UNIX machines, you will probably have to use TCP/IP as well. The Linux TCP/IP implementation provides all the networking software and drivers usually associated with a commercial UNIX TCP/IP package. With this implementation, you can create your own local area network(LAN), attach to existing Ethernet LANs, or connect to the Internet.
Networking is a strong feature of Linux, and will be dealt with in considerable detail later in this book. You don't have to network your Linux system, of course, but a network is cheap and simple to install and is a fantastic method for transferring files between systems. You can network over modems, too, so you can have your friends' Linux machines on a network.
Linux was developed as a freely distributable version of UNIX. UNIX is the most widely used operating system in the world and has long been the standard for high-performance workstations and larger servers. UNIX, first developed in 1969, has a strong programmer-oriented user group that supports the operating system.
<NOTE>How did UNIX get its name? It was based on an operating systems called MULTICS (MULTiplexed Information and Computing System). Ken Thompson, Dennis Ritchie, and Brian Kernighan were involved the design of a new operating system based on MULTICS that would be much simpler. They called the new operating system UNICS (Uniplexed Information and Computing System), which was quickly changed to UNIX.<NOTE>
Because UNIX is a commercial product, it must be bought for each platform it runs on. Licensing fees for UNIX versions for PC machines range from a few hundred dollars to several thousand. In an attempt to make UNIX widely available for no cost to those who want to experiment with it, a number of public domain UNIX systems have been developed over the years.
One of the early UNIX workalikes was Minix, written by Andy Tanenbaum. Although Minix didn't have a full range of features, it provided a small operating system that could be used on PC machines. To expand on Minix, a number of users started developing an enhanced operating system that would take advantage of the 80386 CPU's architecture. One of the primary developers of this system, which became known as Linux, was Linus Torvalds of the University of Helsinki. He released an early version of Linux in 1991. A first commercial, almost bug-free release was unleashed to the programming community in March 1992.
Soon, many programmers were working on Linux, and as the challenge and excitement of producing a growing UNIX workalike caught on, Linux grew at a remarkable rate. As the number of developers working on Linux grew, the entire UNIX workalike operating system was eventually completed and now includes all the tools you will find in a commercial UNIX product. Linux continues to grow as programmers adapt features and programs that were originally written as commercial UNIX products to Linux. New versions of Linux and its utilities are appearing at an astounding rate. New releases often appear weekly.
To avoid any charges for Linux, the Linux developers do not use any code from other UNIX systems. There are no licensing fees involved with the Linux operating system, and part of its mandate is to be freely available. Some companies have undertaken the task of assembling and testing versions of Linux, which they package on a CD-ROM for a (usually) minimal price.
Linux is not based on a single version of UNIX; it is a consolidation of the best features of BSD UNIX and System V. BSD UNIX was developed at the University of California at Berkeley, starting in 1977. Several major releases increased the power of BSD UNIX. Several standard UNIX programs originated at BSD, although BSD stopped its UNIX development in the early 1990s. AT&T, which developed the first version of UNIX, continued their UNIX development by producing a series of UNIX versions called System III, System IV, and System V. Linux uses the last primary release of BSD UNIX called 4.4BSD as its base and takes some other features from the latest release of System V, called System V Release 4 (SVR4).
Just because Linux is distributed for free, it doesn't mean the software is not copyrighted. Linux has been registered as copyrighted under the GNU General Public License (GPL), which is known in the programming community as a copyleft instead of copyright because of its nature. The GPL allows you to redistribute the Linux software, along with the complete source code, to anyone who wants it. However, the original owner of the components retains the copyrights to the software.
Linux doesn't have any kind of warranty. Even if you buy the Linux software from someone and pay them for maintenance, you cannot ever pursue the Linux programmers. They make no statement of functionality. If Linux destroys all your accounting or database data, it's tough luck. You assume the risk. That having been said, Linux has proven itself very stable and no incidents of serious data damage have occurred as a result of its programming. However, if the chance that something may go wrong is too great a risk for your business, you may be better off buying a commercial UNIX system that does have a warranty.
According to the GNU GPL, you can even sell Linux. You can modify any of the code, and repackage it as you want. You do not own the software and cannot claim copyright, however, even if you have modified the source code. The GNU GPL also imposes one condition on the sale of Linux≈you must provide all source code with the system if you sell it for profit so that others can further modify and sell it, too.
The authors and developers of Linux don't receive any royalties or shareware fees. For the most part, they provide the software to end users for the true love of programming and sharing their code with other programmers who appreciate it.
Sources of Help
Linux does not have a telephone support line. In one sense, you are on your own when you install Linux. On the other hand, many thousands of Linux users are willing to help everyone from neophyte to experienced programmer. All you have to know is where to look for help. The two sources of help are written documentation and the user community.
The first exposure most people get to Linux is the Linux INFO-SHEET, a relatively short ASCII document that is available from USENET, BBSs (bulletin board systems), and many user groups. The INFO-SHEET is a quick summary of Linux. It is posted at regular intervals to the Linux newsgroups on USENET.
As Linux was developed, several programmers started writing brief guides to their contributions as well as wider areas of the operating system. Although these documents were usually terse and awkward to read, they did provide others with enough information to continue using Linux. Over a short span of time, the documentation for Linux grew rapidly and a central organizing body was needed to help keep it on track and avoid duplication.
The Linux Documentation Project was created to provide a complete set of public domain documentation for Linux. From a few rough installation notes a couple of years ago, the documentation has expanded to include almost a thousand pages, some very good, some not. The following primary documents are currently available or soon to be released:
- Linux Installation explains how to install and configure Linux.
- The Linux User's Guide is a guide for first-time users.
- The Linux System Administrator's Guide is a guide to various aspects of system administration.
- The Linux Network Administration Guide explains how to set up and use networks.
- The Linux Kernel Hacker's Guide is a guide to modifying the Linux kernel.
In addition to these primary documents, there are about a dozen smaller guides to specific or esoteric aspects of Linux. These smaller guides are called How To documents. Together they form a growing document suite that covers practically every aspect of Linux. These documents are available with most distributions of the software. Not all the documents are up to date, as changes to the operating system have occurred since they were first written. Several different people wrote the Linux documents, so the styles and layout are not consistent. A perfect-bound printed copy of the Linux Documentation Project is available from Linux Systems Labs and some bookstores.
<NOTE>You can contact Linux Systems Labs at 49884 Miller Ct., Chesterfield, MI 48047. Their telephone number is (810) 716-1700, and their fax machine number is (810) 716-1703. You can get information about LSL from their e-mail address email@example.com.<NOTE>
A number of Frequently Asked Questions (FAQ) files are available through the Linux newsgroups on USENET and as part of the distribution set. The FAQs tend to be quick problem-solving items, designed to save you from thumbing through many pages of on-line documentation. One FAQ called the META-FAQ provides basic information about Linux, where to get it, and the documentation that goes with it. It too is regularly posted to newsgroups.
A file called the Linux Software Map (LSM) contains a list of many of the components in Linux. Unfortunately, the LSM is incomplete and lacks considerable chunks of data. However, it is a good starting point if you want to see what is included with Linux. The LSM is updated at intervals and can be obtained from USENET, a Linux FTP site, or with a distribution set.
Finally, Linux mailing lists are available to anyone with e-mail access to the Internet. Information on the Linux mailing lists (there are quite a few) is available from USENET newsgroups or BBSs. See the appendixes for more information about the newsgroups, BBSs, and FTP sites.
USENET is a collection of discussion groups (called newsgroups) available to Internet users. The over 13,000 newsgroups generate over 100M of traffic every day. Of all these newsgroups (which cover every conceivable topic), several are dedicated to Linux. These newsgroups are a useful forum for information and answers to questions about Linux.
You can read USENET newsgroups through newsreader software that accesses either the Internet or a local site that offers USENET service (called a newsfeed). Many on-line services, such as CompuServe and Delphi, provide access to the newsgroups (sometimes at an additional cost), and some have their own forums for Linux users. BBSs dedicated to Linux in whole or in part are also appearing, and many excerpt the USENET conversations for the BBS users who do not have access to USENET.
USENET newsgroups are divided into three categories: primary newsgroups that are readily available to all users, local newsgroups with a limited distribution (usually based on geography), and alternate newsgroups that may not be handled by all news servers due to the relaxed rules of etiquette on them. The primary newsgroups of interest to Linux users when this book was written are the following:
- The comp.os.linux.admin newsgroup deals with administering Linux systems.
- Proponents of the Linux system sound off in comp.os.linux.advocacy.
- The comp.os.linux.announce newsgroup contains announcements important to the Linux community. This is a moderated newsgroup, which means someone approves the postings before you get to see them.
- The comp.os.linux.answers newsgroup contains questions and answers to problems about Linux.
- Ongoing work on Linux in general is discussed in comp.os.linux.development.
- Ongoing work on Linux applications is discussed in comp.os.linux.development.apps.
- Ongoing work on the Linux operating system is discussed in comp.os.linux.development.system.
- The comp.os.linux.hardware newsgroup deals with issues concerning Linux and hardware support.
- The comp.os.linux.help newsgroup contains questions and advice about Linux.
- Linux-specific topics not covered by other groups are covered in comp.os.linux.misc.
- Linux networking issues are discussed in comp.os.linux.networking.
- The comp.os.linux.setup deals with Linux setup and installation problems.
These primary newsgroups should be available at all USENET sites unless the system administrator filters them out for some reason. The other Linux newsgroups tend to change frequently, primarily because they are either regional or populated with highly opinionated users. The alt (alternate) newsgroups are the ones most likely to contain such users. One alt newsgroup in operation when this book was written is
To find the several different newsgroups about Linux, use your newsreader software to search for all newsgroups with the word linux in the title. If you have access to USENET, regularly scan the newsgroup additions and deletions to check for new Linux newsgroups or existing groups that have folded. Notices about newsgroup changes are usually posted to all existing groups, but every now and again one gets through without fanfare. On-line services that provide access to USENET usually maintain lists of all active newsgroups that can be searched quickly.
The traffic on most of these Linux newsgroups deal with problems and issues people have when installing, configuring, administering, or using the operating system. A lot of valuable information passes through the newsgroups quickly, so check them regularly. The most interesting messages that deal with a specific subject (called a thread) are often collected and stored as an archive for access through an FTP site.
World Wide Web Sites
Not surprisingly, Linux has a good presence on the World Wide Web. Several sites that Linux information, and a few home pages are specifically dedicated to Linux business.
One of the most popular Linux Web sites is accessible as http://www.ssc.com/linux/linux.html. This site has a wealth of information and hyperlinks to other Linux sources. Figure 1.1 shows the home page for this site. From the home page, you can select the type of information you want by clicking the appropriate icon.
The Linux home page at www.ssc.com offers access to many of the most-frequently requested pieces of information about Linux.
From the Linux home page at www.ssc.com, you can also link to other Linux sites, including those of commercial vendors of Linux products. Figure 1.2 shows the screen that appears when you click the Linux on the Web icon. These links are updated frequently, so they are a good place to start when navigating through the Web.
The hyperlinks on the Linux home page at www.ssc.com point you to the latest Linux information.
One of the key utilities the www.ssc.com home page offers is access to the Linux Software Map (LSM), which is the most complete index to Linux software available. The Linux Software Map includes all the software packages that were developed specifically for Linux, as well as utilities and applications that have been ported to Linux. Figure 1.3 shows the LSM home page. The Linux Software Map window lets you search for keywords in on-line documents and indexes, and then displays the results to provide a fast, easy method of finding software and documents. Searching the LSM page first can save you hours of digging through FTP and BBS archives.
The Linux Software Map provides an almost complete list of available Linux software, applications, documents, and associated information.
This section previously mentioned the Linux Documentation Project. Figure 1.4 shows the home page for the Linux Documentation Project. When accessing information from this page, keep in mind that the Project is an ongoing task, so don't expect to find a lot of information in finished form.
The Linux Journal is a commercial publication dedicated to Linux. It covers the entire gamut of Linux topics, ranging from material suitable for newcomers to the operating system to very complex programming information. Figure 1.5 shows the home page for the Linux Journal, which is accessible through www.ssc.com. The magazine is not on-line, but its Web page can give you a sample Table of Contents, issue information, and subscription details.
The Linux Journal is a magazine for Linux users, developers, and all other interested parties.
<NOTE>If you want more information about the Linux Journal, send e-mail to firstname.lastname@example.org. Alternatively, you can write to the publisher at P.O. Box 85867, Seattle, WA 98145, or call the publisher at (206) 782-7733. Subscriptions are $22 per year in the U.S.<NOTE>
Recent Linux Distributions
Several versions of Linux are available, depending on which CD-ROM or FTP site you visit. This book doesn't care which version you use, because it applies to practically every version written. As of this writing, the latest Linux kernel versions were 1.2.13 and 1.3.15. The CD-ROM included with this book provides Slackware release 2.3, which includes the kernel version 1.2.8 (the last really stable version the author tested). You can change kernel versions by obtaining the source code for a new release, compiling it, and replacing your existing kernel. This procedure is covered in more detail later in the book.
You may find several CD-ROM distributions available at your local reseller. InfoMagic's Slackware release, for example, comes on four CD-ROMs and bears the name Linux Developer's Resource. In addition to the complete Linux system, it includes source code, FTP archives, full documentation, several extension products, and demonstration software of commercial applications (including WordPerfect). Some of this material is included on the CD-ROM at the back of this book.
Now that you understand what Linux is all about, you're ready to tackle the basics of Linux installation and the misunderstood LILO utility. The next three chapters complete the introductory material of this book. Then you'll be ready to dive into the true system administration material.