Sunday, May 18, 2008

Ubuntu: Achieving Stability Through A Minimal-Install

How many times have you had to reinstall Ubuntu due to a series of issues with your current installation, whether it be from unexpected lock-ups, or maybe a certain application would just periodically crash? Perhaps you had suspend/hibernate issues, or nautilus would constantly fail to load on start-up? These issues, no matter how big or small, tend to drive people to believe that Ubuntu simply isn't as stable as so many people make it out to be. I came very close to that same misconception after experiencing one-too-many issues with Ubuntu 7.10 and 8.04, each of the distro's problems being radically different from the other. I'm here today to tell you that Ubuntu can be as stable as people say it is, even if you have to jump through a hoop or two to make it so.

This guide will help you to achieve maximum stability through your Ubuntu OS, starting with a minimal command-line install, and working your way up to a more stable desktop environment. Don't be afraid: I assure that it's not as hard as you think.

Getting Ready

Before we can begin, you will need a well-burned copy of Ubuntu; more specifically, the ubuntu-8.04-alternate-i386.iso, assuming you plan on using the 32-bit version for the standard desktop computer. Once you download the ISO file, you need to burn it to a CD-R. If you're using Ubuntu already, this is as simple as double-clicking the ISO and choosing the desired burn-speed. NOTE: It is strongly suggested to burn the ISO at a very slow speed to prevent possible disc-burning errors. Many recommend no faster than 4x, though I've always burned it at 10x and have never experienced a problem. If you're using Windows, there are many applications available for download that will burn ISO's for you. MagicISO is a popular one, as is PowerISO. There are plenty of guides and howto's available if you need help, including the official Ubuntu one located here.

After you burn the CD, it's strongly suggested that you verify the md5sum of the image. Don't worry, it's not difficult. The official Ubuntu ISO burning howto linked above tells you how to do it in both Ubuntu and Windows.

Installing The Base System

Now that you have a well-burned and hash-checked copy of the alternate install of Ubuntu, we're ready to get started. Insert the CD into your CD-ROM drive and restart the computer. If you are unable to boot into the CD, be sure to check your BIOS settings and verify that your boot order is set to boot from CD first.

When it starts, you are presented with a menu to choose your desired language. Using the arrow keys, scroll to the one you want and press enter. Next, press F4 to select an alternate install mode. This should be what you see:

















Using the arrow keys again, scroll down to the option that reads "Install a command-line system" and press enter. Be sure you are on the menu option that says "Install Ubuntu" and press enter once more to begin.

1. Once again, you are asked to choose the desired language for the installation procedure. Scroll to your preference and press enter. Choose your country and press enter again.

2. Unless you have no idea what kind of keyboard you use, or what language you speak, you'll want to select "NO" for this next menu, which asks if it should automatically try to detect your keyboard layout. If you choose "YES", you have to go through several steps that will not be mentioned here, so only select this if choosing "NO" is not intuitive enough for you. Proceed by selecting your keyboard language layout. For anyone in America using a standard QWERTY english keyboard, just press enter twice to select the default USA options.

The installer will now check your hardware and proceed to scan the CD and prepare it for installation.

3. You are now given the option to name your computer. This is the name that other computers on your network (if you have one) will see. Even if you don't have a network, you still need to give your computer a name. What you name it doesn't matter. It's up to you. After that, you simply need to choose your time zone.

Partitioning

It's time to partition your hard drive to prepare it for the install. Many people fear partitioning, and as such, like to stay clear of it. Here is the menu you should see:

















If you are installing Ubuntu on your entire hard drive, and are not interested in creating a backup partition, media partition, or any other form of unrelated partition, then this step will be quite easy for you. Just select the option that says "Guided - use entire disk" and be on your way. For the rest of us, the following will guide you in creating your own partitions.

1. Select "Manual" from the menu. If your hard drive is new, or the partitions were recently formatted, then your menu should look something like this:

















If not, then you may have a few extra options under your main hard drive name. If one of them is not another OS and you have no interest in keeping it, highlight it, press enter, and scroll to the option that says "Delete this partition". The rest of this partitioning section assumes that you just have a blank hard drive with no partitons. You can still follow along, as long as you don't touch the partition that you want to keep.

2. Select your main hard drive and press enter. It will ask you if you're sure you want to create a new parition table. Select YES and continue. Your menu now looks like this:

















3. Select the partition with the "FREE SPACE" option. Select "Create a new partition". You are now going to decide the size you want your main partition to be. This is the partition that we will be installing Ubuntu on. If you are going to make a seperate media partition, then this partition doesn't need to be very large. 20.0 GB will be more than enough to hold your installation and plenty of software you may choose to install. Heading along that track, go ahead and enter "20.0 GB" into the given area and press enter. You can change it to as little as 8 to 10 GB if you wish. Since the hard drive I created for this guide is only 20 GB, i'm going to make my main parition 10 GB. After you decide the size, it will ask you if you want the partiton to be Primary or Logical. We want "Primary". Select "Beginning" for the next options.

4. Next, it gives you a menu to set the options for the partition. Make sure they match the picture provided below, and scroll to "Done setting up the partition", pressing enter to continue.

















Now that we have the main partition set up, we need to create a SWAP partition. This is similar to virtual memory in Windows, and is used if you run out of RAM, and to store an image of the hard disk during hibernation. With that in mind, we're going to want this to be a decent size. I always have mine at 5 GB, but it's recommended to have at least twice your physical RAM. A fair amount (3-5 GB) is necessary if you don't want hibernation problems. To create it, repeat steps 3 & 4, but make it a "Logical" partition, located at the "End" instead of the beginning. To make it a SWAP partition, press enter on the option that says "Use as: " and select "Swap area". This gets rid of the rest of the options. Make sure it is NOT set to be bootable.

There you have it. We've successfully created the neccessary partitions. You'll notice that you still have the FREE SPACE option on your partitioning menu. After we get the system installed, we'll create the extra backup or media partitons then. For now, select "Finish partitioning and write changes to disk". Make sure your information is correct and select "YES" to continue.

The installer will now install the base system. It will pause only to ask you for your desired username and password. Unless you know what you're doing, just press enter when it asks you about HTTP proxy information. When prompted, remove the CD, press continue, and wait to boot into your new operatin system.

On Your Way To GUI Heaven


When your system boots back up, you are presented with nothing more than a command line asking you to log in. Do so by entering your username and password. When you're logged in, this is what you should see:













Now we will insert a series of commands to get a simple GUI ready to use. VERY CAREFULLY type these into the terminal, pressing enter and agreeing to each one:

sudo aptitude install xorg
sudo aptitude install metacity
sudo aptitude install gdm
sudo aptitude install gnome-terminal
sudo reboot

Upon startup, once you log in, it will tell you that the fast_user_switch_applet couldn't be found. Just press delete. If you want all of the default software included with Ubuntu, just go to Applications -> Accessories -> Terminal and type

sudo aptitude install ubuntu-desktop

After you have all the default apps, there should be very little, if any, difference between your current installation and what a normal default Ubuntu installation would look like. You can proceed to install things like drivers and additional applications. If you choose not to install ubuntu-desktop, then you can start manually finding and adding packages you need through Synaptic (System -> Administration -> Synaptic Package Manager) or the intuitive Add/Remove program (Applications -> Add/Remove).

Summary

The information in this guide is exactly what you need to achieve a minimal installation of Ubuntu 8.04 Hardy Heron. If you have any issues, or you need help getting things to work, you can leave a comment or send me an e-mail. Both will be answered promptly. Additionally, you can head on over to the official Ubuntu Forums, where there are literally tens of thousands of people who are willing to help you.