Setting up a Linux System

Home Computers Writings Trips

1. Choosing the distribution

Linux has a dizzying number of distributions, all slightly different, so choosing one can be somewhat frustrating.  However, they differ mostly in their package management system, or how they install programs and in the tools used to configure the machine.  Sooner or later, if you are serious about using Linux, you will abandon the GUI tools provided by the distribution because they work fine until something goes wrong.  And if you configure your computer wisely, you can easily change distributions, anyway.  So, just pick the one that sounds good to you.  Here's my impressions of the distributions.  Some of these I have not used, or have not used in a long time, so the impressions are the impressions I have received from what other people have said.

Knoppix Linux on a CD.  It is a complete Linux distribution (heavily compressed) on a bootable CD.  Auto-detects just about everything.  No installation necessary;  makes a great bootdisk (for repairing a system) or if you just want to play around a little.  (Or if you are addicted to Linux and you need to use another computer does not have it.)
RedHat
RedHat no longer makes a non-enterprise edition of Linux, so this is no longer an option for most people.
Fedora
This is the successor to RedHat.  It is sponsored by RedHat, but maintained by individuals.  RedHat is based on RPM, the RedHat Package Manager.  RPM was great, back in the day, but it is not very smart about what is already installed.  I gave up on RPM when I went to upgrade my GNOME desktop with the recently released version.  I had a bunch of GNOME programs installed that required gnome-redhat >= 1.2, but I was trying to install gnome-ximian 2.0.  Obviously 2.0 >= 1.2, but "gnome-redhat" != "gnome-ximian".  I didn't feel like waiting for the next version of RedHat, and I didn't feel like reinstalling 200 packages.  But if you are fine with waiting until the next version, RPM is just fine.
SuSE
This is probably the second-most popular Linux distribution.  It is RPM based.  We use it at work and it is fine.
Madrake
A bit flashier than SuSE.  Also RPM based.  Compiles packages optimized for Pentium (and later) processors.
Debian
Does not have much of a GUI, although that may be changing.  Installation is tricky, but once installed, the APT packages are great!  `apt-get package-name` will install "package-name" and any other packages that it depends on.  Much easier than RPM!  However, there are three flavors, each with some serious drawbacks.  Debian stable, the default, is rock-solid stable.  It is so stable, in fact, that it is only released once every year and a half, or so.  Great for servers, not so great for desktops.  Debian testing is great, because it is frequently updated, except that when a release nears, testing becomes the release branch and it is no longer updated (except with fixes) until the release finishes, which can take a while.  Debian unstable is updated pretty much continuously--usually when a project releases a new version, unstable packages appear within a week.  However, there is often bugs in the packages, so be prepared for problems periodically.  I used Debian unstable happily for several years.
Gentoo
A power-user's distribution.  This distribution consists entirely of source code that is compiled on your machine for the maximum optimization.  It has no GUI and is a very low-level distribution.  On the other hand, you can compile all your code to use the latest optimizations for your shiny new processor.  Uses its own package management system, which I don't like as much as Debian's, but Debian's binaries are optimized only for i386;  processors have come a long way since the 386 and I'd like to take advantage of it.
Slackware
One of the first distributions.  It has a decidedly no-frills package management system.  Old-timers swear by it (but then everyone swears by their distro).

2.  Initial Installation

Installation usually consists of about four things:  installing drivers, configuring the filesystem, configuring X Windows, and copying the programs.

Hardware

The commerical systems (RedHat, for instance) will try to auto-detect hardware, but the more low-level distributions are not so good about that.  Just in case, it is a good idea to write down the model numbers of your video card, ethernet card, SCSI card (if you use SCSI), sound card, and any other card you have.  (Do this before installing because you usually have to open up your computer to find the model number.)1    If your hardware is not auto-detected and not listed in the installation drivers, do a web search for "model-name linux" and see if it is supported.  If it is, you may need to install the driver later.

Filesystems and partitioning

