Book HomeRunning LinuxSearch this book

3.2. Post-Installation Procedures

After you have completed installing the Linux software, you should be able to reboot the system, log in as root, and begin exploring the system. (Each distribution has a different method for doing this; follow the instructions given by the distribution.)

Before you strike out on your own, however, there are some tasks you should do now that may save you a lot of grief later. Some of these tasks are trivial if you have the right hardware and Linux distribution; others may involve a little research on your part, and you may decide to postpone them.

3.2.1. Creating a User Account

In order to start using your system, you need to create a user account for yourself. Eventually, if you plan to have other users on your system, you'll create user accounts for them as well. But before you begin to explore you need at least one account.

Why is this? Every Linux system has several preinstalled accounts, such as root. The root account, however, is intended exclusively for administrative purposes. As root you have all kinds of privileges and can access all files on your system.

However, using root can be dangerous, especially if you're new to Linux. Because there are no restrictions on what root can do, it's all too easy to mistype a command, inadvertently delete files, damage your filesystem, and so on. You should log in as root only when you need to perform system-administration tasks, such as fixing configuration files, installing new software, and so on. See the section "Section 5.1, "Running the System"" in Chapter 5, "Essential System Management" for details.

For normal usage, you should create a standard user account. Unix systems have built-in security that prevents users from deleting other users' files and corrupting important resources, such as system configuration files. As a regular user, you'll be protecting yourself from your own mistakes. This is especially true for users who don't have Unix system-administration experience.

Many Linux distributions provide tools for creating new accounts. These programs are usually called useradd or adduser. As root, invoking one of these commands should present you with a usage summary for the command, and creating a new account should be fairly self-explanatory.

Most modern distributions provide a generic system administration tool for various tasks, one of which is creating a new user account.

Again other distributions, like SuSE Linux or Caldera Open Linux, integrate system installation and system administration in one tool: yast on SuSE Linux or lisa on Caldera Open Linux.

If all else fails, you can create an account by hand. Usually, all that is required to create an account is:

  1. Edit the file /etc/passwd to add the new user.

  2. Optionally edit the file /etc/shadow to specify "shadow password" attributes for the new user.

  3. Create the user's home directory.

  4. Copy skeleton configuration files (such as .bashrc) to the new user's home directory. These can sometimes be found in the directory /etc/skel.

We don't want to go into great detail here: the particulars of creating a new user account can be found in virtually every book on Unix system administration (see the Bibliography for suggested reading). We also talk about creating users in the section "Section 5.7, "Managing User Accounts"" in Chapter 5, "Essential System Management". With luck, there will be a tool provided to take care of these details for you.

Keep in mind that to set or change the password on the new account, you use the passwd command. For example, to change the password for the user duck, issue the following command:

# passwd duck
This will prompt you to set or change the password for duck. If you execute the passwd command as root, it will not prompt you for the original password. In this way, if you have forgotten your old password, but can still log in as root, you can reset it.

3.2.2. Getting Online Help

Linux provides online help in the form of manual pages--or "man pages" for short. Throughout this book, we'll be directing you to look at the manual pages for particular commands to get more information. Manual pages describe programs and applications on the system in detail, and it's important for you to learn how to access this online documentation in case you get into a bind.

To get online help for a particular command, use the man command. For example, to get information on the passwd command, type the following command:

$ man passwd
This should present you with the manual page for passwd.

Usually, manual pages are provided as an optional package with most distributions, so they won't be available unless you have opted to install them. However, we very strongly advise you to install the manual pages, you will feel lost many times without them.

In addition, certain manual pages may be missing or incomplete on your system. It depends on how complete your distribution is and how up-to-date the manual pages are.

Linux manual pages also document system calls, library functions, configuration file formats, and kernel internals. In the section "Section 4.12, "Manual Pages"" in Chapter 4, "Basic Unix Commands and Concepts", we'll describe their use in more detail.

Besides traditional manual pages, there are also so-called info pages. These can be read either with the text editor Emacs, the command info or one of many graphical info readers available.

Many distributions also provide documentation in HTML format that you can read with any Web browser like Netscape Navigator but also with the text editor Emacs.

Finally, there are documentation files that are simply plain text. You can read these with any text editor or simply with the command more.

If you cannot find documentation for a certain command, you can also try running it with either the -h or - - option. Most commands then provide a brief summary of their usage.

3.2.3. Editing /etc/fstab

