Copyright © 2002-2008 Daniël de Kok
License
Redistribution and use in textual and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of this book must retain the above copyright notice, this list of conditions and the following disclaimer.
The names of the authors may not be used to endorse or promote products derived from this book without specific prior written permission.
THIS BOOK IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS BOOK, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Linux is a registered trademark of Linus Torvalds. Slackware Linux is a registered trademark of Patrick Volkerding and Slackware Linux, Inc. UNIX is a registered trademark of The Open Group.
Thu Jul 3 18:24:44 CEST 2008
Table of Contents
List of Figures
List of Tables
This book aims to provide an introduction to Slackware Linux. It addresses people who have little or no GNU/Linux experience, and covers the Slackware Linux installation, basic GNU/Linux commands and the configuration of Slackware Linux. After reading this book, you should be prepared to use Slackware Linux for your daily work, and more than that. Hopefully this book is useful as a reference to more experienced Slackware Linux users as well.
Thanks to the rapid development of open source software, there are now comprehensive desktop environments and applications for GNU/Linux. Most current distributions and books focus on using GNU/Linux with such environments. I chose to ignore most of the graphical applications for this book, and tried to focus this book on helping you, as a reader, to learn using GNU/Linux in a more traditional UNIX-like way. I am convinced that this approach is often more powerful, and helps you to learn GNU/Linux well, and not just one distribution or desktop environment. The UNIX philosophy is described in the overview of UNIX philosophy
I wish everybody a good time with Slackware Linux, and I hope that you will find this book is useful for you.
Daniël de Kok
Table of Contents
Table of Contents
This book was written in DocBook/XML, and converted to HTML and XSL:FO with xsltproc. The latest version of the book is always available from: http://www.slackbasics.org/.
This section gives a short summary of the conventions in this book.
Screen output is printed like this:
Hello world!
If commands are being entered in the screen output the commands will be printed as bold text:
$ command
Output
If a command is executed as root, the shell will be displayed as “#”. If a command is executed as a normal non-privileged user, the shell will be displayed as “$”.
Table of Contents
Linux is a UNIX-like kernel, which is written by Linus Torvalds and other developers. Linux runs on many different architectures, for example on IA32, IA64, Alpha, m68k, SPARC and PowerPC machines. The latest kernel and information about the Linux kernel can be found on the Linux kernel website: http://www.kernel.org.
The Linux kernel is often confused with the GNU/Linux operating system. Linux is only a kernel, not a complete operating system. GNU/Linux consists of the GNU operating system with the Linux kernel. The following section gives a more extensive description of GNU/Linux.
In 1984 Richard Stallman started an ambitious project with the goal to write a free UNIX-like operating system. The name of this system is GNU, which is an acronym of “GNU's Not UNIX”. Around 1990, all major components of the GNU operating system were written, except the kernel. Two years earlier, in 1988, it was decided that the GNU project would use the Mach 3.0 microkernel as the foundation of its kernel. However, it took until 1991 for Mach 3.0 to be released under a free software license. In the the same year Linus Torvalds started to fill the kernel gap in the GNU system by writing the Linux kernel. GNU/Linux thus refers to a GNU system running with the Linux kernel.
The GNU kernel, named “HURD” was still under development when this book was written, and is available as the GNU/HURD operating system. There are some other kernels that are ported to the GNU operating system as well. For instance, the Debian project has developed a version of the GNU operating system that works with the NetBSD kernel.
Slackware Linux is a GNU/Linux distribution, which is maintained and developed by Patrick Volkerding. A distribution is a coherent collection of software that provides a usable GNU/Linux system. Volkerding started using GNU/Linux because he needed a LISP interpreter for a project. At the time the dominant GNU/Linux distribution was Softlanding System Linux (SLS Linux). Slackware Linux started out as a private collection of Volkerding's patches for SLS Linux. The first publicly available Slackware Linux release was 1.0, which was released on July 16, 1993.
In contrast to many other GNU/Linux distributions, Slackware Linux adheres to the so-called KISS (Keep It Simple Stupid) principle. This means that Slackware Linux does not have complex graphical tools to configure the system. As a result the learning curve of Slackware Linux can be high for inexperienced GNU/Linux users, but it provides more transparency and flexibility. Besides that you get a deeper understanding of GNU/Linux with no-frills distributions like Slackware Linux.
Another distinguishing aspect of Slackware Linux, that also “complies” with the KISS principle, is the Slackware Linux package manager. Slackware Linux does not have a complex package manager like RPM or dpkg. Packages are normal tgz (tar/gzip) files, often with an additional installation script and a package description file. For novice users tgz is much more powerful than RPM, and avoids dependency problems. Another widely known feature of Slackware Linux is its initialization scripts. In contrast to most other GNU/Linux distributions Slackware Linux does not have a directory for each runlevel with symbolic links to services that have to be started or killed in that runlevel. It uses a simpler approach in which you can enable or disable services by twiddling the executable bit of an initialization script.
The packages in Slackware Linux are compiled with as little modifications as possible. This means you can use most general GNU/Linux documentation.
Since GNU/Linux is a free reimplementation of the UNIX operating system, it is a good idea to look at the philosophy that made UNIX widely loved. Doug McIlroy summarized the UNIX philosophy in three simple rules:
Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface.
Odds are that you do not intend to write programs for GNU/Linux. However, even as a user these basic UNIX rules can mean a lot to you. Once you get to know the essential commands that have been part of UNIX for many years, you will be able to combine simple programs to solve complex problems. Keep this in mind while you learn Slackware Linux; try to get a feeling for how you can divide complex tasks in simple combined operations.
Most packages in Slackware Linux are published under a free software or open source license. Under these licenses software may be used, studied, changed and distributed freely. Practically, this means that the software is available and redistributable in source and binary form. Although the free software and open source software movements share many licenses and principles, there are subtle differences between both movements. The open source movement tends to focus on the economic and technical advantages of sharing source code, while the free software movement puts accent on the ethical side of providing sources and binaries freely. As the GNU website puts it: “Free software is a matter of liberty, not price. To understand the concept, you should think of free as in free speech, not as in free beer.[1]” In the spirit of free and open source software the source code of almost all packages is included in the official Slackware Linux CD set or DVD.
Linux 2.6.21.5 - Slackware Linux uses as modern high-performance Linux kernel. The kernel includes support for all modern disk controllers, LVM, Software RAID, encrypted disks, and multiple processors/cores. By default, udev is enabled for automatic management of device nodes.
HAL - the HAL (Hardware Abstraction Layer) is now included too. This provides a uniform API for desktop applications to use hardware. It makes automatic mounting of disks and CDs considerably easier under Xfce and KDE.
X11 7.2.0 - This is the first version of Slackware Linux to use modular X. This means that the X11 components are separated in many small packages for easier maintenance and lighter weight upgrades.
GCC 4.1.2 - Slackware Linux 12.0 includes a completely revised toolchain based on the GNU Compiler Collection 4.1.2. GCC provides C, C++, Objective-C, Fortran-77/95, and Ada 95 compilers. Additionally, version 2.5 of the GNU C library is used.
Apache 2.2.4 - Apache was upgraded to a new major version. Apache 2.x is a substantial rewrite of the old 1.3.x series.
The K Desktop Environment (KDE) 3.5.7 - The full KDE environment is provided, which includes KOffice, the Konqueror web browser, multimedia programs, development tools, and many more useful applications.
Xfce 4.4.1 - Xfce is a lightweight desktop environment based on GTK2. It embodies the UNIX spirit of modularity and reusability.
Slackware Linux is freely downloadable from the official Slackware Linux mirrors. The list of Slackware mirrors is available at http://www.slackware.com/getslack/.
You can also order Slackware Linux as a CD set or DVD from the Slackware Store. Many Internet shops also provide Slackware Linux cheaply on CD-ROM or DVD, but you are only supporting Slackware Linux financially if you buy an official CD set or DVD. The Slackware Store also offers Slackware Linux subscriptions. A subscriber automatically receives new Slackware Linux releases at a reduced price.
If you would like to have more information about purchasing Slackware Linux, visit the Slackware Store website at http://store.slackware.com/.
Table of Contents
There is a wealth of information available about many subjects related to GNU/Linux. Most general documentation applies to Slackware Linux, because the software in the distribution has been compiled from source code that has been altered as little as possible. This chapter provides some pointers to information and documentation that can be found on an installed Slackware Linux system, and on the Internet.
The Linux HOWTOs are a collection of documents which cover
specific subjects related to GNU/Linux. Most Linux HOWTOs are
not tailored to a specific distribution, therefore they are
very useful for Slackware Linux users. The
linux-howtos package in the
“f” software set contains the HOWTO
collection. After installing this package the HOWTOs are
available from the /usr/doc/Linux-HOWTOs//usr/doc/Linux-FAQs/
Most UNIX-like commands are covered by a traditional UNIX help system called the manual pages. You can read the manual page of a program with the man command. Executing man with the name of a command as an argument shows the manual page for that command. For instance,
$ man ls
shows the manual page of the ls command.
If you do not know the exact name of a manual page or command,
you can search through the manual pages with a keyword. The
-k option is provided
to make use of this facility:
$ man -k rmdir
hrmdir (1) - remove an empty HFS directory
rmdir (1) - remove empty directories
rmdir (2) - delete a directory
The manual page collection is very extensive, and covers more subjects than just commands. The following sections of manual pages are available:
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conven-
tions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Linux routines [Non standard]
If there is more than one section that has a manual page with a specific name, as with for instance rmdir, you can choose what page you want to see by adding the section number of the manual page before the manual page name. For example:
man 2 rmdir
If you would like to print a manual page to a printer that you
have set up, you can pipe the output of man
to the lpr command. When the -t option of the
man command is used, man
will output the manual page in Postscript format, rather than
ASCII. For example, you can use the following command to print
the cat manual page:
$ man -t cat | lpr
There are many websites and forums related to GNU/Linux and Slackware Linux on the Internet. But many sites often disappear as fast as they appeared, and the information on many web sites is fragmentary. The following resources have been around for a longer time, and provide good content.
The Slackware Linux website may be a bit outdated at times, but it provides many useful resources:
A news page that announces new releases and lists other important news that is relevant to Slackware Linux.
An overview of the changes to the distribution is provided in a structured format called a ChangeLog. ChangeLogs are provided for the current development version, as well as the latest stable release.
There are two mailing lists to which you can subscribe. The slackware-announce list is used to announce new Slackware Linux releases, and security updates are announced on the slackware-security list.
A list of mirrors where you can download Slackware Linux. The mirrors are indexed per country. Additional information such as the download protocols the mirrors support, and the speed of the mirrors is also included.
Documentation of various kinds, including a list of frequently asked questions and the Slackware Linux Essentials book.
The Slackware Linux website is available at: http://www.slackware.com/
LinuxQuestions is a large GNU/Linux forum with many helpful members. Particularly interesting is the Slackware Linux subforum, where you can seek assistance to help you with problems that you may have with Slackware Linux. The LinuxQuestions forum is available at: http://www.linuxquestions.org/
alt.os.linux.slackware is a Slackware Linux newsgroup. You can read newsgroups with a newsreader like tin or slrn, through the newsgroup server of your Internet service provider. On this newsgroup it is expected that you have read all necessary documentation before posting questions. If you have not done that, the chance of getting “flamed” is large.
Table of Contents
This chapter gives an introduction to some general UNIX and GNU/Linux concepts. It is important to read this chapter thoroughly if you do not have any UNIX or GNU/Linux experience. Many concepts covered in this chapter are used in this book and in GNU/Linux.
One of UNIX's traditional strengths is multitasking. Multitasking means that multiple programs can be run at the same time. You may wonder why this is important, because most people use only one application at a time. Multitasking is a bare necessity for UNIX-like systems. Even if you have not started any applications, there are programs that run in the background. For instance, some programs provide network services, while others show a login prompt and wait until a user logs in on a (virtual) terminal. Programs that are running in the background are often called daemon processes[2].
After a program is loaded from a storage medium, an instance of the program is started. This instance is called a process. A process has its own protected memory, named the process address space. The process address space has two important areas: the text area and the data area. The text area is the actual program code; it is used to tell the system what to do. The data area is used to store constant and runtime data. The operating system gives every process time to execute. On single processor systems processes are not really running simultaneously. In reality a smart scheduler in the kernel divides CPU time among processes, giving the illusion that processes run simultaneously. This process is called time-sharing. On systems with more than one CPU or CPU cores, more than one process can run simultaneously, but time-sharing is still used to divide the available CPU time among processes.
New processes are created by duplicating a running process with the fork system call. Figure 4.1, “Forking of a process” shows a fork() call in action schematically. The parent process issues a fork() call. The kernel will respond to this call by duplicating the process, and naming one process the parent, and the other process the child.
Forking can be used by a program to create two processes that can run simultaneously on multiprocessor machines. However, this is often not ideal, because both processes will have their own process address space. The initial duplication of the process memory takes relatively much time, and it is difficult to share data between two processes. This problem is solved by a concept named multithreading. Multithreading means that multiple instances of the text area can run at the same time, sharing the data area. These instances, named threads, can be executed in parallel on multiple CPUs.
Operating systems store data in filesystems. A filesystem is basically a tree-like structure of directories that hold files, like the operating system, user programs and user data. Most filesystems can also store various metadata about files and directories, for instance access and modification times. In GNU/Linux there is only one filesystem hierarchy, this means GNU/Linux does not have drive letters (e.g. A:, C:, D:) for different filesystems, like DOS and Windows. The filesystem looks like a tree, with a root directory (which has no parent directory), branches, and leaves (directories with no subdirectories). The root directory is alway denoted with a slash (“/”). Directories are separated by the same character.
Figure 4.2, “The filesystem structure” shows the structure of
a filesystem. You can see that the root directory
/binhomehomejoejackmemo.txt/home/jack/home/jack/memo.txt
Each directory has two special entries,
“...jack/home/joe../joe
You might wonder how it is possible to access other devices
or partitions than the hard disk partition which holds the
root filesystem. Linux uses the same approach as UNIX for
accessing other filesystems. Linux allows the system
administrator to connect a device to any directory in the
filesystem structure. This process is named
mounting. For example, one could mount
the CD-ROM drive to the /cdrom
The Filesystem Hierarchy Standard Group has attempted to create a standard that describes which directories should be available on a GNU/Linux system. Currently, most major distributions use the Filesystem Hierarchy Standard (FHS) as a guideline. This section describes some mandatory directories on GNU/Linux systems.
Please note that GNU/Linux does not have a separate directory
for each application (like Windows). Instead, files are ordered by
function and type. For example, the binaries for most
common user programs are stored in
/usr/bin/usr/lib
/bin: essential
user binaries that should still be available in case the
/usr
/dev: device files. These are special files used to access certain devices.
/etc: the
/etc
/home: contains home directories for individual users.
/lib: essential system libraries (like glibc), and kernel modules.
/root: home directory for the root user.
/sbin: essential binaries that are used for system administration.
/tmp: a world-writable directory for temporary files.
/usr/bin: stores the majority of the user binaries.
/usr/lib: libraries that are not essential for the system to boot.
/usr/sbin: nonessential system administration binaries.
/var: variable data files, like logs.
In GNU/Linux virtually everything is represented as a file, including
devices. Every GNU/Linux system has a directory with special files, named
/dev/dev/dev/zero
$ file /dev/zero
/dev/zero: character special (1/5)
The file command can be used to determine the type of a file. This particular file is recognized as a device file that has 1 as the major device number, and 5 as the minor device number.
If you have installed the kernel source package, you can find
a comprehensive list of all major devices with their minor and
major numbers in
/usr/src/linux/Documentation/devices.txt
The Linux kernel handles two types of devices: character and block devices. Character devices can be read byte by byte, block devices can not. Block devices are read per block (for example 4096 bytes at a time). Whether a device is a character or block device is determined by the nature of the device. For example, most storage media are block devices, and most input devices are character devices. Block devices have one distinctive advantage, namely that they can be cached. This means that commonly read or written blocks are stored in a special area of the system memory, named the cache. Memory is much faster than most storage media, so much performance can be gained by performing common block read and write operations in memory. Of course, eventually changes have to be written to the storage media to reflect the changes that were made in the cache.
There are two kinds of block devices that we are going to look into in detail, because understanding the naming of these devices is crucial for partitioning a hard disk and mounting. Almost all modern computers with an x86 architecture use ATA hard disks and CD-ROMs. Under Linux these devices are named in the following manner:
/dev/hda - master device on the first ATA channel
/dev/hdb - slave device on the first ATA channel
/dev/hdc - master device on the second ATA channel
/dev/hdd - slave device on the second ATA channel
On most computers with a single hard disk, the hard disk is the master
device on the first ATA channel (/dev/hda/dev/hda1/dev/hda
SCSI hard disks and CD-ROM drives follow an other naming convention. SCSI is not commonly used in most low-end machines, but USB drives and Serial ATA (SATA) drives are also represented as SCSI disks. The following device notation is used for SCSI drives:
/dev/sda - First SCSI disk
/dev/sdb - Second SCSI disk
/dev/sdc - Third SCSI disk
/dev/scd0 - First CD-ROM
/dev/scd1 - Second CD-ROM
/dev/scd2 - Third CD-ROM
Partitions names are constructed in the same way as ATA disks;
/dev/sda1
If you use the software RAID implementation of the Linux kernel, RAID
volumes are available as /dev/mdn
[2] The word daemon should not to be confused with the word demon, the word daemon refers to supernatural beings in Greek mythology.
Table of Contents
The easiest method for booting the installation system is by using the installation CD-ROM. The Slackware Linux installation CD-ROM is a bootable CD, which means that the BIOS can boot the CD, just like it can boot, for example, a floppy disk. Most modern systems have a BIOS which supports CD-ROM booting.
If the CD is not booted when you have the CD inserted in the CD-ROM drive during the system boot, the boot sequence is probably not correctly configured in the BIOS. Enter the BIOS setup (usually this can be done by holding the <Del> or <Esc> key when the BIOS screen appears) and make sure the CD-ROM is on the top of the list in the boot sequence. If you are using a SCSI CD-ROM you may have to set the boot sequence in the SCSI BIOS instead of the system BIOS. Consult the SCSI card manual for more information.
When the CD-ROM is booted, a pre-boot screen will
appear. Normally you can just press <ENTER> to proceed
loading the default (hugesmp.s
Table 5.1. Installation kernels
| Linux | Description |
|---|---|
| huge.s | Previously, there were specific kernels for different sets of disk controlers. The new huge kernels include support for all common ATA, SATA and SCSI controllers. This kernel does not have SMP support, and works on i486 and newer CPUs. If you have a Pentium Pro or newer CPU, it is recommended to use the hugesmp.s kernel, even on uniprocessor systems. |
| hugesmp.s | The hugesmp.s kernel has support for common ATA, SATA, and SCSI controllers. Additionally, this kernel has SMP support. This is the recommended kernel on Pentium Pro and newer CPUs. |
| speakup.s | This kernel is comparable to the huge.s kernel, but also includes support for hardware speech synthesizers. |
After booting the installation system, you will be asked whether you are using a special (national) keyboard layout or not. If you have a normal US/International keyboard, which is the most common, you can just press <Enter> at this question. After that the login prompt will appear. Log on as “root”, no password will be requested. After login, the shell is started and you can begin installing Slackware Linux. The installation procedure will be explained briefly in this chapter.
Installing Slackware Linux requires at least one Linux partition, creating a swap partition is also recommended. To be able to create a partition there has to be free unpartitioned space on the disk. There are some programs that can resize partitions. For example, FIPS can resize FAT partitions. Commercial programs like Partition Magic can also resize other partition types.
After booting the Slackware Linux CD-ROM and logging on, there are two partitioning programs at your disposal: fdisk and cfdisk. cfdisk is the easiest of both, because it is controlled by a menu interface. This section describes the cfdisk program.
To partition the first harddisk you can simply execute
cfdisk. If you want to partition another disk
or a SCSI disk you have to specify which disk you want to
partition (cfdisk /dev/device). ATA hard
disks have the following device naming:
/dev/hdn/dev/hda/dev/hdd/dev/sdn
After starting cfdisk, the currently existing partitions are shown, as well as the amount of free space. The list of partitions can be navigated with the “up” and “down” arrow keys. At the bottom of the screen some commands are displayed, which can be browsed with the “left” and “right” arrow keys. A command can be executed with the <Enter> key.
You can create a Linux partition by selecting “Free Space” and executing the “New” command. cfdisk will ask you whether you want to create a primary or logical partition. The number of primary partitions is limited to four. Linux can be installed on both primary and logical partitions. If you want to install other operating systems besides Slackware Linux that require primary partitions, it is a good idea to install Slackware Linux onto a logical partition. The type of the new partition is automatically set to “Linux Native”, so it is not necessary to set the partition type.
The creation of a swap partition involves the same steps as a normal Linux partition, but the type of the partition has to be changed to “Linux Swap” after the partition is created. The suggested size of the swap partition depends on your own needs. The swap partition is used to store programs if the main (RAM) memory is full. If you have a harddisk of a reasonable size, it is a good idea to make a 256MB or 512MB swap partition, which should be enough for normal usage. After creating the partition, the partition type can be changed to “Linux Swap” by selecting the “Type” command. The cfdisk program will ask for the type number. “Linux Swap” partitions have type number 82. Normally number 82 is already selected, so you can go ahead by pressing the <Enter> key.
If you are satisfied with the partitioning you can save the changes by executing the “Write” command. This operation has to be confirmed by entering yes. After saving the changes you can quite cfdisk with the Quit command. It is a good idea to reboot the computer before starting the installation, to make sure that the partitioning changes are active. Press <ctrl> + <alt> + <del> to shut Linux down and restart the computer.
The Slackware Linux installer is started by executing setup in the installation disk shell. Setup will show a menu with several choices. You can see a screenshot of the installer in Figure 5.2, “The setup tool”. Every option is required for a complete Slackware Linux installation, but once you start, the setup program will guide you through the options.
The first part of the installation is named “ADDSWAP”. The setup tool will look for a partition with the “Linux Swap” type, and ask you if you want to format and activate the swap partition (see figure Figure 5.3, “Setting up the swap partition”). Normally you can just answer “Yes”.
After setting up the swap space the “TARGET” menu is launched, which you can see in Figure 5.4, “Selecting a partition to initialize”. It is used to initialize the Slackware Linux partitions. Setup will display all partitions with the “Linux Native” type.
After selecting one partition, the setup tool will ask whether you want to format a partition or not, and if you want to format it, whether you want to check the disk for bad sectors or not (Figure 5.5, “Formatting the partition”). Checking the disk can take a lot of time.
After selecting to format a partition, you can specify which filesystem should be used (Figure 5.6, “Selecting a filesystem type”). Normally you can choose the ext2, ext3 and reiserfs filesystems. Ext2 was the standard Linux filesystem for many years, but it does not support journaling. A journal is a special file or area of a partition in which all filesystem operations are logged. When the system crashes, the filesystem can be repaired rapidly, because the kernel can use the log to see what disk operations were performed. Ext3 is the same filesystem as Ext2, but adds journaling. Reiserfs is a filesystem that also provides journaling. Reiserfs uses balanced trees, which make many filesystem operations faster than with Ext2 or Ext3, especially when working with many small files. A disadvantage is that Reiserfs is newer, and can be a bit more unstable.
The first initialized partition is automatically mounted as the
root (/) partition. For other partitions the mount point can be
selected after the initialization. You could, for example, make
separate partitions for //var/tmp/home/usr//home/home/{s}bin/usr/{s}bin/usr/local/{s}bin
The next step is to select the source medium (Figure 5.7, “Selecting the source medium”). This dialog offers several choices, like installing Slackware Linux from a CD-ROM or installing Slackware Linux via NFS. Slackware Linux is usually installed from CD-ROM, so this is what we are going to look at. After selecting “CD-ROM” you will be asked whether you want to let setup look for the CD-ROM itself (“Auto”) or you want to select the CD-ROM device yourself (“Manual”). If you select “Manual” the setup tool will show a list of devices. Select the device holding the Slackware Linux CD-ROM.
After choosing an installation source the setup tool will ask you which disk sets (series) you want to install packages from (Figure 5.8, “Selecting the disk sets”). A short description of each disk set is listed.
Now it is almost time to start the real installation. The next screen asks how you would like to install. The most obvious choices are “full”, “menu” or “expert”. Selecting “full” will install all packages in the selected disk sets. This is the easiest way of installing Slackware Linux. The disadvantage of this choice is that it can take quite much disk space. The “menu” option will ask you for each disk set which packages you want to install. The “expert” option is almost equal to the “menu” option, but allows you to deselect some very important packages from the “a” disk set.
After the completion of the installation the setup tool will allow you to configure some parts of the system. The first dialog will ask you where you would like to install the kernel from (see Figure 5.9, “Installing the kernel”). Normally it is a good idea to install the kernel from the Slackware Linux CD-ROM, this will select the kernel you installed Slackware Linux with. You can confirm this, or select another kernel.
At this point you can choose to make a bootdisk (Figure 5.10, “Creating a bootdisk”). It is a good idea to make a bootdisk, you can use it to boot Slackware Linux if the LILO configuration is botched.
The following dialog can be used to make a link,
/dev/modem
The next step is to select whether you would like to use hotplug (Figure 5.12, “Enabling hotplugging”). Hotplug is used for automatically configuring pluggable USB, PCMCIA and PCI devices. Generally speaking, it is a good idea to enable hotplugging, but some systems may have problems with the probing of the hotplug scripts.
The following steps are important, the next dialogs will assist you with installing LILO, the Linux bootloader. Unless you have experience in configuring LILO it is a good idea to choose to use the simple option for configuration of LILO, which tries to configure LILO automatically (Figure 5.13, “Selecting the kind of LILO installation”).
After selecting the simple option the LILO configuration utility will asks you whether you would like to use a framebuffer or not (Figure 5.14, “Choosing the framebuffer resolution”). Using a framebuffer will allow you to use the console in several resolutions, with other dimensions than the usual 80x25 characters. Some people who use the console extensively prefer to use a framebuffer, which allows them to keep more text on the screen. If you do not want a framebuffer console, or if you are not sure, you can choose standard here.
After setting the framebuffer you can pass extra parameters to the kernel (Figure 5.15, “Adding kernel parameters”). This is normally not necessary, if you do not want to pass extra parameters you can just press the <Enter> key.
The last step of the LILO configuration is selecting where LILO
should be installed (Figure 5.16, “Choosing where LILO should be installed”). MBR is the master boot record, the
main boot record of PCs. Use this option if you want use
Slackware Linux as the only OS, or if you want to use LILO to
boot other operating systems. The Root
option will install LILO in the boot record of the Slackware
Linux /
You will now be asked to configure your mouse. Select the mouse type from the dialog that appears (Figure 5.17, “Configuring a mouse”).
You will then be asked whether the gpm program should be loaded at boot time or not (Figure 5.18, “Choosing whether GPM should be started or not”). gpm is a daemon that allows you to cut and paste text on the console.
The next few steps will configure network connectivity. This is required on almost every networked system. The Slackware Linux setup will ask you if you want to set up network connectivity (Figure 5.19, “Choosing whether you would like to configure network connectivity”). If you answer “No” you can skip the next few network-related steps.
You will now be asked to set the hostname (Figure 5.20, “Setting the host name”). Please note that this is not the fully qualified domain name (FQDN), just the part that represents the host (normally the characters before the first dot in a FQDN).
After setting the host name you can set the domain name part of the fully qualified domain name (FQDN) (Figure 5.21, “Setting the domain name”).
The rest of the network configuration steps depend on whether nodes in the network are configured to use a static or a dynamic IP address. Some networks have a DHCP server that automatically assigns an IP address to hosts in the network. If this is the case for the network the machine select DHCP during this step of the installation (Figure 5.22, “Manual or automatic IP address configuration”). When DHCP is selected you will only be asked whether a host name should be sent to the server. Normally you can leave this blank. If you use DHCP you can skip the rest of the network configuration described below.
If the network does not have a DHCP server you can choose the static IP option, which will allow you to set the IP address and related settings manually.
The first step of the manual configuration is to set the IP address of the first interface (eth0) of the machine (Figure 5.23, “Setting the IP addres”).
After setting the IP address you will be asked to enter the netmask. The netmask is usually dependent on the IP address class (Figure 5.24, “Setting the netmask”).
You will then be asked to set the address of the gateway (Figure 5.25, “Setting the gateway”). The gateway is the machine on the network that provides access to other networks by routing IP packets. If your network has no gateway you can just hit the <ENTER> key.
The next dialog will ask you whether you want to use a nameserver or not (Figure 5.26, “Choosing whether you want to use a nameserver or not”). A nameserver is a server that can provide the IP address for a hostname. For example, if you surf to www.slackbasics.org, the nameserver will “convert” the www.slackbasics.org name to the corresponding IP address.
If you chose to use a nameserver, you will be given the opportunity to set the IP address of the nameserver (Figure 5.27, “Setting the nameserver(s)”).
The final network settings screen provides an overview of the settings, giving you the opportunity to correct settings that have errors (Figure 5.28, “Confirming the network settings”).
After the network configuration you can set which services should be started (Figure 5.29, “Enabling/disabling startup services”). You can mark/unmark services with the <SPACE> key.
Traditionally the system clock is set to the UTC timezone on UNIX(-like) systems. If this is the case, select Yes during the next step (Figure 5.30, “Choosing whether the clock is set to UTC”). If you also use a non-UNIX(-like) OS on the same system, like Windows, it is usually a good idea to choose No, because some PC operating systems do not work with a separate system clock and software clock.
You will then be given the opportunity to select the time zone (Figure 5.31, “Setting the timezone”). This is especially important on systems that have their system clock set to UTC, without selecting the correct timezone the software clock will not match the local time.
If you installed the X Window System you can now set the default window manager (Figure 5.32, “Choosing the default window manager”). The most basic functionality of a window manager is to provide basic window managing functionality like title bars. But some options, like KDE, provide a complete desktop environment.
The final step is to set the root password (Figure 5.33, “Setting the root password”). The setup will ask you whether you would like to set it or not. There is no reason not to do this, and without a root password your system is dangerously insecure.
At this point you have completed the Slackware Linux installation. You can now reboot the system to start your fresh new Slackware Linux system. It wasn't that hard, was it? ;-)
Table of Contents
Sometimes you may want to do a custom installation of Slackware Linux, for example to get better understanding of how GNU/Linux systems work, or to prepare an automatic installation script. This chapter outlines the steps that are required to install Slackware Linux manually. A sample installation script is also provided in Section 6.5, “Automated installation script”.
If you have performed a normal installation, you should not have any problems partitioning a disk. You can use the fdisk and cfdisk commands to partition disks. If you are scripting the installation of Slackware Linux it is useful to know that you can pipe fdisk commands to fdisk. For example:
# fdisk /dev/hda << EOF
n
p
1
+10000M
n
p
2
+512M
t
2
82
w
EOF
These commands create a primary Linux partition of 10000MB, and a primary Linux swap partition of 512MB. You could store the fdisk commands in different disk profiles, and use one of the profiles based on the specific deployment (e.g. the disk size). For example:
# cat /usr/share/fdisk-profiles/smalldisk | fdisk
After making at least a swap and a Linux partition, you can initialize the filesystem and swap space and make use of this storage. On systems that are short on memory, you should initialize, and use swap first. We will use the partition layout used in the partitioning example listed above in the following examples. To set up and use swap, execute:
# mkswap /dev/hda2 # swapon /dev/hda2
The meaning of these commands is quite obvious. mkswap
initializes the swap space, and swapon puts it to
use. You will only have to execute mkswap once,
but swapon has to be executed during every system
boot. This can be done automatically by adding an entry for the
swap partition to /etc/fstab
For now, it is important to initialize the target partitions. This
can be done with the mkfs command. You can
specify which filesystem should be used by adding the -t parameter. mkfs
will automatically invoke a mkfs.filesystem
command based on the filesystem that you have chosen. Be aware that
the filesystems that can be used depends on the installation
kernel that you have booted. If you have booted the
bare.i kernel, you can use the
ext2, ext3 and
reiserfs filesystems.
To initialize an ext3 filesystem, and mount it, you should execute the following commands:
# mkfs -t ext3 /dev/hda1 # mount /dev/hda1 /mnt
If you have made separate partitions for certain directories
in the root filesystem, e.g. /home
# mkfs -t ext3 /dev/hda2 # mkdir /mnt/home # mount /dev/hda2 /mnt/home
Finally, you will have to mount your source medium. If you use
a CD-ROM, this is easy. Suppose that /dev/hdc
# mount /dev/hdc /var/log/mount
Using NFS as the installation medium requires some more steps. First of all, you will have to load the network disk. You can do this by running the network command and inserting a network disk. You can also load this disk from another medium, for example from an USB memory stick. Suppose that you have mounted a USB memory stick on /var/log/mount, you can load the network disk with: network /var/log/mount/network.dsk. After loading the network disk, you will have to configure the network interface. If the NFS server is on the same network, you will only have to assign an IP address to the network interface. For example, to use the address 192.168.2.201, you could execute the following command:
# ifconfig eth0 192.168.2.201
You can then load the portmapper, which is necessary for the NFS client to function correctly:
# /sbin/rpc.portmap
If the portmapper started correctly, you can mount the
NFS volume. But, first make sure that you unmount any filesystem
that you have previously mounted at /var/log/mount/var/log/mount
# mount -r -t nfs -o nolock 192.168.2.1:/home/pub/slackware-current /var/log/mount
If no errors where printed when the volume was mounted, it should be
accessible through /var/log/mount
Everything is now set up to start installing packages from the
installation medium. Since installpkg is
available from the installation system, you can use it to
install Slackware Linux packages. To install packages to the
target partition(s) mounted on /mnt-root option. The
following command installs all packages from the source medium:
# installpkg -root /mnt /var/log/mount/slackware/*/*.tgz
If you have created tagfiles to define which packages should be
installed, then you can use them now (tagfiles are described
in Section 17.4, “Tagfiles”). Suppose that you have
stored a tagfile for each disk set in
/usr/share/tagfiles/small-desktop
# for p in a ap d e f k kde kdei l n t tcl x xap y; do
installpkg -infobox -root /mnt \
-tagfile /usr/share/tagfiles/small-desktop/$p/tagfile \
/var/log/mount/slackware/$p/*.tgz
done
The next sections describe the bare minimum of configuration that is necessary to get a running system.
One of the necessary configuration steps is to create a fstab
file, so that the system can look up what partitions or volumes have
to be mounted. The format of the /etc/fstab//procdevpts
With the sample partitioning used earlier in this chapter, you
could create a /etc/fstab
# cat > /mnt/etc/fstab << EOF
/dev/hda2 swap swap defaults 0 0
/dev/hda1 / ext3 defaults 1 1
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
EOF
To make the system bootable you will have to configure and install
the Linux Loader (LILO). The configuration of LILO is covered in
Section 19.1, “The bootloader”. For this section we will
just show a sample LILO configuration, that can be used with
the partition layout described in this chapter. The first step
is to create the /etc/lilo.conf
# cat > /mnt/etc/lilo.conf << EOF
boot = /dev/hda
vga = normal
timeout = 50
image = /boot/vmlinuz
root = /dev/hda1
label = Slackware
read-only
EOF
You can then install LILO with /mnt/mnt/etc/lilo.conf
# lilo -r /mnt
The configuration of networking in Slackware Linux is covered in Chapter 22, Networking configuration. This section will cover one example of a host that will use DHCP to get an IP address.
The /etc/networks
# cat > /mnt/etc/networks << EOF
loopback 127.0.0.0
localnet 127.0.0.0
EOF
Although we will get a hostname via DHCP, we will still set up a temporary hostname:
# cat > /mnt/etc/HOSTNAME << EOF
sugaree.example.net
EOF
Now that the hostname is configured, the hostname and localhost should also be made res