The
PCQ June 2000 CD of Red Hat 6.2 that you are holding in your hands should be
the easiest Linux install that you've done in a long time. Essentially,
the Linux install can be demarcated into a few clear sections. Sometimes,
you could stumble over one section while the rest will be a breeze. The PCQ
CD has the Red Hat documentation that can be explored directly off the CD.
These manuals provide more in-depth information on the topics touched upon
briefly here.
Preparing to install
Never forget
that Murphy ("If anything can go wrong, it will") is close at
hand. So, before you start, backup all the critical data on your hard disk.
Make sure that you have approximately 1.5 GB of free hard disk space. Gather
a local Linux guru, some food, drink (not essential, but nice), and the PCQ
CD (essential and nice). It also makes sense to get two clean and freshly
formatted floppies. If this is your first time, get as many hardware details
about your machine as you can. This may also be a good time to hunt for your
monitor manual.
Installing Linux
Booting into
Linux is the next phase. If you have a BIOS that allows you to boot off the
CD, that's one problem solved. Enter into the BIOS and configure to boot
off the CD-ROM. If this is not possible, you could use the autoboot
application in the dosutils directory on the CD. If you're unable to use
autoboot, then you'll need to create a boot disk to start installation.
More information on this process is available in the install guide on the
CD. When the machine boots up, you'll get a prompt that reads
boot:
At this point, you could
choose a graphical install (press Enter) or choose to install in text mode
(type text and press Enter). I would recommend the text mode; it's faster
and always works straight out of the box. An example that serves to make the
point is the i810-based motherboards. The video card works perfectly fine if
you've booted into Linux, but stubbornly refuses to work during an
install. If you've installed Linux before and are sure that X Window
support for your machine (video card and monitor) works fine, then the
graphical install is a good idea.
The next phase involves
configuring the machine to install Linux. This includes the next few screens
in which you've to choose the language to install in (English), the
keyboard layout (US), media (local CD-ROM), and the mouse port, if you chose
graphical install. Since Linux is a powerful operating system and can
perform a variety of tasks, you've to decide if you want your machine to
act as a server, workstation, or something completely different. For most
users, a workstation install is more than sufficient. If you have special
constraints such as lack of space, you may want to go in for a Custom
install.
Partitioning your hard
disk
Now you need
to decide where you want to install Linux. There are two options at this
point. It's ideal to store and use Linux in a special partition of its
own. However, Red Hat 6.2 offers a feature by which it's possible to
install Linux on a DOS partition and work with it. Linux creates a large
file on your Windows partition and works off it. In order to boot into such
a Linux install, you'll have to use a boot disk. There's no other method
to boot into such a Linux partition, at least currently. This method is not
recommended unless there's no other alternative available. In a test
conducted at PCQ Labs, we found that not only did the install take up to
five times longer, the installed Linux system was also significantly slower
than normal, and the boot up process is painfully slow, to say the least.
If you have a partition that
you can delete, you could use that to install Linux. If you don't have a
partition, you'll need to create one without destroying your existing
partitions. The standard DOS utility Fdisk is unable to do such manipulation
and you may need to use tools such as PartitionMagic or FIPS (available on
the CD in the /dosutils directory). See the box "Using FIPS" for
more information.
What goes where?
During
the install, you'll need to choose the location where your Linux files are
going to be stored. This location is known as a mount point. To begin with,
ensure that the display tells you that you have free hard disk space (if you
have existing partitions that you want to install Linux over, remove them).
Linux insists on having an area designated as swap space. You need to decide
how much space to allocate for this. A rough estimate is to add a
swap partition of twice as much of physical memory your machine has.
Somewhere between 32 MB to 256 MB is a safe bet (see the article "Fine
tuning your Linux Machine", page 47 in this issue, on where to place
the swap partitions). Due to disk geometry, even though you ask it to
allocate 127 MB, the allocation may be a value in excess of this (generally
133 MB). Don't worry about that. This partition will not require a name.
To understand what logrotate
can do, first ask yourself what you want to do with your log files. The
table "Planning for a log processing and archiving policy" might
help you to start. The first row lists the processing and reporting to be
done, while the first column lists the files on which the processing is to
be done. Put down the different log files in column 1, tick out the log
processing of your choice, and you can come up with a policy for using
logrotate.
Let me briefly explain what
each column implies. A "yes" on column 2 indicates that you want
to retain the log file as a record, so it's best kept compressed.
Similarly, a "yes" in column 3 indicates that you merely want to
scan the file, look for the unusual, and then discard it. You might want to
mail this file to yourself or to the relevant administrator. Column 4 says
that you want to discard the file straightaway. In the sysadmin world, this
obviously doesn't qualify for best practice. Columns 5 and 6
mention the actions you want to perform before and after you do the log
processing. Column 7 is for an e-mail address to which errors during log
processing are to be reported, and column 8 indicates how often you want the
processing to be done. Note that you might want a time threshold with a
granularity of a day or choose to have a file size threshold to rotate the
logs. This table is not exhaustive or mandatory in nature-it's is merely
an example of how you would go about the policy-making exercise. So, don't
implement this, as is, as a policy. Evolve one to suit your needs.
If you're ready with a
table such as the one above, you have a policy. You can now use logrotate to
implement this policy.
The policy is specified using
keywords, as well as with a script-like language comprising keywords
specific to logrotate. The script is intuitive and easy to understand. By
default, most logs are rotated four times, uncompressed, before they're
removed from the system. This should explain the presence of files with the
extensions .1, .2, .3 and .4 in the /var/log directory. Take the file /var/log/messages
as an example. After a certain time period or after a certain file size is
reached (as specified in /etc/logrotate. conf), this file is renamed to
messages.1 and an empty file called messages is created to take in the new
log input. This is repeated until they're rotated four times.
Let's look at a portion of
the configuration from /etc/logrotate.conf from a standard install. The
first line mentions the name of the file for which the policy is laid out.
Notice the intuitive keywords-"monthly" indicates that the
rotation cycle is monthly, "create" specifies the permissions and
ownerships to be used when the old file is moved to another name and an
empty file is created. "Rotate 1" indicates that one rotated
logfile will be retained:
/var/log/wtmp
{ monthly
create 0664
root utmp
rotate 1
}
Here's a portion of the
file /etc/logrotate.d/apache-the policy for processing apache log files.
The keyword missingok implies that if the log file isn't found, continue
processing the rest. Notice the command in between the keywords postrotate
and endscript. This command is executed after log processing is done.
Surprisingly, you don't find any other instructions such as the frequency
of rotation or the number of rotations, as in the previous case. When there's
no explicit mention made, the definitions in the global configuration file
will apply.
/var/log/httpd/access_log
{
missingok
postrotate
/usr/bin/killall -HUP httpd 2> /dev/null || true
endscript
}
logrotate is typically run
once a day by the cron. If you are logged in as superuser, you would see an
entry similar to the one below in the crontab file:
0 0 * * * /usr/sbin/logrotate
The utility runs every
midnight. You can run it more often if you need to.
A good start towards
minimizing disk storage space would be to uncomment the compress option in
/etc/logrotate. conf, so that all the rotated log files are kept compressed.
Avinash
Shenoy is a systems and network administrator at the NCBS, Bangalore,
and Gopi Garge is a technology
consultant with Exocore Consulting <www.exocore.com>