Sunday, June 3, 2007

Getting Started with Linux

This section assumes you have an install CD with some version of Linux on it. I have installed several versions of Linux including Caldera, Redhat, Slackware, and SUSE. Most can be installed directly from the CD if you want. You can do this by setting your BIOS with an option to boot from the CD. If you can't do this, you will need to get or make a boot floppy. Usually there are utility programs on the CD, usually "rawrite" that can be used to make a boot disk from a DOS environment. Some systems also require a root disk to be made.
To make a boot floppy from the Redhat CD, issue the below commands. The example assumes your CD is on drive D and you are running DOS.
  1. D:
  2. cd /images
  3. /dosutils/rawrite
Enter "boot.img" for the source file and "a:" for the destination.

An Important Note about Your Type of Install

I have noticed many times that when people install Linux they will not have the capabilities they want or may get error messages when their system starts. Many distributions allow the following choices or more for their installations:

  • Workstation - For no or minimal networking. Only client services is installed, so if you use this installation, don't expect to telnet to your system since the service was not installed. Use this installation if you don't have a network card or will not want to provide any network services.
  • Server - Installs most packages.
  • Custom - Allows you to select the packages you want to install. This is the selection I normally make. If you are planning on providing services such as telnet, mail, or web services, do a server or custom install. I usually install all packages with the exception of foreign language how tos. Unless disk drive space is limited or you know you are setting a workstation up, this is the installation I recommend.
Do yourself a favor and consider carefully the type of install you will do depending on your needs. If you aren't sure and have a network card and the disk drive space, install everything using the custom installation. If you don't have a network card, do a workstation installation. I have seen more people have more trouble when they don't do the correct install. I have never understood, however, why anyone would prefer to use Linux as a workstation.

Partitioning

Most distributions use fdisk, cfdisk, or disk druid to set up partitions for Linux. You will need a Linux swap partition and at least 1 Linux native partition. You can install Linux with other operating systems such as DOS, windows95, 98, and/or NT/Win2000. If you will install with NT or Windows 2000, you must use extra care since NT's boot loader may conflict with LILO, the boot loader used by Linux. I have installed Linux with Windows98, and Windows 2000. What I recommend is setting your partitions in advance by using partition magic 4.0 or later. If you can't do it this way use fdisk, then you may have to format any non-Linux drives with the appropriate programs. I have noticed a tendency for some versions of Linux to not see some available Linux native partitions as set by partition magic. With Slackware I was able to correct this problem with its version of fdisk, but with Corel-Linux, I have not been able to get it to see all my partitions. This may be because some of them are extended.


Partition sizes:

  • Swap partition
    The swap partition, I usually make 128Mb. The recommendation is that the swap partition be twice as large as RAM memory or greater. In the past Linux could not use swap partitions larger than 128MB but the size limitation depends on your system's architecture. On most Intel based systems, a swap partition of up to 2GB can be used. You can also make multiple swap partitions.
  • Native Partition(s)
    If you are setting up a computer you will be learning Linux on or installing several operating systems, you may want one Linux native partition per Linux install. If, however, you are setting up a dedicated high performance server, you may want to set up several Linux native partitions and install various parts of the operating system on separate ones similar to the following recommendation or some modification thereof:
    1. / - Root size of 200MB
    2. /usr - Holds local software. Minimum of 700MB, Recommended 1.7 GB or more.
    3. /var - Holds mail, spool, and log files. Recommended size of 400MB
    4. /home -The rest of the disk, Used for user storage and in a multi user system, is where most data will be stored.

In systems that I will use at home or learn on, I normally use one linux native partition per Linux install. If I'm installing Redhat and Slackware I might make two 3GB partitions. I like to make the size of my Linux native partitions about 3G depending on the amount of hard drive space I have and the number of systems I am installing. This is because Linux takes about 0.8G to 1.3G for a full install and some room is left over for expansion. If installing only one Linux system, I like 4-6G. One thing I like to do when installing a system to be shared with Windows, which can make life convenient and save your data, is to make a large partition on a large hard drive that is FAT32. Since Linux can mount this and most if not all Windows operating systems can see this, your data can be available in a common filesystem on this partition. Also, if you need to, or want to do a re-install of an OS, you don't have to worry so much about the bulk of your data. You will need to worry about things like mail messages, address books, and Internet favorites/bookmarks. On my system at home I have a 13G and 20G hard drive. I set the 20G hard drive to be one large Fat32 partition. The 13G drive is divided into a 4G FAT32 for windows, 3 3G ext2 (linux native) for 3 versions of Linux, and a 128M Linux swap. I make all partitions primary when I can. The only drawback to using a VFAT filesystem with Linux, is it does not properly store file permissions. There are defaults used, and some bugs relating to capital letters in files when using VFAT filesystems from Linux. You should be aware that if you install many operating systems on one hard drive, you may have a problem if your boot point is beyond your 1024 cylinder limit. This is purely a function of your operating system BIOS. I have found that systems running AWARD BIOS are less likely to have this problem.

Mount Points

A mount point is a directory which a device or partition is attached to. During your install you may need to choose mount points for specific filesystems. You will need to set the mountpoint of "/" for your root filesystem on the disk partition you are installing your system to. For example if you are installing your system on the second partition of an IDE drive, you will select the "/dev/hda2" drive mount point to be "/".

