
Copyright © 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Slackware Linux, Inc.
Slackware Linux is a registered trademark of Patrick Volkerding and Slackware Linux, Inc.
Linux is a registered trademark of Linus Torvalds.
America Online and AOL are registered trademarks of America Online, Inc. in the United States and/or other countries.
Apple, FireWire, Mac, Macintosh, Mac OS, Quicktime, and TrueType are trademarks of Apple Computer, Inc., registered in the United States and other countries.
IBM, AIX, EtherJet, Netfinity, OS/2, PowerPC, PS/2, S/390, and ThinkPad are trademarks of International Business Machines Corporation in the United States, other countries, or both.
IEEE, POSIX, and 802 are registered trademarks of Institute of Electrical and Electronics Engineers, Inc. in the United States.
Intel, Celeron, EtherExpress, i386, i486, Itanium, Pentium, and Xeon are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.
Microsoft, IntelliMouse, MS-DOS, Outlook, Windows, Windows Media and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
Netscape and the Netscape Navigator are registered trademarks of Netscape Communications Corporation in the U.S. and other countries.
Red Hat, RPM, are trademarks or registered trademarks of Red Hat, Inc. in the United States and other countries.
XFree86 is a trademark of The XFree86 Project, Inc.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this document, and Slackware Linux, Inc. was aware of the trademark claim, the designations have been followed by the “™” or the “®” symbol.
The Slackware Linux operating system is a powerful platform for Intel-based computers. It is designed to be stable, secure, and functional as both a high-end server and powerful workstation.
This book is designed to get you started with the Slackware Linux operating system. It's not meant to cover every single aspect of the distribution, but rather to show what it is capable of and give you a basic working knowledge of the system.
As you gain experience with Slackware Linux, we hope you find this book to be a handy reference. We also hope you'll lend it to all of your friends when they come asking about that cool Slackware Linux operating system you're running.
While this book may not an edge-of-your-seat novel, we certainly tried to make it as entertaining as possible. With any luck, we'll get a movie deal. Of course, we also hope you are able to learn from it and find it useful.
And now, on with the show.
This second edition is the culmination of years of hard work by the dedicated members of the Slackware Documentation Project. The following are the major changes in this new edition:
Chapter 3, Installation, has been modified with new screenshots of the installer, and reflects changes in disk-sets, and CD installation.
Chapter 4, System Configuration, has been updated with new information about Linux 2.6.x kernels.
Chapter 5, Network Configuration, has been expanded with further explanation of Samba, NFS, and DHCP. A section on wireless networking has also been added. This chapter now reflects major changes in how Slackware handles network setup.
Chapter 6, X Window System, has been substantially rewritten for Xorg based systems. This chapter now also covers the xdm graphical login manager.
Chapter 13, Basic Network Commands, has been enhanced with information about additional network utilities.
Chapter 14, Security, is a new chapter with this edition. It explains how to keep a Slackware Linux system secure.
Chapter 17, Emacs, is a new chapter with this edition. It describes how to use Emacs, a powerful editor for Unix.
Chapter 18, Package Management, has been updated with information about SlackBuild scripts.
There are many other changes, both minor and major, to reflect changes in Slackware as it has matured.
Provides introductory material on Linux, Slackware, and the Open Source and Free Software Movements.
Describes the help resources available on a Slackware Linux system and online.
Describes the installation process step-by-step with screenshots to provide an illustrative walk-through.
Describes the important configuration files and covers kernel recompilation.
Describes how to connect a Slackware Linux machine to a network. Covers TCP/IP, PPP/dial-up, wireless networking, and more.
Describes how to setup and use the graphical X Window System in Slackware.
Describes the process by which a computer boots into Slackware Linux. Also covers dual-booting with Microsoft Windows operating systems.
Describes the powerful command line interface for Linux.
Describes the filesystem structure, including file ownership, permission, and linking.
Describes the commands used to manipulate files and directories from the command line interface.
Describes the powerful Linux process management commands used to manage multiple running applications.
Describes basic system administration tasks such as adding and removing users, shutting down the system properly, and more.
Describes the collection of network clients included with Slackware.
Describes many different tools available to help keep your Slackware system secure, including iptables and tcpwrappers.
Describes the different compression and archive utilities available for Linux.
Describes the powerful vi text editor.
Describes the powerful Emacs text editor.
Describes the Slackware package utilities and the process used to create custom packages and tagfiles.
Describes the ZipSlack version of Linux that can be used from Windows without requiring an installation.
Describes the license terms under which Slackware Linux and this book can be copied and distributed.
To provide a consistent and easy to read text, several conventions are followed throughout the book.
An italic font is used for commands, emphasized text, and the first usage of technical terms.
A monospaced font is used for error messages, commands, environment variables, names of ports, hostnames, user names, group names, device names, variables, and code fragments.
A bold font is used for user input in examples.
Keys are shown in bold to stand out from other text. Key combinations that are meant to be typed simultaneously are shown with `+' between the keys, such as:
Ctrl+Alt+Del
Meaning the user should type the Ctrl, Alt, and Del keys at the same time.
Keys that are meant to be typed in sequence will be separated with commas, for example:
Ctrl+X, Ctrl+S
Would mean that the user is expected to type the Ctrl and X keys simultaneously and then to type the Ctrl and S keys simultaneously.
Examples starting with E:\> indicate a MS-DOS® command. Unless otherwise noted, these commands may be executed from a “Command Prompt” window in a modern Microsoft® Windows® environment.
D:\> rawrite a: bare.i |
Examples starting with # indicate a command that must be invoked as the superuser in Slackware. You can login as root to type the command, or login as your normal account and use su(1) to gain superuser privileges.
# dd if=bare.i of=/dev/fd0 |
Examples starting with % indicate a command that should be invoked from a normal user account. Unless otherwise noted, C-shell syntax is used for setting environment variables and other shell commands.
% top |
This project is the accumulation of months of work by many dedicated individuals. It would not have been possible for me to produce this work in a vacuum. Many people deserve our thanks for their selfless acts: Keith Keller for his work on wireless networking, Joost Kremers for his great work in single-handedly writing the emacs section, Simon Williams for the security chapter, Jurgen Phillippaerts for basic networking commands, Cibao Cu Ali G Colibri for the inspiration and a good kick in the pants. Countless others have sent in suggestions and fixes. An incomplete list includes: Jacob Anhoej, John Yast, Sally Welch, Morgan Landry, and Charlie Law. I'd also like to thank Keith Keller for hosting the mailing list for this project, as well as Carl Inglis for the initial web hosting. Last but not least, I'd like to thank Patrick J. Volkerding for Slackware Linux, and David Cantrell, Logan Johnson, and Chris Lumens for Slackware Linux Essentials 1st Edition. Without their initial framework, none of this would have ever happened. Many others have contributed in small and large ways to this project and have not been listed. I hope they will forgive me for a poor memory.
Alan Hicks, May 2005
Linus Torvalds started Linux, an operating system kernel, as a personal project in 1991. He started the project because he wanted to run a Unix-based operating system without spending a lot of money. In addition, he wanted to learn the ins and outs of the 386 processor. Linux was released free of charge to the public so that anyone could study it and make improvements under the General Public License. (See Section 1.3 and Appendix A for an explanation of the license.) Today, Linux has grown into a major player in the operating system market. It has been ported to run on a variety of system architectures, including HP/Compaq's Alpha, Sun's SPARC and UltraSPARC, and Motorola's PowerPC chips (through Apple Macintosh and IBM RS/6000 computers.) Hundreds, if not thousands, of programmers all over the world now develop Linux. It runs programs like Sendmail, Apache, and BIND, which are very popular software used to run Internet servers. It's important to remember that the term “Linux” really refers to the kernel - the core of the operating system. This core is responsible for controlling your computer's processor, memory, hard drives, and peripherals. That's all Linux really does: It controls the operations of your computer and makes sure that all of its programs behave. Various companies and individuals bundle the kernel and various programs together to make an operating system. We call each bundle a Linux distribution.
The Linux kernel project began as a solo endeavor by Linus Torvalds in 1991, but as Isaac Newton once said, “If I have seen further, it is by standing on the shoulders of giants.” When Linus Torvalds began the kernel the Free Software Foundation had already established the idea of collaborative software. They entitled their effort GNU, a recursive acronym that means simply “GNU's Not Unix”. GNU software ran atop the Linux kernel from day 1. Their compiler gcc was used to compile the kernel. Today many GNU tools from gcc to gnutar are still at the basis of every major Linux distribution. For this reason many of the Free Software Foundation's proponents fervently state that their work should be given the same credit as the Linux kernel. They strongly suggest that all Linux distributions should refer to themselves as GNU/Linux distributions.
This is the topic of many flamewars, surpassed only by the ancient vi versus emacs holy war. The purpose of this book is not to fan the fires of this heated discussion, but rather to clarify the terminology for neophytes. When one sees GNU/Linux it means a Linux distribution. When one sees Linux they can either be referring to the kernel, or to a distribution. It can be rather confusing. Typically the term GNU/Linux isn't used because it's a mouth full.
Slackware, started by Patrick Volkerding in late 1992, and initially released to the world on July 17, 1993, was the first Linux distribution to achieve widespread use. Volkerding first learned of Linux when he needed an inexpensive LISP interpreter for a project. One of the few distributions available at the time was SLS Linux from Soft Landing Systems. Volkerding used SLS Linux, fixing bugs as he found them. Eventually, he decided to merge all of these bugfixes into his own private distribution that he and his friends could use. This private distribution quickly gained popularity, so Volkerding decided to name it Slackware and make it publicly available. Along the way, Patrick added new things to Slackware; a user friendly installation program based on a menuing system, as well as the concept of package management, which allows users to easily add, remove, or upgrade software packages on their systems.
There are many reasons why Slackware is Linux's oldest living distribution. It does not try to emulate Windows, it tries to be as Unix-like as possible. It does not try to cover up processes with fancy, point-and-click GUIs (Graphical User Interfaces). Instead, it puts users in control by letting them see exactly what's going on. Its development is not rushed to meet deadlines-each version comes out when it is ready.
Slackware is for people who enjoy learning and tweaking their system to do exactly what they want. Slackware's stability and simplicity are why people will continue to use it for years to come. Slackware currently enjoys a reputation as a solid server and a no-nonsense workstation. You can find Slackware desktops running nearly any window manager or desktop environment, or none at all. Slackware servers power businesses, acting in every capacity that a server can be used in. Slackware users are among the most satisfied Linux users. Of course, we'd say that. :^)
Within the Linux community, there are two major ideological movements at work. The Free Software movement (which we'll get into in a moment) is working toward the goal of making all software free of intellectual property restrictions. Followers of this movement believe these restrictions hamper technical improvement and work against the good of the community. The Open Source movement is working toward most of the same goals, but takes a more pragmatic approach to them. Followers of this movement prefer to base their arguments on the economic and technical merits of making source code freely available, rather than the moral and ethical principles that drive the Free Software Movement.
At the other end of the spectrum are groups that wish to maintain tighter controls over their software.
The Free Software movement is headed by the Free Software Foundation, a fund-raising organization for the GNU project. Free software is more of an ideology. The oft-used expression is “free as in speech, not free as in beer”. In essence, free software is an attempt to guarantee certain rights for both users and developers. These freedoms include the freedom to run the program for any reason, to study and modify the source code, to redistribute the source, and to share any modifications you make. In order to guarantee these freedoms, the GNU General Public License (GPL) was created. The GPL, in brief, provides that anyone distributing a compiled program which is licensed under the GPL must also provide source code, and is free to make modifications to the program as long as those modifications are also made available in source code form. This guarantees that once a program is “opened” to the community, it cannot be “closed” except by consent of every author of every piece of code (even the modifications) within it. Most Linux programs are licensed under the GPL.
It is important to note that the GPL does not say anything about price. As odd as it may sound, you can charge for free software. The “free” part is in the liberties you have with the source code, not in the price you pay for the software. (However, once someone has sold you, or even given you, a compiled program licensed under the GPL they are obligated to provide its source code as well.)
Another popular license is the BSD license. In contrast to the GPL, the BSD license gives no requirement for the release of a program's source code. Software released under the BSD license allows redistribution in source or binary form provided only a few conditions are met. The author's credentials cannot be used as a sort of advertisement for the program. It also indemnifies the author from liability for damages that may arise from the use of the software. Much of the software included in Slackware Linux is BSD licensed.
At the forefront of the younger Open Source movement, the Open Source Initiative is an organization that solely exists to gain support for open source software, that is, software that has the source code available as well as the ready-to-run program. They do not offer a specific license, but instead they support the various types of open source licenses available.
The idea behind the OSI is to get more companies behind open source by allowing them to write their own open source licenses and have those licenses certified by the Open Source Initiative. Many companies want to release source code, but do not want to use the GPL. Since they cannot radically change the GPL, they are offered the opportunity to provide their own license and have it certified by this organization.
While the Free Software Foundation and the Open Source Initiative work to help each other, they are not the same thing. The Free Software Foundation uses a specific license and provides software under that license. The Open Source Initiative seeks support for all open source licenses, including the one from the Free Software Foundation. The grounds on which each argues for making source code freely available sometimes divides the two movements, but the fact that two ideologically diverse groups are working toward the same goal lends credence to the efforts of each.
Often there are times when you might need help with a specific command, setting up a program, or getting a piece of hardware to work. Maybe you simply want to understand a given command better, or see what other options are available to use with it. Luckily, there are a variety of ways that you can get the help you're looking for. When you install Slackware you have the option of installing packages from the “F” series which includes FAQs and HOWTOs. Programs also come with help about their options, configuration files, and usage.
The man command (short for “manual”) is the traditional form of online documentation in Unix and Linux operating systems. Comprised of specially formatted files, the “man pages”, are written for the vast majority of commands and are distributed with the software itself. Executing man somecommand will display the man page for (naturally) the command specified, in our example this would be the imaginary program somecommand.
As you might imagine, the amount of man pages can quickly add up, becoming overly confusing and seriously complicated, even for an advanced user. So, for this reason, man pages are grouped into enumerated sections. This system has been around for a very long time; enough so that you will often see commands, programs, and even programming library functions referred to with their man section number.
For example:
You might see a reference to man(1). The numbering tells you that “man” is documented in section 1 (user commands); you can specify that you want the section 1 man page for “man” with the command man 1 man. Specifying the section that man should look in is useful in the case of multiple items with the same name.
Table 2-1. Man Page Sections
| Section | Contents |
|---|---|
| Section 1 | user commands (intro only) |
| Section 2 | system calls |
| Section 3 | C library calls |
| Section 4 | devices (e.g., hd, sd) |
| Section 5 | file formats and protocols (e.g., wtmp, /etc/passwd, nfs) |
| Section 6 | games (intro only) |
| Section 7 | conventions, macro packages, etc. (e.g., nroff, ascii) |
| Section 8 | system administration (intro only) |
In addition to man(1), there are the commands whatis(1) and apropos(1) available to you, whose shared purpose is to make it easier to find information in the man system.
The command whatis gives a very brief description of system commands, somewhat in the style of a pocket command reference.
Example:
% whatis whatis whatis (1) - search the whatis database for complete words |
The command apropos is used to search for a man page containing a given keyword.
Example:
% apropos wav cdda2wav (1) - a sampling utility that dumps CD audio data into wav sound files netwave_cs (4) - Xircom Creditcard Netwave device driver oggdec (1) - simple decoder, Ogg Vorbis file to PCM audio file (WAV or RAW) wavelan (4) - AT&T GIS WaveLAN ISA device driver wavelan_cs (4) - AT&T GIS WaveLAN PCMCIA device driver wvlan_cs (4) - Lucent WaveLAN/IEEE 802.11 device driver |
If you'd like further information on any of these commands, read their man pages for the details. ;)
The source for most packages that we build comes with some sort of documentation: README files, usage instructions, license files, etc. Any sort of documentation that comes with the source is included and installed on your system in the /usr/doc directory. Each program will (usually) install its own documentation in the order of:
/usr/doc/$program-$version
Where $program is the name of the program you are wanting to read about, and $version is (obviously) the appropriate version of software package installed on your system.
For example, to read the documentation for the command man(1) you would want to cd to:
% cd /usr/doc/man-$version |
If reading the appropriate man page(s) doesn't provide you with enough information, or address what you're looking for in particular, the /usr/doc directory should be your next stop.
It is in the truest spirit of the Open Source community that brings us to the HOWTO/mini-HOWTO collection. These files are exactly what they sound like - documents and guides describing how to do stuff. If you installed the HOWTO collection, the HOWTOs will be installed to /usr/doc/Linux-HOWTOs and the mini-HOWTOs to /usr/doc/Linux-mini-HOWTOs.
Also included in the same package series is a collection of FAQs, which is an acronym which stands for
These documents are written in a “Question and answer” style for (surprise) Frequently Asked Questions. The FAQs can often be a very useful place to look if you're just looking for a “Quick Fix” to something. If you decide to install the FAQs during setup, you will find them installed to the /usr/doc/Linux-FAQs directory.
These files are well worth reading whenever you're not quite sure how to proceed with something. They cover an amazing range of topics, more often than not in a surprisingly detailed manner. Good stuff!
In addition to the documentation provided and installable with the Slackware Linux Operating System, there are a vast multitude of online resources available for you to learn from as well.
The Official Slackware Website
The Official Slackware Linux website is sometimes out of date, but still contains information relevant to the latest Slackware versions. At one time an active help forum existed there before a horde of trolls, troublemakers, and whiners descended on the forum. Maintaining the forum was beginning to be too much work, and so Pat shut it down. One can find that old forum back up and running complete with searchable archives of the old data at http://www.userlocal.com/phorum/.
After the forums were taken down on http://slackware.com, several other sites sprang up that offered forum support for Slackware. After much thought, Pat chose to endorse www.linuxquestions.org as the official forum for Slackware Linux.
Everyone who purchases an official CD set is entitled to free installation support via e-mail from the developer. That having been said, please keep in mind that we, the developers, (and a vast majority of users) of Slackware are of “The Old School”. That means that we prefer to help those who have a sincere interest and are willing to help themselves in the process. We will always do our best to help everyone who emails us with support questions. However, Please check your documentation and the website (especially the FAQs and maybe some of the forums listed below) before e-mailing. You may get a faster answer that way, and the less e-mail we have to answer, obviously the sooner we will be of assistance to those that need it.
The e-mail address for technical support is: support@slackware.com. Other e-mail addresses and contact information are listed on the website.
We have several mailing lists, available in digest and normal forms. Check the instructions for how to subscribe.
To subscribe to a mailing list, email:
majordomo@slackware.com
with the phrase “subscribe [name of list]” in the body of the email. The list choices are described below (use one the names below for the name of the list).
Archives of the mailing list can be found on Slackware's website at:
http://slackware.com/lists/archive/
The slackware-announce mailing list is for announcements of new versions, major updates and other general information.
The slackware-security mailing list is for announcements relating to security issues. Any exploits or other vulnerabilities directly pertaining to Slackware will get posted to this list immediately.
These lists are also available in digest format. This means that you get one large message per day instead of several messages throughout the day. Since the slackware mailing lists do not allow users to post, and the lists are such low traffic, most users find little advantage in the digest lists. Still, they are available if you want them by subscribing to slackware-announce-digest or slackware-security-digest.
The Kung-Fu Master of Search Engines. When you absolutely, positively gotta find every last kernel of information on a subject: Accept no substitutes.
Linux-Specific searches
BSD-Specific searches. Slackware is so generic as a Unix work-a-like operating system that one can as often as not find very detailed information that is almost 100% relevant to Slackware here. Many times a BSD search reveals far more technical information than the often PR-related Linux searches.
Search through decades of Usenet posts for your pearls of wisdom.
A virtual treasure-trove of knowledge, good advice, first-hand experience and interesting articles. Often the first place you'll hear about new developments in the world of Slackware.
The officially sanctioned web-forum for Slackware users.
“A place to download and get help with Linux.”
Another FAQ
Usenet has long been a place for geeks to gather and help one another. There are few newsgroups dedicated to Slackware Linux, but they tend to be filled with very knowledgeable people.
alt.os.linux.slackware
alt.os.linux.slackware, better known as aols (not to be confused with AOL®!) is one of the most active places to find technical help with Slackware problems. Like every Usenet newsgroup, a few unhelpful participants (“trolls”) can mar the experience with constant arguing. Learning to ignore the trolls and identifying the truly helpful people is key to making the most of this resource.
Before you can use Slackware Linux, you'll have to obtain and install it. Getting Slackware is as easy as purchasing it or downloading it for free over the Internet. Installing it is also easy as long as you have some basic knowledge about your computer and are willing to learn a few other things. The installation program itself is very much a step-by-step process. Because of this, you can be up and running very quickly. In fact, Slackware boasts one of the lowest installation times of any full-featured Linux distribution.
The official Slackware Linux CD set is available from Slackware Linux, Inc. The CD set consists of 4 discs. The first disk contains all the software needed for a basic server install, and the X window system. The second cd is a “live” cd; that is, a bootable cd that installs into RAM and gives you a temporary installation to play around with or do a data or machine rescue. This cd also contains a few packages such as the KDE and GNOME desktop environments. A few other goodies are included on the second cd including many non-vital packages in the “extra” folder. The third and fourth CDs contain the source code to all of Slackware, along with the original edition of this book.
One may also purchase a boxed set that includes the 4 discs and a copy of this book, as well as lots of neat Slackware gear to show off your geek pride. CD subscriptions are available at a reduced rate also.
The preferred method for shopping for Slackware merchandise is online at the Slackware store.
You can also call or e-mail your order in.
Slackware Linux is also freely available over the Internet. You may email in your support questions, but higher priority will be given to those who have purchased the official CD set. With that said, we get a lot of e-mails and our time is rather limited. Before e-mailing for support consider reading Chapter 2 first.
The official Slackware Linux Project website is located at:
The primary FTP location for Slackware Linux is:
ftp://ftp.slackware.com/pub/slackware/
Bear in mind that our ftp site, while open for general use, does not have unlimited bandwidth. Please consider using a mirror near you to download Slackware. An incomplete list of mirrors can be found on our site at http://www.slackware.com/getslack.
An easy Slackware installation requires, at minimum, the following:
Table 3-2. System Requirements
| Hardware | Requirement |
|---|---|
| Processor | 586 |
| RAM | 32 MB |
| Disk Space | 1GB |
| Media Drive | 4x CD-ROM |
If you have the bootable CD, you will probably not need a floppy drive. Of course, it stands to reason that if you don't possess a CD-ROM drive, you will need a floppy drive to do a network install. A network card is required for an NFS install. See the section called NFS for more information.
The disk space requirement is somewhat tricky. The 1GB recommendation is usually safe for a minimal install, but if you do a full install, you will need around two gigabytes of available hard disk space plus additional space for personal files.. Most users don't do a full install. In fact, many run Slackware on as little as 100MB of hard disk space.
Slackware can be installed to systems with less RAM, smaller hard drives, and weaker CPUs, but doing so will require a little elbow grease. If you're up for a little work, take a look at the LOWMEM.TXT file in the distribution tree for a few helpful hints.
For reasons of simplicity, Slackware has historically been divided into software series. Once called “disk sets” because they were designed for floppy-based installation, the software series are now used primarily to categorize the packages included in Slackware. Today, floppy installation is no longer possible.
The following is a brief description of each software series.
Table 3-3. Software Series
| Series | Contents |
|---|---|
| A | The base system. Contains enough software to get up and running and have a text editor and basic communication program. |
| AP | Various applications that do not require the X Window System. |
| D | Program development tools. Compilers, debuggers, interpreters, and man pages are all here. |
| E | GNU Emacs. |
| F | FAQs, HOWTOs, and other miscellaneous documentation. |
| GNOME | The GNOME desktop environment. |
| K | The source code for the Linux kernel. |
| KDE | The K Desktop Environment. An X environment which shares a lot of look-and-feel features with MacOS and Windows. The Qt library, which KDE requires, is also in this series. |
| KDEI | Internationalization packages for the KDE desktop. |
| L | Libraries. Dynamically linked libraries required by many other programs. |
| N | Networking programs. Daemons, mail programs, telnet, news readers, and so on. |
| T | teTeX document formatting system. |
| TCL | The Tool Command Language. Tk, TclX, and TkDesk. |
| X | The base X Window System. |
| XAP | X Applications that are not part of a major desktop environment (for example, Ghostscript and Netscape). |
| Y | BSD Console games |
While it was once possible to install all of Slackware Linux from floppy disks, the increasing size of software packages (indeed, of some individual programs) has forced the abandonment of the floppy install. As late as Slackware version 7.1 a partial install was possible using floppy disks. The A and N series could be nearly entirely installed, providing a base system from which to install the rest of the distribution. If you are considering a floppy install (typically on older hardware), it is typically recommended to find another way, or use an older release. Slackware 4.0 is still very popular for this reason, as is 7.0.
Please note that floppy disks are still required for a CD-ROM install if you do not have a bootable CD, as well as for an NFS install.
If you have the bootable CD, available in the official disc set published by Slackware Linux, Inc. (see the section called Getting Slackware), a CD-based installation will be a bit simpler for you. If not, you will need to boot from floppies. Also, if you have special hardware that makes usage of the kernel on the bootable CD problematic, you may need to use specialized floppies.
As of Slackware version 8.1, a new method is used for creating the bootable CDs, which does not work as well with certain flaky BIOS chips (it is worth noting that most all Linux CDs suffer from this these days). If that is the case, we recommend booting from a floppy disk.
Section 3.2.3 and Section 3.2.5 provide information on choosing and creating floppies from which to boot, should this be necessary.
NFS (the Network File System) is a way of making filesystems available to remote machines. An NFS install allows you to install Slackware from another computer on your network. The machine from which you are installing needs to be configured to export the Slackware distribution tree to the machine to which you're installing. This, of course, involves some knowledge of NFS, which is covered in Section 5.6.
It is possible to perform an NFS install via such methods as PLIP (over a parallel port), SLIP, and PPP (though not over a modem connection). However, we recommend the use of a network card if available. After all, installing an operating system through your printer port is going to be a very, very slow process.
The boot disk is the floppy you actually boot from to begin the installation. It contains a compressed kernel image which is used to control the hardware during installation. Therefore, it is very much required (unless you're booting from CD, as is discussed in the section called CD-ROM). The boot disks are located in the bootdisks/ directory in the distribution tree.
There are more Slackware boot disks than you can shake a stick at (which is to say about 16). A complete list of boot disks, with a description of each, is available in the Slackware distribution tree in the file bootdisks/README.TXT. However, most people are able to use the bare.i (for IDE devices) or scsi.s (for SCSI devices) boot disk image.
See Section 3.2.6 for instructions on making a disk from an image.
After booting, you will be prompted to insert the root disk. We recommend that you just humor the boot disk and play along.
The root disks contain the setup program and a filesystem which is used during installation. They are also required. The root disk images are located in the directory rootdisks in the distribution tree. You'll have to make two root disks from the install.1 and install.2 images. Here you can also find the network.dsk, pcmcia.dsk, rescue.dsk, and sbootmgr.dsk disks.
A supplemental disk is needed if you are performing an NFS install or installing to a system with PCMCIA devices. Supplemental disks are in the rootdsks directory in the distribution tree, with the filenames network.dsk and pcmcia.dsk. Recently other supplemental disks such as rescue.dsk and sbootmgr.dsk have been added. The rescue disk is a small floppy root image that runs in a 4MB RAM drive. It includes some basic networking utilities and the vi editor for quick fixes on busted machines. The sbootmgr.dsk disk is used to boot other devices. Boot off this disk if your bootable CD-ROM drive doesn't want to boot the Slackware CDs. It will prompt you for different things to boot and may offer a convenient way to work around a buggy BIOS.
The root disk will instruct you on the use of supplemental disks when it is loaded.
Once you've selected a boot disk image, you need to put it on a floppy. The process is slightly different depending on which operating system you're using to make the disks. If you're running Linux (or pretty much any Unix-like OS) you'll need to use the dd(1) command. Assuming bare.i is your disk image file and your floppy drive is /dev/fd0, the command to make a bare.i floppy is:
% dd if=bare.i of=/dev/fd0 |
If you're running a Microsoft OS, you'll need to use the RAWRITE.EXE program, which is included in the distribution tree in the same directories as the floppy images. Again assuming that bare.i is your disk image file and your floppy drive is A:, open a DOS prompt and type the following:
C:\ rawrite a: bare.i |
After booting from your preferred media, you will need to partition your hard disk. The disk partition is where the Linux filesystem will be created and is where Slackware will be installed. At the very minimum we recommend creating two partitions; one for your root filesystem (/) and one for swap space.
After the root disk finishes loading, it will present you with a login prompt. Log in as root (there is no password). At the shell prompt, run either cfdisk(8) or fdisk(8). The cfdisk program provides a more user-friendly interface than the regular fdisk program, but does lack some features. We will briefly explain the fdisk program below.
Begin by running fdisk for your hard disk. In Linux, the hard disks do not have drive letters, but are represented by a file. The first IDE hard disk (primary master) is /dev/hda, the primary slave is /dev/hdb, and so on. SCSI disks follow the same type system, but are in the form of /dev/sdX. You will need to start fdisk and pass it your hard disk:
# fdisk /dev/hda |
Like all good Unix programs, fdisk gives you a prompt (thought you were getting a menu, right?). The first thing you should do is examine your current partitions. We do that by typing p at the fdisk prompt:
Command (m for help): p |
This will display all sorts of information about your current partitions. Most people pick a free drive to install to and then remove any existing partitions on it to create room for the Linux partitions.
![]() |
IT IS VERY IMPORTANT THAT YOU BACK UP ANY INFORMATION YOU WANT TO SAVE BEFORE DESTROYING THE PARTITION IT LIVES ON. |
There is no easy way to recover from deleting a partition, so always back up before playing with them.
Looking at the table of partition information you should see a partition number, the size of the partition, and its type. There's more information, but don't worry about that for now. We are going to delete all of the partitions on this drive to create the Linux ones. We run the d command to delete those:
Command (m for help): d Partition number (1-4): 1 |
This process should be continued for each of the partitions. After deleting the partitions we are ready to create the Linux ones. We have decided to create one partition for our root filesystem and one for swap. It is worth noting that Unix partitioning schemes are the subject of many flame wars, and that most users will tell you the best way to do it. At a minimum, you should create one partition for / and one for swap. Over time, you'll develop a method that works well for you.
I use two basic partition schemes. The first is for a desktop. I make 4 partitions, /, /home, /usr/local, and swap. This lets me re-install or upgrade the entire installation under / without wiping out my data files under /home or my custom compiled applications under /usr/local. For servers, I often replace the /usr/local partition with a /var partition. Many different servers store information on that partition and having it kept separate from / has certain performance benefits. For now, we're sticking with just two partitions: / and swap.
Now we create the partitions with the n command:
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4):1 First cylinder (0-1060, default 0):0 Last cylinder or +size or +sizeM or +sizeK (0-1060, default 1060):+64M |
You need to make sure you create primary partitions. The first partition is going to be our swap partition. We tell fdisk to make partition number 1 a primary partition. We start it at cylinder 0 and for the ending cylinder we type +64M. This will give us a 64 megabyte partition for swap. (The size of the swap partition you need actually depends on the amount of RAM you have. It is conventional wisdom that a swap space double the size of your RAM should be created.) Then we define primary partition number 2 starting at the first available cylinder and going all the way to the end of the drive.
Command (m for help):n Command action e extended p primary partition (1-4) p Partition number (1-4):2 First cylinder (124-1060, default 124):124 Last cylinder or +size or +sizeM or +sizeK (124-1060, default 1060):1060 |
We are almost done. We need to change the type of the first partition to type 82 (Linux swap). Type t to change the type, select the first partition, and type 82. Before writing your changes to the disk, you should look at the new partition table one last time. Use the p in fdisk to display the partition table. If everything looks good, type w to write your changes to the disk and quit fdisk.
Once you have created your partitions, you are ready to install Slackware. The next step in the installation process is running the setup(8) program. To do so, simply type setup at the shell prompt. setup is a menu-driven system for actually installing the Slackware packages and configuring your system.
The setup process goes something like this: You step through each option in the setup program, in the order they are listed. (Of course, you are free to do things in almost any order you choose, but chances are it isn't going to work out very well.) Menu items are selected using the up and down arrow keys, and the “Okay” and “Cancel” buttons can be chosen by using the left and right arrow keys. Alternatively, each option has a corresponding key, which is highlighted in the option name. Options which are flaggable (those indicated with a [X]) are toggled using the spacebar.
Of course, all of that is described in the “help” section of setup, but we believe in giving our readers their money's worth.
If this is your first time installing Slackware, you might want to take a look at the help screen. It will give a description of each part of setup (much like the one we're writing now, but less involved) and instructions for navigating the rest of the install.
If you require a keymap other than the United States “qwerty” layout, you may want to take a look at this section. It offers a number of alternate layouts for your keyboarding enjoyment.
If you created a swap partition (back in Section 3.3), this section will allow you to enable it. It will autodetect and display the swap partitions on your hard drive, allowing you to select one to format and enable.
The target section is where your other (non-swap) partitions are formatted and mapped to filesystem mount points. A list of the partitions on your hard disk will be displayed. For each partition, you will be given the option of whether to format that partition or not. Depending on the kernel used, you can choose between reiserfs (the default), ext3, ext2, jfs, and xfs. Most people use either reiserfs or ext3. In the near future we may see support for reiserfs4 slip in.
The first option in the target section is the selection of a partition on which to install your root (/) filesystem. After that, you will be able to map other partitions to filesystems as you choose. (For instance, you may want your third partition, say /dev/hda3, to be your home filesystem. This is just an example; map the partitions as you see fit.)
The source section is where you select the source media from which you are installing Slackware. Currently there are four sources to choose from. These are CD-ROM, NFS, or a premounted directory.
The CD-ROM selection enables a CD-ROM based installation. It will offer the option of scanning for a CD-ROM drive or displaying a list from which you can pick your drive type. Make sure you have the Slackware CD in your drive before allowing it to scan.
The NFS selection prompts for your network information and the network information for your NFS server. The NFS server must be set up in advance. Also note that you cannot use hostnames, you must use the IP addresses for both your machine and the NFS server (there is no name resolver on the setup disk). Naturally you must have used the network.dsk floppy to add support for your network controller.
The premounted directory offers the most flexibility. You can use this method to install from things such as Jaz disks, NFS mounts over PLIP, and FAT filesystems. Mount the filesystem to a location of your choosing before running setup, then specify that location here.
The select option allows you to select the software series that you wish to install. These series are described in Section 3.2.1. Please note that you must install the A series to have a working base system. All other series are optional.
Assuming that you have gone through the “target”, “source”, and “select” options, the install option will allow you to select packages from your chosen software series. If not, it will prompt you to go back and complete the other sections of the setup program. This option allows you to select from six different installation methods: full, newbie, menu, expert, custom, and tag path.
The full option will install every package from all the software series that you chose in the “select” section. There is no further prompting. This is the easiest installation method, since you do not need to make any decisions on the actual packages to install. Of course, this option also takes up the most hard drive space.
The next option is newbie. This option installs all of the required packages in the selected series. For all other packages, it offers a prompt where you can select “Yes”, “No”, or “Skip”. Yes and No do the obvious, while Skip will go ahead to the next software series. Additionally, you will see a description and size requirement for each package to help you decide if you need it. We recommend this option for new users, as it ensures that you get all the required packages installed. However, it is a little slow because of the prompting.
Menu is a faster and more advanced version of the newbie option. For each series, a menu is displayed, from which you can select all the non-required packages you want to install. Required packages are not displayed on this menu.
For the more advanced user, install offers the expert option. This allows you complete control over what packages get installed. You can deselect packages that are absolutely required, resulting in a broken system. On the other hand, you can control exactly what goes onto your system. Simply select the packages from each series that you want installed. This is not recommended for the new user, as it is quite easy to shoot yourself in the foot.
The custom and tag path options are also for advanced users. These options allow you to install based upon custom tag files that you created in the distribution tree. This is useful for installing to large numbers of machines fairly quickly. For more information on using tag files, see Section 18.4.
After selecting your installation method, one of a few things will happen. If you selected full or menu, a menu screen will appear, allowing you to select the packages to be installed. If you selected full, packages will immediately start getting installed to the target. If you selected newbie, packages will be installed until an optional package is reached.
Note that it is possible to run out of space while installing. If you selected too many packages for the amount of free space on the target device, you will have problems. The safest thing to do is to select some software and add more later, if you need it. This can easily be done using Slackware's package management tools. For this information, see Chapter 18.
The configure section allows you to do some basic system configuration, now that the packages have been installed. What you see here depends in large part upon which software you have installed. You will, however, always see the following:
Here you will be asked to select a kernel to install. You can install the kernel from the boot disk you used to install, the Slackware CD-ROM, or from another floppy which you (always thinking ahead) have prepared. Or you can elect to skip, in which case the default kernel will be installed and play will continue to the dealer's left.
Making a boot disk for future use is probably a good idea. You will have the option of formatting a floppy and then creating one of two types of boot disk. The first type, simple, simply (go figure) writes a kernel to the floppy. A more flexible (and highly recommended) option is lilo, which will of course create a lilo boot disk. See LILO in Section 7.1 for more information. Of course, you may also choose to simply continue, in which case no boot disk will be made.
You will be prompted for modem information. More specifically, you will be asked whether you have a modem, and if so, what serial port it is on.
These next configuration subsections may or may not appear, depending on whether or not you installed their corresponding packages.
This one's pretty straightforward: you will be asked what time zone you are in. If you operate on Zulu time, we are very sorry; the (extremely long) list is alphabetically ordered, and you're at the bottom.
This subsection simply asks what kind of mouse you have, and whether you want gpm(8) console mouse support enabled on bootup.
This subsection asks if your computer's hardware clock is set to Coordinated Universal Time (UTC or GMT). Most PCs are not, so you should probably say no.
Here you are prompted for installation of LILO (the LInux LOader; see Section 7.1 for more information).
If Slackware is to be the only operating system on your computer, simple should work just fine for you. If you are dual-booting, the expert option is a better choice. See Section 7.3 for more information on dual-booting. The third option, do not install, is not recommended unless you know what you're doing and have a very good reason for not installing LILO. If you are performing an expert install, you will be given a choice as to where LILO will be put. You may place LILO in the MBR (Master Boot Record) of your hard drive, in the superblock of your root Linux partition, or on a floppy disk.
The network configuration subsection is actually netconfig. See Section 5.1 for more information.
This subsection will allow you to choose a default window manager for X. See Chapter 6 for more details on X and window managers.
No matter which packages you installed, the last thing configure will do is ask you whether you want to go ahead and set a root password. For security reasons, this is probably a good idea; however, like almost everything else in Slackware, this is your call.
Before you can configure the more advanced parts of your system, it's a good idea to learn how the system is organized and what commands can be used to search for files and programs. It's also good to know if you need to compile a custom kernel and what the steps for doing that are. This chapter will familiarize you with system organization and configuration files. Then, you can move on to configuring the more advanced parts of the system.
It's important to understand how a Linux system is put together before diving into the various configuration aspects. A Linux system is significantly different from a DOS, Windows, or Macintosh system (with the exception of the Unix-based Mac OS X), but these sections will help you get acquainted with the layout so that you can easily configure your system to meet your needs.
The first noticeable difference between Slackware Linux and a DOS or Windows system is the filesystem. For starters, we do not use drive letters to denote different partitions. Under Linux, there is one main directory. You can relate this to the C: drive under DOS. Each partition on your system is mounted to a directory on the main directory. It's kind of like an ever-expanding hard disk.
We call the main directory the root directory, and it's denoted with a single slash (/). This concept may seem strange, but it actually makes life easy for you when you want to add more space. For example, let's say you run out of space on the drive that has /home on it. Most people install Slackware and make one big root drive. Well, since a partition can be mounted to any directory, you can simply go to the store and pick up a new hard drive and mount it to /home. You've now grafted on some more space to your system. And all without having to move many things around.
Below, you will find descriptions of the major top level directories under Slackware.
Essential user programs are stored here. These represent the bare minimum set of programs required for a user to use the system. Things like the shell and the filesystem commands (ls, cp, and so on) are stored here. The /bin directory usually doesn't receive modification after installation. If it does, it's usually in the form of package upgrades that we provide.
Files that are used by the Linux Loader (LILO). This directory also receives little modification after an installation. The kernel is stored here as of Slackware 8.1. In earlier releases of Slackware, the kernel was simply stored under / , but common practice is to put the kernel and related files here to facilitate dual-booting.
Everything in Linux is treated as a file, even hardware devices like serial ports, hard disks, and scanners. In order to access these devices, a special file called a device node has to be present. All device nodes are stored in the /dev directory. You will find this to be true across many Unix-like operating systems.
This directory holds system configuration files. Everything from the X Window configuration file, the user database, to the system startup scripts. The system administrator will become quite familiar with this directory over time.
Linux is a multiuser operating system. Each user on the system is given an account and a unique directory for personal files. This directory is called the user's home directory. The /home directory is provided as the default location for user home directories.
System libraries that are required for basic operation are stored here. The C library, the dynamic loader, the ncurses library, and kernel modules are among the things stored here.
This directory contains temporary mount points for working on hard disks or removable drives. Here you'll find mount points for your CD-ROM and floppy drives.
Optional software packages. The idea behind /opt is that each software package installs to /opt/software-package, which makes it easy to remove later. Slackware distributes some things in /opt (such as KDE in /opt/kde), but you are free to add anything you want to /opt.
This is a unique directory. It's not really part of the filesystem, but a virtual filesystem that provides access to kernel information. Various pieces of information that the kernel wants you to know are conveyed to you through files in the /proc directory. You can also send information to the kernel through some of these files. Try doing cat /proc/cpuinfo.
The system administrator is known as root on the system. root's home directory is kept in /root instead of /home/root. The reason is simple. What if /home was a different partition from / and it could not be mounted? root would naturally want to log in and repair the problem. If his home directory was on the damaged filesystem, it would make it difficult for him to log in.
Essential programs that are run by root and during the system bootup process are kept here. Normal users will not run programs in this directory.
The temporary storage location. All users have read and write access to this directory.
This is the big directory on a Linux system. Everything else pretty much goes here, programs, documentation, the kernel source code, and the X Window system. This is the directory to which you will most likely be installing programs.
System log files, cache data, and program lock files are stored here. This is the directory for frequently-changing data.
You should now have a good feel for which directories contain what on the filesystem. More detailed information about the filesystem layout is available in the hier(7) man page. The next section will help you find specific files easily, so you don't have to do it by hand.
You now know what each major directory holds, but it still doesn't really help you find things. I mean, you could go looking through directories, but there are quicker ways. There are four main file search commands available in Slackware.
The first is the which(1) command. which is usually used to locate a program quickly. It just searches your PATH and returns the first instance it finds and the directory path to it. Take this example:
% which bash /bin/bash |
From that you see that bash is in the /bin directory. This is a very limited command for searching, since it only searches your PATH.
The whereis(1) command works similar to which, but can also search for man pages and source files. A whereis search for bash should return this:
% whereis bash bash: /bin/bash /usr/bin/bash /usr/man/man1/bash.1.gz |
This command not only told us where the actual program is located, but also where the online documentation is stored. Still, this command is limited. What if you wanted to search for a specific configuration file? You can't use which or whereis for that.
The find(1) command allows the user to search the filesystem with a rich collection of search predicates. Users may specify a search with filename wildcards, ranges of modification or creation times, or other advanced properties. For example, to search for the default xinitrc file on the system, the following command could be used.
% find / -name xinitrc /var/X11R6/lib/xinit/xinitrc |
find will take a while to run, since it has to traverse the entire root directory tree. And if this command is run as a normal user, there will be permission denied error messages for directories that only root can see. But find found our file, so that's good. If only it could be a bit faster...
The slocate(1) command searches the entire filesystem, just like the find command can do, but it searches a database instead of the actual filesystem. The database is set to automatically update every morning, so you have a somewhat fresh listing of files on your system. You can manually run updatedb(1) to update the slocate database (before running updatedb by hand, you must first su to the root user). Here's an example of slocate in action:
% slocate xinitrc # we don't have to go to the root /var/X11R6/lib/xinit/xinitrc /var/X11R6/lib/xinit/xinitrc.fvwm2 /var/X11R6/lib/xinit/xinitrc.openwin /var/X11R6/lib/xinit/xinitrc.twm |
We got more than what we were looking for, and quickly too. With these commands, you should be able to find whatever you're looking for on your Linux system.
The system initialization files are stored in the /etc/rc.d directory. Slackware uses the BSD-style layout for its initialization files as opposed to System V init scripts, which tend to make configuration changes much more difficult without using a program specifically designed for that purpose. In BSD-init scripts, each runlevel is given a single rc file. In System V, each runlevel is given its own directory, each containing numerous init scripts. This provides an organized structure that is easy to maintain.
There are several categories of initialization files. These are system startup, runlevels, network initialization, and System V compatibility. As per tradition, we'll lump everything else into another category.
The first program to run under Slackware besides the Linux kernel is init(8). This program reads the /etc/inittab(5) file to see how to run the system. It runs the /etc/rc.d/rc.S script to prepare the system before going into your desired runlevel. The rc.S file enables your virtual memory, mounts your filesystems, cleans up certain log directories, initializes Plug and Play devices, loads kernel modules, configures PCMCIA devices, sets up serial ports, and runs System V init scripts (if found). Obviously rc.S has a lot on its plate, but here are some scripts in /etc/rc.d that rc.S will call on to complete its work:
This is the actual system initialization script.
Loads kernel modules. Things like your network card, PPP support, and other things are loaded here. If this script finds rc.netdevice, it will run that as well.
Probes for and configures any PCMCIA devices that you might have on your system. This is most useful for laptop users, who probably have a PCMCIA modem or network card.
Configures your serial ports by running the appropriate setserial commands.
Looks for System V init scripts for the desired runlevel and runs them. This is discussed in more detail below.
After system initialization is complete, init moves on to runlevel initialization. A runlevel describes the state that your machine will be running in. Sound redundant? Well, the runlevel tells init if you will be accepting multiuser logins or just a single user, whether or not you want network services, and if you will be using the X Window System or agetty(8) to handle logins. The files below define the different runlevels in Slackware Linux.
Halt the system (runlevel 0). By default, this is symlinked to rc.6.
Multiuser startup (runlevel 4), but in X11 with KDM, GDM, or XDM as the login manager.
Reboot the system (runlevel 6).
Startup in single user mode (runlevel 1).
Multiuser mode (runlevels 2 and 3), but with the standard text-based login. This is the default runlevel in Slackware.
Runlevels 2, 3, and 4 will start up the network services. The following files are responsible for the network initialization:
Created by netconfig, this file is responsible for configuring the actual network interface.
Runs after rc.inet1 and starts up basic network services.
Starts up AppleTalk services.
Starts up the Apache web server. Like a few other rc scripts, this one can also be used to stop and restart a service. rc.httpd takes arguments of stop, start, or restart.
Starts up the news server.
System V init compatibility was introduced in Slackware 7.0. Many other Linux distributions make use of this style instead of the BSD style. Basically each runlevel is given a subdirectory for init scripts, whereas BSD style gives one init script to each runlevel.
The rc.sysvinit script will search for any System V init scripts you have in /etc/rc.d and run them, if the runlevel is appropriate. This is useful for certain commercial software packages that install System V init scripts
The scripts described below are the other system initialization scripts. They are typically run from one of the major scripts above, so all you need to do is edit the contents.
Starts up general purpose mouse services. Allows you to copy and paste at the Linux console. Occasionally, gpm will cause problems with the mouse when it is used under X windows. If you experience problems with the mouse under X, try taking away the executable permission from this file and stopping the gpm server.
Loads the custom screen font for the console.
Contains any specific startup commands for your system. This is empty after a fresh install, as it is reserved for local administrators. This script is run after all other initialization has taken place.
To enable a script, all you need to do is add the execute permissions to it with the chmod command. To disable a script, remove the execute permissions from it. For more information about chmod, see Section 9.2.
The kernel is the part of the operating system that provides hardware access, process control, and overall system control. The kernel contains support for your hardware devices, so picking one for your system is an important setup step.
Slackware provides more than a dozen precompiled kernels that you can pick from, each with a standard set of drivers and additional specific drivers. You can run one of the precompiled kernels or you can build your own kernel from source. Either way, you need to make sure that your kernel has the hardware support your system needs.
The precompiled Slackware kernels are available in the /kernels directory on the Slackware CD-ROM or on the FTP site in the main Slackware directory. The available kernels change as new releases are made, so the documentation in that directory is always the authoritative source. The /kernels directory has subdirectories for each kernel available. The subdirectories have the same name as their accompanying boot disk. In each subdirectory you will find the following files:
| File | Purpose |
|---|---|
| System.map | The system map file for this kernel |
| bzImage | The actual kernel image |
| config | The source configuration file for this kernel |
To use a kernel, copy the System.map and config files to your /boot directory and copy the kernel image to /boot/vmlinuz. Run /sbin/lilo(8) to install LILO for the new kernel, and then reboot your system. That's all there is to installing a new kernel.
The kernels that end with a .i are IDE kernels. That is, they include no SCSI support in the base kernel. The kernels that end with .s are SCSI kernels. They include all the IDE support in .i kernels, plus SCSI support.
The question “Should I compile a kernel for my system?” is often asked by new users. The answer is a definite maybe. There are few instances where you will need to compile a kernel specific to your system. Most users can use a precompiled kernel and the loadable kernel modules to achieve a fully working system. You will want to compile a kernel for your system if you are upgrading kernel versions to one that we do not currently offer in Slackware, or if you have patched the kernel source to get special device support that is not in the native kernel source. Anyone with an SMP system will definitely want to compile a kernel with SMP support. Also, many users find a custom compiled kernel runs much faster on their machine. You may find it useful to compile the kernel with optimizations for the specific processor in your machine.
Building your own kernel is not that hard. The first step is to make sure you have the kernel source installed on your system. Make sure that you installed the packages from the K series during the installation. You will also want to make sure you have the D series installed, specifically the C compiler, GNU make, and GNU binutils. In general, it's a good idea to have the entire D series installed if you plan on doing any kind of development. You can also download the latest kernel source from http://www.kernel.org/mirrors.
% su - Password: # cd /usr/src/linux |
The first step is to bring the kernel source into its base state. We issue this command to do that (note, you may wish to back-up the .config file as this command will delete it without warning):
# make mrproper |
Now you can configure the kernel for your system. The current kernel offers three ways of doing this. The first is the original text-based question and answer system. It asks a bunch of questions and then builds a configuration file. The problem with this method is that if you mess up, you must start over. The method that most people prefer is the menu driven one. Lastly, there is an X-based kernel configuration tool. Pick the one you want and issue the appropriate command:
# make config (text-based Q&A version) # make menuconfig (menu driven, text-based version) # make xconfig (X-based version, make sure you are in X first) |
New users will probably find menuconfig to be the easiest to use. Help screens are provided that explain the various parts of the kernel. After configuring your kernel, exit the configuration program. It will write the necessary configuration files. Now we can prepare the source tree for a build:
# make dep # make clean |
The next step is to compile the kernel. First try issuing the bzImage command below.
# make bzImage |
This may take a while, depending on your CPU speed. During the build process, you will see the compiler messages. After building the kernel image, you will want to build any parts of the kernel that you flagged as modular.
# make modules |
We can now install the kernel and modules that you compiled. To install the kernel on a Slackware system, these commands should be issued:
# mv /boot/vmlinuz /boot/vmlinuz.old # cat arch/i386/boot/bzImage > /vmlinuz # mv /boot/System.map /boot/System.map.old # cp System.map /boot/System.map # make modules_install |
You will want to edit /etc/lilo.conf and add a section to boot your old kernel in case your new one does not work. After doing that, run /sbin/lilo to install the new boot block. You can now reboot with your new kernel.
The compilation of a 2.6 kernel is only slightly different from a 2.4 or a 2.2 kernel, but it is important that you understand the differences before delving in. It's no longer necessary to run make dep and make clean. Also, the kernel compilation process is not as verbose in the 2.6 kernel series. This results in a build process that is easier to understand, but has some short comings as well. If you have trouble building the kernel, it's highly recommended that you turn verbosity back up. You do this simply by appending V=1 to the build. This allows you to log more information that could help a kernel developer or other friendly geek aid you in resolving the issue.
# make bzImage V=1 |
Kernel modules are another name for device drivers that can be inserted into a running kernel. They allow you to extend the hardware supported by your kernel without needing to pick another kernel or compile one yourself.
Modules can also be loaded and unloaded at any time, even when the system is running. This makes upgrading specific drivers easy for system administrators. A new module can be compiled, the old one removed, and the new one loaded, all without rebooting the machine.
Modules are stored in the /lib/modules/kernel version directory on your system. They can be loaded at boot time through the rc.modules file. This file is very well commented and offers examples for major hardware components. To see a list of modules that are currently active, use the lsmod(1) command:
# lsmod Module Size Used by parport_pc 7220 0 parport 7844 0 [parport_pc] |
You can see here that I only have the parallel port module loaded. To remove a module, you use the rmmod(1) command. Modules can be loaded by the modprobe(1) or insmod(1) command. modprobe is usually safer because it will load any modules that the one you're trying to load depends on.
A lot of users never have to load or unload modules by hand. They use the kernel autoloader for module management. By default, Slackware includes kmod in its kernels. kmod is a kernel option that enables the kernel to automatically load modules as they are requested. For more information on kmod and how it is configured, see /usr/src/linux/Documentation/kmod.txt. You'll have needed to have the kernel source package, or downloaded kernel source from