% Linux Installation and Getting Started    -*- TeX -*-
% misc.tex
% Copyright (c) 1992, 1993 by Matt Welsh <mdw@sunsite.unc.edu>
%
% This file is freely redistributable, but you must preserve this copyright 
% notice on all copies, and it must be distributed only as part of "Linux 
% Installation and Getting Started". This file's use is covered by the 
% copyright for the entire document, in the file "copyright.tex".

\section{Miscellaneous Tasks}
Believe it or not, there are a number of housekeeping tasks for
the system administrator which don't fall into any major category.

\subsection{System startup files}\label{sec-rc}
\index{boot scripts}
\index{startup scripts}
When the system boots, a number of scripts are executed automatically
by the system before any user logs in. Here is a description of what
happens.

\index{/etc/init@{\tt /etc/init}}
\index{init@{\tt init}}
\index{/etc/inittab@{\tt /etc/inittab}}
\index{inittab@{\tt inittab}}
\index{/etc/getty@{\tt /etc/getty}}
\index{getty@{\tt getty}}
At bootup time, the kernel spawns the process {\tt /etc/init}.
{\tt init} is a program which reads its configuration file, 
{\tt /etc/inittab}, and spawns other processes based on the contents of
this file. One of the important processes started from {\tt inittab}
is the {\tt /etc/getty} process started on each virtual console. 
The {\tt getty} process grabs the VC for use, and starts a {\tt login}
process on the VC. This allows you to login on each VC; if 
{\tt /etc/inittab} does not contain a {\tt getty} process for a certain
VC, you will not be able to login on that VC.

\index{/etc/rc@{\tt /etc/rc}}
\index{rc@{\tt rc}}
\index{/etc/rc.local@{\tt /etc/rc.local}}
\index{rc.local@{\tt rc.local}}
Another process executed from {\tt /etc/inittab} is {\tt /etc/rc},
the main system initialization file. This file is a simple shell
script which executes any initialization commands needed at boot time,
such as mounting the filesystems (see Section~\ref{sec-manage-fs}) and 
initializing swap space.

Your system may execute other initialization scripts as well, such as
{\tt /etc/rc.local}. {\tt /etc/rc.local} usually contains initialization
commands specific to your own system, such as setting the hostname (see
the next section). {\tt rc.local} may be started from {\tt /etc/rc}
or from {\tt /etc/inittab} directly.

\subsection{Setting the hostname}\label{sec-set-hostname}
\index{hostname!setting}
\index{hostname!{\tt hostname}}
In a networked
environment, the hostname is used to uniquely identify a particular
machine, while in a standalone environment the hostname just gives
the system personality and charm. It's like naming a pet: you can
always address to your dog as ``The dog,'' but it's much more interesting
to assign the dog a name such as Spot or Woofie.

Setting the system's hostname is a simple matter of using the
{\tt hostname} command. If you are on a network, your
hostname should be the full hostname of your machine, such as
{\tt goober.norelco.com}. If you are not on a network of any kind,
you can choose an arbitrary host and domainname, such as
{\tt loomer.vpizza.com}, {\tt shoop.nowhere.edu}, or {\tt floof.org}.

When setting the hostname, the hostname must appear in the file
{\tt /etc/hosts}, which assigns an IP address to each host. Even
if your machine is not on a network, you should include your own hostname
in {\tt /etc/hosts}. 

For example, if you are not on a TCP/IP network, and your hostname
is {\tt floof.org}, simply include the following line in {\tt /etc/hosts}:
\begin{tscreen}
127.0.0.1\ \ \ \ \ \ \ floof.org localhost
\end{tscreen}
This assigns your hostname, {\tt floof.org}, to the loopback address
127.0.0.1 (used if you're not on a network). The {\tt localhost}
alias is also assigned to this address.

If you are on a TCP/IP network, however, your real IP address and hostname
should appear in {\tt /etc/hosts}. For example, if your hostname is
{\tt goober.norelco.com}, and your IP address is 128.253.154.32, add
the following line to {\tt /etc/hosts}:
\begin{tscreen}
128.253.154.32\ \ \ \ \ \ \ goober.norelco.com
\end{tscreen}

If your hostname does not appear in {\tt /etc/hosts}, you will
not be able to set it.

To set your hostname, simply use the {\tt hostname} command. For
example, the command
\begin{tscreen}
\# {\em hostname -S goober.norelco.com}
\end{tscreen}
sets the hostname to {\tt goober.norelco.com}. In most cases, the
{\tt hostname} command is executed from one of the system startup
files, such as {\tt /etc/rc} or {\tt /etc/rc.local}. Edit these
two files and change the {\tt hostname} command found there to 
set your own hostname; upon rebooting the system the hostname will
be set to the new value.