If you want to mount other drives or partitions, you may, for example, mount your second hard drive or partition to a directory called "/data". Once your install is complete you will need to be sure this mount point exists and possibly create it with the "mkdir /data" command. Then the next time you boot your system, this partition should be available for use (or you can use the command "mount -a" to mount all filesystems in the /etc/fstab file.

Connecting to Windows based Systems

If you want to share files and printers with other computers, you will want to be sure Samba services is active on your system. See the section in this User's Guide about Samba.

The 1024 cylinder limit

In the past LILO has had a 1024 cylinder limit that would not allow you to boot to operating systems installed above cylinder 1024 on a hard drive. This is no longer the case, however, not all computer motherboard BIOS will support booting above the 1024 cylinder limit. You should check with the manufacturer of your motherboard to determine if this is a problem on your system. The ASUS P3B-F motherboard for the Intel PII and PIII series microprocessor will support booting beyond the 1024 limit.

Installing multiboot systems with Windows NT or Windows 2000

When installing multiboot Linux or Windows systems that are not NT or Windows 2000 systems, you will normally install LILO to the master boot record of the hard drive. Then LILO is configured to allow selection of one of the installed systems to boot. When you install with NT or Windows 2000, since these systems have their own boot loader, you will need to install LILO to the partition you are installing Linux to rather than the master boot record. If you are installing Windows 95 or 98 with Windows 2000 and Linux, I recommend the following order of installation on your hard drive.

  1. Windows 95 or 98
  2. Linux
  3. Windows 2000 or NT on an NTFS file system

You will need to install Windows 95 or 98 first, then you may install either Linux or Windows 2000 or NT. Be sure to make an emergency boot file when installing Linux or you will not be able to boot to it again. Also you will need to install LILO on the boot record on the partition that you install Linux on, not on the master boot record (the first partition). After you perform the installations you will be able to boot Windows 95 or 98 and Windows NT or 2000 from the Windows boot manager, but you will not be able to boot to Linux without the emergency boot disk.

Allowing Linux to boot from the Windows boot manager

There is a Linux+NT-Loader mini howto that you can get a copy of at The Linux Documentation project website. This howto applies to NT and 2000. This documentation does not replace that howto but gives additional tips and information. To get the NT boot loader to boot Linux you will need to do the following:

  • In Linux:
    • Log into Linux as root by booting from your emergency boot floppy.
    • Issue a command like:

      dd if=/dev/hda2 of=/bootsect.lnx bs=512 count=1

      This assumes you installed Linux on your second partition. You may need to enter a different value if you installed it on a partition other than the second one or are using a SCSI drive. See the "Basic Devices" section for a description of the correct labeling for these devices. The above command will copy 512 bytes from the master boot record of the partition where Linux is installed. It will place it in the file, bootsect.lnx, in your main root filesystem tree which you may get to by issuing the command "cd /", then you may see the file with the command "ls -al". You need to copy this filesystem to a disk storage media that Windows 2000 or NT can read. Windows cannot read a second extended filesystem (ext2) that Linux is installed on. However both Linux and NT can read a FAT32 ore VFAT filesystem. This is why I usually make a FAT32 or VFAT filesystem available on a multiboot system when Linux and Windows are both used.

    • If you have a VFAT filesystem on your system copy the bootsect.lnx file to it using the "cp" command. If you did not do this, you can easily use a DOS boot floppy and issue the command:

      mcopy /bootsect.lnx a:

    • Be sure your Linux boot floppy is not in your disk drive and use the "shutdown -r now" command to reboot your system. Select Windows NT or 2000 when your system boots.
  • On Windows NT or 2000:
    • Copy the bootsect.lnx file created in the last series of steps to your c:\ drive.
    • Select "Start", "Run", and "cmd" and press ENTER.
    • On the command line enter "attrib -s -h -r -a c:\boot.ini" and press ENTER. This will make it possible for you to edit the boot.ini file.
    • Use an editor such as Wordpad under the programs, accessories section to edit the c:\boot.ini file and add the following line to the end of the file:

      c:\bootsect.lnx="Linux"

      Of course "Linux" is a label and you can use the text of your choice.

    • Select "Start", "Run", and "cmd" and press ENTER.
    • On the command line enter "attrib +s +h +r +a c:\boot.ini" and press ENTER. This will make the boot.ini file a system, read only, hidden file again.
    • Select "Start", "Shutdown", and shutdown the system for rebooting. When your system boots you should be able to boot and run Linux. If this does not work, it may be a 1024 cylinder issue noted earlier.

You can also install multiple copies of Linux on your system and update the copy of LILO you just installed to enable you to boot to those other systems. You should become more familiar with LILO to do this by reading the section on LILO in this User's Guide and in The How Linux Works Guide.

What is a bootloader?

To save yourself a lot of agony, you should keep in mind what a bootloader program is:

  • A bootloader is a simple program that resides on the boot record of a partition.
  • A bootloader can cause program, or system control to jump to one of the following based on its configuration and your selection:
    • The boot section of another partition.
    • Operating system code and files at a particular location on a particular partition.

Also realize that some operating systems place code on the boot record of a partition that begins execution of the operating system. An example of this is DOS which places a program on the primary partition's boot record, which is the master boot record. Therefore, if you cause a bootloader program to transfer control to the boot record of a partition with no bootloader program, or resident program to start the operating system you are trying to boot, your system will "hang" and stop running. When installing bootloaders such as Windows NT bootloader or Linux's LILO, keep in mind its function. Depending on the configuration of LILO, it can transfer control to a Linux operating system or to a partition boot record. To transfer control to a Linux operating system, the location of the kernel (Partition it is on and complete path to the kernel file or link to it), and the root filesystem is specified. See the section on LILO for more information or read about LILO in the How Linux Works Guide.



No comments: