Installing Linux on a PC

Linux is an operating system. It's really a version of the UNIX operating system, which has been used for many years as the workhorse of the IT business. Linux is free and runs on PC hardware. It's not too resource-hungry so it can run effectively on fairly old equipment, such as an Intel 80486 PC.

You can use Linux for learning. All of our online courses assume that you have access to computer running UNIX and a PC running Linux is ideal. You can also use it as a cheap software development and testing environment. In an office, you can use it to run core services - name server, web server, file and print server etc. It is very robust and makes efficient use of the PC it runs on. Many very large companies now use Linux this way. IBM has a version of Linux that runs on its large mainframe computers.

The official web sites for Linux are and (the documentation site).

Linux uses the same commands as UNIX, and you need to understand a few UNIX commands to install it. I give a quick guide to UNIX commands in a separate document, Once you have installed the system, you can download some Computer-based Training software from our web site that describes some useful commands in detail. There is a set of very useful Howto documents on the distribution CD which should be loaded onto your PC when ypu install Linux. The Linux documentation site holds the latest versions of the Howtos.

Most people are now onto their second or third PC, and you may have your previous model stashed in a cupboard. It will probably run Linux quite happily, although it would probably be smart to buy a bigger disk. They are pretty cheap these days. If you work, find out what your employer does with redundant PCs. Many companies scrap perfectly servicable equipment which is only a couple of years old.

If you don't have an old PC, buy one. Anything not powerful enough to run the current version of MS Windows sells very cheap, as little as 50. Nowadays this includes low-spec Pentium PCs. Look in your local paper or in Micromart magazine. Go to one of the specialist shops, rather than buying from individuals. Most shops give a three month guarantee.

Beware second-hand laptops. They not much cheaper than new ones and they have probably had a hard life. The guarantee usually excludes the battery and the screen, and both of these are prone to sudden failure and expensive to replace. Buy a new low-spec laptop instead and get a year's guarantee.

Before you buy a laptop, check the compatibility list on the Linux web site. Some don't work with Linux.

When you get a second-hand desktop PC, it's a good idea to open it up, take out all the interface cards, blow the dust off, clean up the connectors (carefully!) and reinsert the cards. This fixes anything that has become unseated in transit, which is a common problem. Note which slot each card was in - it sometimes matters. (Don't open up a laptop, unless you are a good watchmaker.)

You can run your Linux PC as a workstation, but you probably already have a Windows PC to do that. It's often better to build a small network and run your Linux PC as a server, connecting to it across the network from the Windows PC. My Notes on Networking explain how to set up a small network.

I run Red Hat Linux version 6.0 on 80486 PCs with 16 MB of RAM and fairly small disks, so I was disappointed to see that RH version 7 refused to install on these, complaining of insufficient memory. If you are buying a second-hand machine to run Linux, check that it will run the Linux that you have chosen. Upgrading it later could be expensive.

If you want super-high performance, add lots of memory to your PC. For Linux, size of memory has the most affect on performance, followed by disk speed. Processor speed doesn't matter so much, because in most systems the processor is idle most of the time. In fact, two slow processors will probably run faster than one fast one.

Most PCs either have IDE or SCSI disks. IDE is cheaper, and adequate for normal purposes. For super performance, use SCSI, as the disks can go much quicker. Linux only supports a limited set of SCSI controllers, although the situation is improving. Check your Linux supplier's web site for a comptibility list. SCSI comes in several flavours, so once you have chosen your controller, you have to buy disks that match.

Initial Checks

You need a Linux distribution CD containing a ready-built version of the system. You can them from a variety of suppliers:,, and others.

I used Red Hat's version. You can buy a CD from Red Hat, with support included, but this is expensive. A cheaper way is to buy one of the many guides to Linux which contain a CD in the back. I bought The Red Hat Linux Installation & Configuration Handbook by Hellums (pub Que). This was very useful at the installation stage. Mastering Red Hat Linux by Danesh (pub Sybex) is very useful for day-to-day running, and includes extracts from the Linux manual. Both books contain a distribution CD.

Alternatively, various software CD mastering services will make up a CD for you for a very small fee.

Each version of Linux has a slightly different installation procedure. I use Red Hat version 6.0. Your installation will probably follow the general principles that I describe here, but the details may be different.

To install Linux, you need a CD drive, a monitor and a mouse (preferably a three-button serial type). If you are using the PC as a server, you can take all these off when it's set up, leaving just the PC box and a keyboard.

If the PC is already running Windows, you can use that to do some pre-installation checks. Find out all you can about the video hardware - manufacturer, model number, maximum screen resolution, scan rate, number of colours and so on. If you have any other interface cards (sound card or whatever) find out all the details you can about those too.

You can also get your network card working and test it under Windows, as explained in the guide on building a network.