Next you need to create your filesystems.  All file systems live under /, the root directory, but they can be on separate partitions.  In fact, it is advisable to have at least some of them on separate partitions (minimally your programs and your home directory--that way if you need or want to re-install Linux, you won't need to worry about losing your data).

/
Root directory.  If you only have one partition (not recommended), it must be "/".
/boot
A small (50 MB) partition for storing kernels.  This is mostly of historical interest and is not necessary (unless you compile your own kernels).
/var
Log files and package management information goes here.  If you have three or more partitions, make one of them /var, because if /var is on the same partition as /, the log files may fill up the / partition, and then lots of things mysteriously stop working (many things depend on being able to create temporary files in /tmp).
/usr "usr" stand for "User Shared Resources", not "user".  This is where all your programs go.
/usr/local
This is canonically where "local" programs go, that is, programs not in the distribution.  Today's distributions are so encompassing that this is not usually much of an issue.
/opt
Same thing as /usr/local, only seems to be more popular.  A handy extra partition.
/home
This is where users' data (home directories) goes.  Highly recommended as a separate partition.
swap
This is a separate partition unconnected to your filesystem and provides extra virtual memory in case you run out.  Highly recommended.

If you have a big drive and want to eke out as much speed as possible, the middle of the drive is fastest to access (the drive head is more likely to be in the center than the edges), so put whichever partition contains the things you want to access quickly.  (This would be a good place for a swap partition).

Boot sector

If you are installing Linux as the only operating system on this machine, you should install LILO or GRUB in the boot sector (/dev/hda).  If you are dual booting into some other operating system (like Windows), do not install onto the boot sector or you will not be able to boot into Windows.  If your installation does not ask about this, be worried.  Instead, look at one of the dual-booting howto's.

Programs

Next you will need to select the programs you want to install.  Most installations will probably have high-level categories (development, network, games);  I recommend selecting these.  I have also listed a number of programs that I have found useful.

mozilla
Web browser, email, and HTML editor.  Great.  (If you don't like monolithic, Netscape-like applications, firebird is the standalone web browser and thunderbird the email client.
OpenOffice
Office suite.  Like MS Office, but free, and also generates PDFs.
gimp
GNU Image Manipuator.  Image editing.  Not nearly as good a photoshop, but a whole lot cheaper.
ImageMagick
A bunch of command-line image utilities.  `convert` is especially handy.
psutils
Utilities for manipulating PostScript files.  PostScript is the main format the Unix uses for printing, so this is very handy.
cups
Printing software
samba
Windows file sharing
NFS
Unix file sharing
sshd Remote access to your computer.  Very handy if you have multiple computers
telnetd, ftpd
If you aren't worried about security and are likely to need to remotely access your computer from a Windows, install these, as Windows has telnet and ftp built-in, but not ssh.  (Although putty is a good Windows ssh client)
wine
Allows Windows programs run.  Usually requires a bit of tweaking to work, but lovely when it succeeds.  Check the WINE application database for information on running your particular application.
acroread, realplayer
Some distributions may include these and it's handier than downloading them.
mplayer, xine
Movie players.  mplayer supports just about every format under the sun but does not have much of a GUI, xine is much more user-friendly.
xmms
Music player, like WinAmp.
GNOME/KDE
Desktop environments (makes things look friendly, like Windows).  KDE is more slavish to Windows, GNOME follows the Mac.  Personally, I find GNOME more elegant and the apps crash less frequently, but GNOME apps do tend to be less well thought through in the user-interface department.  Install them both and figure out which one you prefer.
zip, bzip2
Zip will uncompress .zip files, bzip2 uncompresses .bz2 files (it gets better compression than zip or gzip).

If you are using Debian unstable, you will want to install only the bare minimum using the CDs, then when the installation is finished, reboot, switch to using the unstable version, then install.

3.  Configuration

Now that you have everything installed, you will need to configure everything.  Unfortunately, this is mostly out of the scope of this document, please see my Debian Log and my Gentoo Log (the latter being more recent) for the steps I did.  However, I would like to make a brief mention of networking, because it tends to be a bit problematic.

Networking

If you set up networking at install time, everything will usually run just fine for you.  However, if it doesn't work for some reason, you might want to be able to do things manually for testing.  The most reliable is a static IP address, which can be set by doing:

ifconfig eth0 down
ifconfig eth0 192.168.1.50 netmask 255.255.255.0 up
route add default gw 192.168.1.1 eth0

(substituting your numbers for the IP address.  If you are using a router box, usually IP addresses below .100 are reserved for static IPs.)  If you need to test DHCP, do either

dhcpcd -h hostname -d eth0

(the -d logs debugging information to /var/log/messages so that you can try to pinpoint a problem) or, if you use pump (RedHat),

pump -i eth0 -l 24 -h hostname

You can set your nameserver in /etc/resolv.conf with the following line:

nameserver 192.168.1.1

4.  General Unix knowledge


Copyright © 2004 by Geoffrey Prewett

1  If you forgot, you can try to get a virtual console and run /sbin/lspci, but if you knew that, you probably didn't need to read tutorial.
2  Originally the pager program was more.  But you could not go backwards or search;  the improved pager less did this.  On some Linux systems (e.g. SuSE), they are the same.  Generally you will want to use less.