Installing Debian

Discussion in 'Beginner Tutorials' started by Rob, Jul 9, 2013.

  1. Rob

    Rob Administrator Staff Member

    Messages:
    573
    Likes Received:
    183
    Trophy Points:
    43
    As it would be impossible in this course to talk about and give installation instructions for all of the Linux distributions, we have chosen Debian GNU/Linux for an example install.

    Why have we chosen this distribution?

    It is:
    1) A solid, quality Linux distribution with a long history (in Linux terms)
    2) It has been used as the foundation of many other quality Linux distributions.
    3) Non-profit and non-commercial (which lets us off the hook on a lot of issues!)
    4) Applicable to a wide range of uses and users, from newcomer to seasoned IT professional.
    5) Easily obtained and updated.


    About Debian

    The Debian Project was founded by Ian Murdock in 1993. Debian gets its name from the combination of Ian Murdock and his wife Debra's name (Deb-Ian) One of the Linux community's most illustrious people has been a primary developer of Debian. I'm talking about Bruce Perens. He was one of the founders of Pixar, the company that created the Toy Story films, Monsters Inc. and Finding Nemo.

    Debian has no company behind it. The Debian project is sponsored by Software in the Public Interest, a non-profit organization dedicated to helping produce open-source software and hardware. Despite its not-for-profit status, Debian is an extremely versatile distribution. It forms the base of many user-friendly distributions like Ubuntu, Linspire and Xandros. It can also be found running on thousands of mission critical servers that have to be up 24/7.



    Though the installation procedure is not as easy as some commercial distributions, it cannot be described as difficult either. We will go over this in more detail shortly. The major advantage to Debian is that it can be updated easily via their much lauded apt-get system.


    Getting Debian GNU/Linux

    If you have a broadband connection (FIOS, Cable, xDSL or better), you can easily obtain this distribution and install it. There are two major ways to do this. The most popular is to burn the Debian ISO images to CDs and install. If you have a CD burner, this is an ideal option. The second is to obtain a minimal ISO image especially designed for an install over the Internet. With this option, the files are downloaded as the installer needs them. This can also be done by downloading a single disk image file instead of multiple CD/DVD images. More information on these methods can be found at http://www.debian.org/distrib/


    If you don't happen to have a broadband connection, downloading Debian would be an extremely frustrating experience. You may want to consider contacting a local distributor of Debian CDs. Consult this page for further information about distributors in your area: http://www.debian.org/CD/vendors/


    Installation from CD or Net Install?

    Both installation methods are easy and provide a step by step walk through process. The end result will be the same either way. The main considerations between the two options really come down to speed and the availability of an internet connection. If you have both, then we suggest doing a \"Net Install\" and download and only the single small installation files. If the computer you are installing Linux onto does not have an internet connection, then you will need to provide all of the installation materials on CD/DVD.


    Now, let's get started.

    Configure Your PC to "Boot From A CD/DVD"

    You can start a Linux installation right from the CD/DVD drive. The way to find out is to look at your computer's BIOS. There's really no need here to go into what your BIOS is or what it does. (Just Google "how to change bios boot order") and enough help will be online...


    When you turn on your computer, there's a little message that says 'Press DEL to enter setup'. If you don't see this message, your PC manufacturer has probably hidden it behind their own "Splash Screen" containing their logo. Just hit DEL anyway. Pressing DEL when your computer boots up will get you into the BIOS setup tools. It won't get you into trouble, unless of course you start pressing buttons randomly. You'll see a blue screen pop up with some menu items. What you need to select is the item 'BIOS FEATURES SETUP' You'll see some more menu items. There's one that says 'Boot sequence'. That's the one you want. If you use the page up/ page down keys, you can set this item so that it says CD-ROM first. That just means that it will look for the disk in your CD-ROM/DVD drive first when the computer boots. Press ESC and then choose the item 'SAVE AND EXIT SETUP'. Don't forget to set it back to 'C' when you're finished installing Linux. We'll remind you later.


    If you can't boot from your CD there's an option to create a boot floppy. In your machine's BIOS, you might just see A,C - C,A and there's no CD-ROM mentioned there. Don't panic. You can make a boot floppy. They often come with boxed sets, but if yours didn't come with one, we'll cover how to create one further along.

    Plunk that CD/DVD in the drive!

    Okay. Now is the moment of truth. We've got the CD in the drive, and we're ready to go. Restart the computer. This should now boot the Linux kernel located on your CD ROM.


    What you'll have to do first is partition the hard drive. There is an easy way to do this. You can dedicate the whole hard disk or non-Windows partition (depending on the type of install you're doing). There is a better alternative. That is to partition your hard disk even further and put "parts" of Linux on separate partitions. For example, this is the scheme that works for me:

    Let's take a 10 gigabyte hard drive as an example. First, you should see how much RAM you have. From this figure, you create what's known as a SWAP partition. This is simply a way that Linux uses to get an extra memory boost. Custom dictates that your swap partition be double your ram memory. So if you've got 256 megabytes of RAM, the feel free to make a 500 megabyte swap partition. Then my partition scheme ends up looking like this:

    Code:
    Partition    Location        Size
    swap        /dev/hda2        500 mb
    / (boot)    /dev/hda1        1.2 gb
    /usr        /dev/hda3        3.5 gb
    /home        /dev/hda4        5 gb
    Assign partitions to look like this. Don't worry about the /usr and /home parts. That will come after. You must indicate here that you want / to be the bootable partition. /usr will contain most of the programs that will run on your machine. /home will contain your personal files. This kind of a partition scheme may come in handy if you have problems with your hard disk. You may be able to save information if it's located in different partitions easier than if it were only one big partition.
    Before we actually assign the other partitions their places and functions, we need to initialize and activate the swap partition. Do this now.
    Now you should initialize the / partition - the one that will boot the Linux kernel.

    Partitioning Hard Drives in Linux - Your hard disk is like a pie.

    You can divide it into sections. For example, if you had two partitions, popular operating systems would generally call them C and D. You can call them Ginger and Fred, or Ginger and Marianne or even the Professor and Marianne if you like. I just use these bad jokes as a way of saying that C and D are naming conventions that belong to other operating systems. Linux doesn't use them. Linux may call them /hda3 and /hda5 for example. We'll get to that in a minute. Then you will need another partition known as a 'swap' partition. This 'swap' partition is just a way that Linux uses to get more memory so that you don't run out of it.

    The classic way of partitioning your hard disk is with a program called 'fdisk' The program comes with a lot of whistles and buzzers and flashing messages that say \"Danger, Will Robinson\". There's a version for Linux but it doesn't mention Will Robinson. We want to say here that this is the SWAT team method of doing it - the scorched-earth policy of partitioning. If you have that important term paper on your hard disk, or pictures of that dream vacation to Hawaii that you haven't shown to your Aunt Betty yet or your best DOOM scores, you'll need to make back-up copies of them. The re-partioning using this method will get rid of them - forever! [cue ominous organ music].

    But installing Linux isn't dangerous and if you choose to install you may not need such a drastic solution to your partition problem. As we mentioned before, If you're fortunate enough to have a hard drive with more than one partition (the old C: and D: routine), then it may be just a question of moving some files around. Unfortunately this lesson can't take into account everybody's individual circumstances.


    There's a tool called FIPS that comes with major Linux versions. This will re-arrange your hard drive so you can install Linux. There are also other commercial products that will do the same. That may be an option for you, unless you've got a hard drive that's bursting at the seams. You should know that any decent working Linux system - and by decent, I mean, having the programs that will let you do anything you did with your Windows system- will take at least 2 gigabytes. Please keep that in mind. And if you want those videos of Hawaii on there, I'd plan for a bit more.


    To talk about where Linux and other operating systems should go. In any situation where you've got two things sharing the same space, like two people sharing the same apartment, one person will always exert his rights over the other. Other operating systems usually want to be the only ones in the computer, so even though it's really not going to be this way, you have to install them in the first 'primary' partition, and that way it thinks it's the only one there. That means installing it in /hda1 in Linux speak. So remember, if you've chosen to go the fdisk route, the other operating system should be re-installed first. When you've got that re-installed, you are free to install Linux in what's left. Once you've installed Linux, you can actually see the other system's partition, sort of like those phony mirrors at the supermarket. We'll talk more about that in another lesson.

    At this point you should have your hard drive partitioned and these partitions assigned to what areas they'll be housing.


    Now, comes the point in the process to install the Linux kernel. You can choose additional parts to add to the kernel, known as modules, to better use your hardware. Debian does a pretty good job of auto-detecting what you have, so there shouldn't be any need to touch anything here. People who know that they're going to have to use foreign character fonts may want to add additional support for font sets.


    At this point, you'll have to choose a 'hostname' or name for your computer. Use whatever naming scheme is comfortable for you. After, you should choose a 'domain' name. Even if you're not running an Internet server and even if you don't have a network you should choose a name as if you had one. Normally if you were in fact a server providing Internet services, you would choose a name and append .com, .net etc on the end. I would, of course, be a name registered with an official domain name registry. In the case of a single machine or a network that's connected to the outside only by way of a dial-up connection, you should choose a single name without the dot extension.

    Now you should enter your ISP's domain name server IPs. Each block (the four numbered set separated by periods) should be separated by a space.


    Now, as we're installing from a CD/DVD, you should choose 'CD-Rom/DVD' for the installation procedure. You should also choose the settings 'make system bootable'.


    Your hard disk is basically a piece of metal with a metal disk flying around in it at incredible speeds. It essentially does nothing unless you tell it to. At this point, we're going to tell it to boot up the Linux operating system. If you're contemplating a dual-boot system, you can also tell it to ask you to choose from different operating systems at boot. Debian uses a program called 'GRUB' to do this. Later, you can actually make alternative versions of the Linux kernel and have GRUB boot them. Right now, your safest bet is to install GRUB in the 'master boot record' when the install program asks you. The \"MBR\" is a little slice of the hard disk pie reserved for moments like this!


    The program may now ask you to create a rescue disc. These will come in handy. For example, I have often made the fatal mistake of *not* correctly configuring GRUB when I have made a new Linux kernel (yes, you can make them from scratch!) and my system has become unbootable. You can always rely on a rescue disks to get you out of this situation.


    OK, now's the time to reboot the basic system that Debian has installed. You need to remove the CD from the drives. It might be a good idea now, as your machine reboots, to go back into the BIOS and set it back for the machine to boot from your hard drive first (instead of from your CD drive). But at least make sure to remove the CD/DVD or else it will boot the CD/DVD again and start the install process again.

    Now it's time to begin inserting each one of the CDs you have. They will be scanned for available packages for install. There is a maximum of 8 in the set. Insert each one and wait until you are asked for another.


    When you have completed the scanning process, you will be asked to choose another 'apt' source. With Debian, you can download and update packages automatically right off this Internet with the 'apt' system. We will configure this later, right now it's best not to choose another apt source besides the CDs.

    At this point, if you are connected to the Internet by way of broadband for example and the install program can make a connection to Debian's security site, it will now start searching that site for security updates. From the time the ISO images are released to the point where you are installing, security flaws may have been found in certain programs included with Debian. For this reason a check is made and any programs with flaws are marked and updated copies downloaded and installed.


    After the security updates are finished, you will be presented with the possibility of doing a simple install with The Debian Task Installer. This will install programs after you have indicated your general preferences from a menu.


    If you are more adventurous, you may choose the more advanced install process by way of dselect. Here you will choose packages "by hand" from a list of hundreds. Though the dselect interface is not visually appealing and may appear daunting to newcomers, it is fairly straight forward and is actually quite user friendly in the sense that it is almost impossible to run into trouble with the packages you want to install. If you were to choose a package that conflicted with something else, you are notified. That way, you can either choose to keep the package that Debian recommends or "un-select" the package so your own choice can be installed.


    At the fork(s) in the road

    Here we reach the end of the install section. You will have to do some more work in this department, but due to the fact that the packages each person might choose and the hardware in his/her machine, we can't really document accurately what's going to go on from here. Our install road has reached a plethora of forks in it. Some simple advice: just answer the questions as accurately as you can and you should be fine.

    Post Install

    We'll assume that you've got a working Debian system now. If you've got a broadband or better connection to the Internet, you should now configure the apt-get system which will allow you to update your system quickly and painlessly. It will also allow you to get new programs by downloading and installing them automatically.

    If you have a basic knowledge of Unix commands already, You should go to the directory /etc/apt/ and do the following (as root). (Even if you don't, you may want to try it!)

    Code:
    mv sources.list sources.list.old
    This renames the file sources.list to sources.list.old. sources.list is what told the 'dselect' and 'apt' programs where to get the packages to be installed. Now we're going to change things a bit. We'll tell them to get packages off the Internet directly. We need to create a new sources.list file and add our new package sources to it.

    Code:
    vi sources.list
    This brings up the text editor 'vi'. There are people who love this program so much, they will challenge you to a pistol duel at 20 paces if you tell them you think it's lousy. If you have zero experience with Linux or Unix, 'vi' is probably *not* the text editor for you at this point, but with a few simple strokes of the keyboard, we can do what we want for now.

    Hit the escape (ESC) key and the letter 'i' and your ready to insert the following.


    Code:
    deb http://http.us.debian.org/debian stable main contrib non-free
    deb http://non-us.debian.org/debian-non-US stable/non-US main contrib non-free
    deb http://security.debian.org stable/updates main contrib non-free

    You may want to go to Debian's homepage and look up suitable mirror sites nearer to you. I'm sure the people who maintain the Debian website would appreciate it too!

    Now, to save the file, hit ESC again and ':' then type 'wq' (meaning write-quit) and your file is saved.

    Now you're ready to keep your Debian system in shape. We'll give you a refresher later on in the course, but you will probably be making use of these commands while you use Debian.

    Code:
    apt-get update
    + updates your system with the latest security enhances packages. Use: apt-get upgrade --show-upgraded to get a little more verbose report of what's going on.

    Code:
    apt-get --purge remove
    + removes any trace of a program from your system.

    Code:
    apt-get install
    + installs a new program.

Share This Page