When you install Linux, it will destroy any data that the Windows PC held. Before you do that, have a quick check that you have transfered any vital data off to another Windows PC. If not, you can share the disk across your new network and copy it - just use Windows Explorer on one PC to navigate to the other PC's disk via the network neighbourhood, then cut and paste the files from one disk to the other.

To install Linux, you will need some floppy disks formatted as DOS boot disks. If your PC will boot off the CD you will need one, otherwise three. Format them under Windows. (The "/s" option formats them as boot disks.)

If your Linux PC does not boot off its CD, you need to put some data onto one of the floppies. Insert the Linux distribution CD and one of the floppies you just formatted. You will find a text file on the CD called something like README which explains what to do. You have to use the rawrite.exe program in the dosutils directory to set up your newly formatted floppies. There are files in the images directory containing the necessary data. Rawrite takes the data in the image files and copies it block by block to the floppy. Assuming that your CD drive is the D drive, do this:


and follow the prompts. You want to make a disk using the image file \images\boot.img. Label it "Linux installation boot disk".


If your PC will boot off its CD drive, this makes things much easier. Modern PCs will, old ones will not. Check the BIOS settings to see.

If the PC will boot off the CD, insert the Linux distribution CD, boot and follow the instructions.

If the PC will not boot off its CD drive, put the installation boot disk that you just created in the floppy drive and boot.

Whether you boot from floppy or from CD, The PC will start running the Linux installer. This is interactive, but precisely what it does depends upon the version of Linux you are installing.

The installer will ask you to choose a root password, format the hard disk and gather details about the hardware on your PC, maybe asking questions about the keyboard, the mouse, the video hardware and so on.

It will need to partition your hard disk. You need at least two partitions, one for the file system, one for swap space. If the machine gets very busy, it can store running data in the swap space instead of in the memory. Once it gets into that state, it will run very slowly, so this is to be avoided. However, a small amount of swap space is necessary. Set it the same size as the memory. The swap space should be a multiple of the PC's RAM (memory). For a home PC make it the same size or maybe twice as big.

The installer can install a standard package, workstation or server, or a custom build. These are all the same underlying system with different modules. Even if you choose a standard package like server, it will still ask whether or not to load certain modules. If you using the Linux PC to study our courses, you will need these modules:

You can load missing modules later, so it's not crucial if you make the wrong choices. I wanted to build a server, but my system didn't have enough disk for that. I installed the smaller workstation package and added a few extra bits later.

Along the way, the installer may ask you for a floppy disk to use as a rescue disk. If the system ever dies horribly you can boot from the rescue disk and use the stuff on it to repair the damage. Use one of the floppies that you formatted earlier. label it and put it away. If it doesn't create a rescue disk for you, create one later using a Windows PC as explained above. There will be another image on the CD for this purpose.

It can be hard to figure out all the answers to the questions about the video hardware. If in doubt, specify the miminum values - standard SVGA, 800X600, 16 colours, maximum refresh rate of 50 Hz and so on. It only really matters if you are going to use the PC as a workstation, and you can change the setting later once you have something working.

If your installer finds your network interface card, it will ask whether you want it to use DHCP or a static IP address. It may ask for a domain name (I used local.sys) and a hostname (choose something appropriate to the server's purpose - www for a web server). My notes on building a network explain these issues.

When I installed Linux the installer could not find my network card. I suspect that it can only find it if it has a particular IRQ and I/O address range, but I don't know what they should be. You can configure the networking later.

The installer will ask you to choose a root password. See below for a discussion of passwords.

When the installer sets up X-Windows, it will ask if you want it to start X when it boots. Unless you are setting up a workstation, say yes. This gives you a better environment to work in.

Eventually, the installer will finish, invite you to remove the boot disk and the CD, and reboot into Linux and show a login prompt.

To login, supply an account name and hit the enter key. At present, you have only one account root, so give that. It will prompt for the password that you chose earlier and log you in.

Once logged in, you will see a set of Windows-style icons. Lokk for one called command window or terminal and click on it. This will create a window in which you can type commands.

There will probably also be an icon to start up the Netscape web browser. If not, you can start it from the command window like so:

	 netscape &

If you are used to Microsoft Windows, you will find X-Windows familiar, but with a few irritating differences. In particular:

Creating User Accounts

By now, we can log in as root. As soon as you can, create an extra user account for day-to-day use. Each user has a numeric user id and a name. If you have more than one Linux PC, it's important to use the same names and user ids everywhere. Some system accounts have already been created. To avoid clashes, I choose user ids starting at 1001. To create a user account simon:

	 useradd -u 1001 -g users -d /home/simon simon
	 passwd simon

This creates simon with user id 1001, login group users and home directory /home/simon. The passwd command prompts you to specify simon's password.

Downloading Software

Once the network is running, you can download extra software from the Internet using Netscape. The search engine now has specific searches for Linux software.

Linux software is usually distributed in source-code form, in a compressed archive. The name of the file will end in .tar.gz or .tgz. You can download a piece of software and do most of the preparation as an ordinary user. You only need to be root for the final installation phase.

For example, in the downloads section on our web site you will find a file called learn-2.0.tar.gz which you can download. This is the CBT software mentioned earlier. To get it working, do this:

	 gunzip learn-2.0.tar.gz
	 tar xvf learn-2.0.tar
	 cd learn-2.0
	 make install

Gunzip (the GNU unzip tool) uncompresses the compressed archive, producing the file learn-2.0.tar. Tar extracts the files from the archive, creating the directory learn-2.0 (x says extract, v says verbose (print the name of each file) f says that the next argument is the name of the archive file). The command ./configure runs an automatic configuration script which figures out details of the environment (PC hardware, Linux and so on). Make compiles the software. Su becomes root for the final stage and make install installs the software.

At the end, to stop being root, type ^d (hold down the ctrl key and type d.

Now you are back to being an ordinary user. To run the CBT software, type:


In the distribution directory (learn-2.0 in this case) you will find a few files whose names start with a capital letter. They usually contain documentation. README contains general information, Install contains installation instructions.

Most of the software that you can download for Linux follows the same pattern. VNC (mentioned in the document on building a network) is an irritating exception. It has no autoconfiguration and installation scripts, so you have prepare it by hand. It does have a file Install explaining what to do.

Choosing User Names and Passwords

You need to set up at least two accounts (user names), root and another for day-to-day use. I use the account simon. If more than one person is going to use the PC, you need one account per person, plus root.

The root account is used to administer the system. (It is equivalent to administrator in a Windows network.) While you are logged in as root you can create users. You can also read any file on the system, install system software and, if you make a mistake, wreck everything.

All accounts are protected by passwords. In principle, if somebody can guess your account name and password, they can log into your PC across the internet from anywhere. In practice, your network gateway should prevent this, but it's still a good idea to use "strong" passwords.

Choose a password which you will be able to remember but that is difficult to guess. Avoid words from the dictionary (any language). Choose the password from a rich set of characters: a mixture of upper case letters, lower case letters and punctuation. Use at least six letters. You are allowed up to fourteen. A word from the dictionary with a punctuation character stuck on the end is not enough - it's too obvious.

You might use a mnemonic phrase and make the password from the first letter of each word, adding a few twists. For example, from "nobody will be able to guess my password" you might create the password "nwba2Gmp". Not bad, although it would be better if one of the characters was punctuation.

The passwords are stored on the system in encrypted form. It's not possible to reverse the encryption and reclaim the original password. When you log in, the system encrypts the password you give and compares it with the one it has stored. The administrator can change your password, but not tell you what the old one was.

It is feasible to write a program which cranks through millions of password guesses constructed using words from online dictionaries in various languages, encrypting each one and comparing it with the stored passwords. Tricks like this can guess badly-chosen passwords in a few hours, but well-chosen ones will take days or even months. A hacker who gets access to your system will try this, which is why you should choose strong passwords, based on the above rules.

Given the power of the root account, you should choose that password with particular care.

The classic mistake is to choose a strong password and then forget it, locking yourself out of your own system. If you write down a password as a precaution, don't leave it lying around near the computer.

Shutting Down

Before you switch off your Linux computer, you should shut it down cleanly. Do this as root:

	 shutdown -h now

It will take a couple of minutes to tidy everything up. If you are running the PC without a monitor, wait until the disk stops chattering.

If you forget, or you have a power failure, the file system will be damaged. As the PC boots, it will run the File System ChecK program fsck which attempts to fix up any inconsistencies caused by the crash. Usually it works OK. Occasionally a file or two will be lost. In the worst case, the entire contents of the disk will be lost. You need to take regular backups of important data, as you do on a Windows PC.

While fsck is running, the boot sequence stops, so you can't log in until it's done. Occasionally it will come across a problem it can't fix and put a prompt on the screen asking permission to discard a file. If you are running your PC without a monitor, and it never becomes ready to log in, this is the likely cause. You have to attach a monitor and tell fsck what to do. Problem: if you attach a keyboard to a PC while it's running, it's likely to freeze up or crash, so you need the keyboard to be already there.

Once you have got your Linux PC configured and working, you can remove the monitor and mouse and stick it in a corner out of the way, accessing it via the network, but you should leave a keyboard attached in case you get this a problem like this.

Copyright Notice

This document is copyright © Merrow Internet Services Ltd 2002. You may store it on paper or on a computer for private study and give it to other people for the same purpose. You must not change it in any way or exploit it for commercial gain.