[<--] [Cover] [Table of Contents] [Concept Index] [Program Index] [-->] |
Every Linux system has an administrator---someone who installs the hardware and software, maintains the system, and generally keeps things running smoothly. A single-user home Linux system, once installed and running, needs little administration -- but the occasional upgrade or maintenance task is necessary.
This appendix exists as a reference for those users who will also be performing the administrative duties on their system. While a complete administrative guide is out of the scope of this book, the goal of this appendix is to point the new Linux administrator in the right direction, giving tips on how to choose the computer you'll use for Linux, install Debian GNU/Linux on it, and get it ready for use.
Unlike the rest of this book, this chapter contains recipes describing
commands to be run by root
, the superuser account. Many of these
commands cannot be run by an ordinary user; instead of the normal
shell prompt used for examples throughout the rest of the book
(`$'), the examples in these recipes use a pound sign (`#'),
which is the default prompt for the root
account.
If you're new to Linux administration, you may want to consult the help resources listed in If You Need More Help.
WWW: http://www.thedukeofurl.org/
In days gone by, Linux enthusiasts had to piece together computer
systems from individual components, since the salesmen at computer
stores had never even heard of Linux or the free software
movement. But no more. Today, many dealers sell complete systems with
Linux pre-installed, including corporations like Dell Computers and
IBM.(44)
The Duke of URL reviews the latest hardware as it performs with Linux. His periodic "Linux Buyer's Guide" feature lists current hardware that works well on a Linux-based system, and it gives sample configurations (with prices and links to vendors) for putting together a complete system -- from low-end budget system to a blazing, dual-processor rig.
Since Linux runs on many different computers and supports a wide range of hardware, and because everyone has different needs, I won't make too many recommendations as to which specific hardware to buy. (Systems change too fast for such a list to be useful, anyway.)
Before you make a hardware purchase, though, make sure that it's compatible with Linux -- that bargain video-capture board will be worthless if it has a proprietary interface that only works with a certain non-free operating system.
To find out whether your hardware will work under Linux, try the following:
To shut down the system properly, use shutdown
. It notifies all
users and processes of the impending shutdown, blocks new logins, and
brings the system down cleanly. (Just cutting power to the system
without cleanly stopping processes and unmounting filesystems could
result in the loss or corruption of data.)
To halt the system once the shutdown is complete, use the `-h' option; to reboot the system after shutdown, use `-r' instead.
The following recipes describe ways of using shutdown
to do
useful things.
To shut down the system at a certain time, you normally give that time as an argument; use the special `now' argument to begin the shutdown process immediately.
# shutdown -h now [RET]
# shutdown -r now [RET]
You can follow the `now' argument with a quoted message that will be displayed on all terminals of all users currently logged in.
# shutdown -h now "The system is being shut down now!" [RET]
To shut down the system at a certain time, give that time (in 24-hour format) as an argument.
# shutdown -r 4:23 [RET]
# shutdown -h 20:00 [RET]
To shut down the system in a certain number of minutes, give that number of minutes prefaced by a plus sign (`+').
# shutdown -h +5 [RET]
Follow the time with a quoted message to display it on the terminals of all logged in users.
# shutdown -h 00:00 "The system is going down for maintenance at midnight" [RET]
If you have given a shutdown
and decide that you don't actually
want to shut the system down, run shutdown
again with the
`-c' option. This command stops any shutdown
s in progress.
shutdown
, type:
# shutdown -c [RET]
As with a normal system shutdown, you can send out an explanatory message with the cancel that will be shown to all users.
shutdown
and send an explanatory message to
all logged in users, type:
# shutdown -c "Sorry, I hit the wrong key!" [RET]
This command cancels any pending system shutdown and displays the message, `Sorry, I hit the wrong key!' on all the terminals of anyone logged in.
All Linux distributions come with a multitude of software programs (also called "binaries"). But sooner or later, you will want to install more programs, or you will want to upgrade your existing software when newer versions are available. The following sections talk about installing the Debian GNU/Linux distribution itself, installing and upgrading software when from Debian packages, and how to install stand-alone shell scripts.
WWW: http://www.cheapbytes.com/ WWW: http://www.debian.org/ WWW: http://www.debian.org/releases/stable/
You can get a copy of Debian GNU/Linux on CD-ROM from local or online
vendors, or you can download the installation files from the Internet
(recommended only if you have a fast Internet connection, of course).
If you choose to buy a copy of Debian in a local computer store, be sure you get the most recent version. If a store only carries an older version, the software might not work with your brand-new hardware! (Visit the http://www.debian.org/ to find the number of the latest version.)
If you'd rather buy a copy online, http://www.cheapbytes.com/ sells affordable Debian GNU/Linux CD-ROMs. The Debian Project maintains a full list of vendors at http://www.debian.org/distrib/vendors/.
The precise details of installation are out of the scope of this book, but the http://www.debian.org/releases/stable/ comes on the CD-ROM. It contains step-by-step instructions and the latest release notes.
Debian makes the software programs available in `.deb' packages, files that contain everything necessary for the installation of a given software program.
There are different methods of installing packages on a Debian system:
via dselect
, where you select packages from a menu; dpkg
,
a command-line tool for installing packages; and apt-get
, part of
Debian's new "Advanced Package Tool" system.
To install a package when you know the package name, mount your Debian
distribution (for example, if you install Debian via CD-ROM, put the
first Debian CD-ROM disc in your CD-ROM drive). Then run apt-get
with the `install' command option, and give the name of the package
to install as an argument. Should there be additional packages that must
be installed first (called dependencies), or should the package
conflict with others already installed, an action will be presented to
fix this, and you will be prompted to confirm or abort the operation.
# apt-get install miscfiles [RET]
If you already have the `.deb' file, use dpkg
to install
it. Use the `-i' option and give the name of the file as an
option. Any conflicts or dependencies will have to be resolved by you
before the package is installed. If a problem is detected, dpkg
will report it and exit without installing the package.
# dpkg -i miscfiles-1.1.7.deb [RET]
Finally, to peruse available packages and choose them from a menu, use
dselect
, the Debian package selection tool. A word of caution:
its menu interface is different from most programs you have probably
encountered, and its usage is unfortunately an acquired skill. Even the
man
page makes note of this: "The dselect
package
selection interface is confusing or even alarming to the new user."
NOTE: If you're new to Debian, I recommend consulting Dselect Documentation for Beginners.
People are constantly contributing to the free software movement. This means that new software programs are constantly being added to Linux distributions, and current software programs are continually being improved -- new features to match new hardware, faster program execution, security updates, and so forth. A Linux system, therefore, needs to be kept up to date in order to reap the benefits of the latest free software.
To upgrade a single package, use apt-get
with the `install'
argument, and follow that with the name of the package to upgrade.
# apt-get install sview [RET]
This command will upgrade the `sview' package to the most current
version available, if greater than the version already installed on your
system. If additional packages must be upgraded first in order for this
new package upgrade to function properly, this command will fetch and
upgrade those packages, too. Before downloading any packages,
apt-get
will show the list of packages that will be installed,
replaced, or otherwise changed, and wait for confirmation first.
To bring your entire Debian system up to date, use the apt-get
tool
with the following command arguments. First, use the `update'
argument to update your system's list of available software
packages. Then run apt-get
again, using either the `upgrade'
argument to upgrade all of the installed packages to their most recently
available versions, or use the `dist-upgrade' argument when a new
version of the Debian system is announced, to upgrade to that new
version.
# apt-get update [RET] ...processing messages... # apt-get upgrade [RET] ...processing messages... #
# apt-get update [RET] ...processing messages... # apt-get dist-upgrade [RET] ...processing messages... #
A shell script is a file that contains commands written in a shell command language (see The Shell). You run (or "execute") a script as you would any other command (see Running a Command). First, make sure that the script file is executable; if it isn't, you won't be able to execute it (see Making a File Executable).
Generally, the administrator installs new shell scripts in the `/usr/local/bin' directory. If you are on a multi-user system and you are the only user liable to run a particular script, you can put it in a special directory in your home directory tree -- the `~/bin' directory is the standard recommendation here -- and then add that directory to your path (see Adding to Your Path).
Not all executable script files are shell scripts. The first line of a script contains the full path name of the shell or other program that is to interpret and execute the script; sometimes, the path may differ on your system from the one the script was written on, and so you may have to change this line.
For example, a script may start with the following line:
#!/usr/local/bin/perl
This line means that the script is written in the perl
language;
the text after the `#!' is the full path name of the perl
program, which in this case is `/usr/local/bin/perl'.
If you try to execute this script and the system reports an error
finding the file, you'll have to change that first line to correspond to
the location of the perl
binary on your system. The which
tool will output this location.
perl
is installed on your system, type:
$ which perl [RET]
If that command returns `/usr/bin/perl' or some path name other
than /usr/local/bin/perl
, you'll have to change the location in
the first line of the script to the path name given:
#!/usr/bin/perl
NOTE: If the output of the which
command returns
nothing, that means that the perl
program is not installed on
your system at all; in that case, you should install the perl
software.
This section describes some of the things the system administrator will have to do in administrating the system's users.
All of these commands must be run by the superuser, using the
root
account -- these commands edit system files.
To make a new user account, use adduser
. It takes as an argument
the username to use for the new account. It will prompt for default
setup information, including the user's full name and an initial
password to use.
bucky
, type:
# adduser bucky [RET]
NOTE: By default, the name of the user's home directory will be
the same as the username. So, for example, the user bucky
will
have a home directory of `/home/bucky'.
Certain hardware peripherals, like CD-ROM drives and soundcards, normally require superuser privileges in order to access them. These devices also have groups of their own, so a regular user can also access them by having membership to their groups (see Groups and How to Work in Them).
The groups that regular users might want to be part of include
floppy
(the floppy disk drive), audio
(the soundcard), and
dialout
and dip
(modem dial-out privileges).
Use addgroup
to add a user to the group associated with a
hardware device. Give as arguments the username to add and the name of
the group to add to.
doug
to the audio
group, type:
# addgroup doug audio [RET]
The `/etc/fstab' file specifies the details about the filesystems in use on a system, including those that may be mounted by floppy or CD-ROM drive. In order to let users mount disks on these drives, make sure that there is a line in `/etc/fstab' for both the floppy and CD-ROM drives, each containing the `user' flag:
/dev/fd0 /floppy auto defaults,noauto,user 0 0 /dev/cdrom /cdrom auto defaults,noauto,user 0 0
The following recipes describe ways of displaying information about the system you are running.
To find out how long the system has been running, use the uptime
tool. When you run it as a command, it outputs the current time, how
long the system has been running, how many users are logged on, and what
the system "load averages" have been for the past one, five, and
fifteen minutes.
$ uptime [RET] 3:34pm up 4:31, 4 users, load average: 0.01, 0.05, 0.07 $
To get a list of the times and dates when the system was recently
rebooted, give `reboot' as an argument to last
(see Listing the Last Times a User Logged In).
$ last reboot [RET]
NOTE: An operating system capable of running constantly for a
long time without crashes or freeze-ups is a good one, and so having a
high uptime
value is a matter of pride for many Linux users. It
is not uncommon to hear of systems that have been running for months and
sometimes even years non-stop -- one Linux administrator reported
on the Internet about one of his work systems, which had been running
continuously without reboot for three years!
Use the GNU uname
tool to see what version of Linux you are
running. By default, it outputs the name of the operating system; the
`-r' option outputs the operating system release number.
$ uname [RET]
$ uname -r [RET]
You can also use uname
to output the CPU processor type of the
system (such as i586, PowerPC, etc.); specify this with the `-m'
option. The `-a' option is also useful; it outputs all
information about the system that it can, including all of the mentioned
options, plus the version date and number of the operating system and
the machine's hostname.
$ uname -m [RET]
uname
information for the system you are on,
type:
$ uname -a [RET]
On a Debian system, the file `/etc/debian_version' (see Files and Directories) contains the release name of the Debian installed.
Use cat
to output the contents of this file (see Concatenating Text).
$ cat /etc/debian_version [RET]
NOTE: Debian releases have historically been named after characters from the motion picture Toy Story.
[<--] [Cover] [Table of Contents] [Concept Index] [Program Index] [-->]