In order to ensure that all of your Linux filesystems will be available when you reboot the system, you may need to edit the file /etc/fstab, which describes your filesystems. Many distributions automatically generate the /etc/fstab file for you during installation, so all may be well. However, if you have additional filesystems that were not used during the installation process, you may need to add them to /etc/fstab in order to make them available. Swap partitions should be included in /etc/fstab as well.

In order to access a filesystem, it must be mounted on your system. Mounting a filesystem associates that filesystem with a particular directory. For example, the root filesystem is mounted on /, the /usr filesystem on /usr, and so on. (If you did not create a separate filesystem for /usr, all files under /usr will be stored on the root filesystem.)

We don't want to smother you with technical details here, but it is important to understand how to make your filesystems available before exploring the system. For more details on mounting filesystems, see the section "Section 6.1.2, "Mounting Filesystems"" in Chapter 6, "Managing Filesystems, Swap, and Devices", or any book on Unix system administration.

The root filesystem is automatically mounted on / when you boot Linux. However, your other filesystems must be mounted individually. Usually, this is accomplished by the command:

# mount -av
in one of the system startup files in /etc/rc.d or wherever your distribution stores its configuration files. This tells the mount command to mount any filesystems listed in the file /etc/fstab. Therefore, in order to have your filesystems mounted automatically at boot time, you need to include them in /etc/fstab. (Of course, you could always mount the filesystems by hand, using the mount command after booting, but this is unnecessary work.)

Here is a sample /etc/fstab file. In this example, the root filesystem is on /dev/hda1, the /home filesystem is on /dev/hdb2, and the swap partition is on /dev/hdb1:

# /etc/fstab 
# device      directory   type   options  
# 
/dev/hda1     /           ext2   defaults 
/dev/hdb2     /home       ext2   defaults
/dev/hdb1     none        swap   sw 
/proc         /proc       proc   defaults

The lines beginning with the "#" character are comments. Also, you'll notice an additional entry for /proc. /proc is a "virtual filesystem" used to gather process information by commands such as ps.

As you can see, /etc/fstab consists of a series of lines. The first field of each line is the device name of the partition, such as /dev/hda1. The second field is the mount point--the directory where the filesystem is mounted. The third field is the type; Linux ext2fs filesystems should use ext2 for this field. swap should be used for swap partitions. The fourth field is for mounting options. You should use defaults in this field for filesystems and sw for swap partitions.

Using this example as a model, you should be able to add entries for any filesystems not already listed in the /etc/fstab file.

How do we add entries to the file? The easiest way is to edit the file, as root, using an editor such as vi or Emacs. We won't get into the use of text editors here--vi and Emacs are both covered at the beginning of Chapter 9, "Editors, Text Tools, Graphics, and Printing".

After editing the file, you'll need to issue the command:

# /bin/mount -a
or reboot for the changes to take effect.

If you're stuck at this point, don't be alarmed. We suggest that Unix novices do some reading on basic Unix usage and system administration. Most of the remainder of this book is going to assume familiarity with these basics, so don't say we didn't warn you.

3.2.4. Shutting Down the System

   You should never reboot or shut down your Linux system by pressing the reset switch or simply turning off the power. As with most Unix systems, Linux caches disk writes in memory. Therefore, if you suddenly reboot the system without shutting down "cleanly," you can corrupt the data on your drives. Note, however, that the "Vulcan nerve pinch" (pressing Ctrl-Alt-Del in unison) is generally safe: the kernel traps the key sequence and initiates a clean shutdown of the system (as described in the section "Section 5.3.2, "init, inittab, and rc files"" in Chapter 5, "Essential System Management". Your system configuration might reserve the Ctrl-Alt-Del for the system administrator so that normal users cannot shut down the network server that the whole department depends upon. To set permissions for this keystroke combination, create a file called /etc/shutdown.allow that lists the names of all the users that are allowed to shut down the machine.

The easiest way to shut down the system is with the shutdown command. As an example, to shutdown and reboot the system immediately, use the following command as root:

# shutdown -r now
This will cleanly reboot your system. The manual page for shutdown describes the other available command-line arguments. Instead of now, you can also specify when the system should be shut down. Most distributions also provide halt, which calls shutdown now. On some distributions, there is also poweroff which actually shuts the computer down and turns it off. Whether it works depends on the hardware (which must support APM), not on Linux.



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.

This HTML Help has been published using the chm2web software.