How to Install Debian Linux on a desktop computer

How to Install Debian Linux on a desktop computer

offline
  • gamzzy 
  • Legendarni građanin
  • Pridružio: 24 Apr 2003
  • Poruke: 10725
  • Gde živiš: Novi Sad

In this first of a two part series, I will try to guide you through installing Debian Linux for a desktop computer.



For those unfamiliar with Debian, all I can say is I've tried and used a lot of distributions, but nothing comes close to Debian. Debian is the old grandfather of Linux and was one of the first Linux distributions out there.

It was certainly the first distribution with package management. Besides having a rich history, Debian is reputed to be rock-solid, has excellent package management system and to go along about 15,000+ packages (as of today). It is completely free in spirit and in cost.

So why isn't everyone using this wonderful distribution? Critics have come up with several reasons. They say Debian isn't user friendly enough. They say the installer is too archaic. They say the packages are too outdated. And it's all true to some degree...but only if you choose the Debian Stable branch.

Now for a little explanation about the branches. Debian is divided into three branches: stable, testing, and unstable. Debian Stable contains packages which have passed their rigorous testing procedures.

The "Testing" branch contains tested packages that aren't considered stable. But it is the "Unstable" branch that interests us. It's the one that contains more recent packages and is perfect for desktop use. "Unstable!" I hear you say. Why would you use anything called unstable? Well, you've got to take the name with a grain of salt. After all, Debian creates the most stable Linux ever created.

Their idea of unstable is in regards to server use and is perfectly suited for desktop users. If you don't like the name, Debian Unstable also goes by "Sid".

Interested yet? Before we begin I must warn you that Debian requires you to have some Linux knowledge, but by no means do you have to be a elite hacker to run Debian.

You must be able to:

- Be comfortable with building kernels, loading and unloading modules.
- Have a decent knowledge of your computer's hardware (model names and numbers), in case you need it.
- Edit configuration files and read documentation.

If you aren't comfortable doing some of the above things, Debian will give you a great opportunity to learn. If you'd rather run Debian without going through all the fun of installing and configuring Debian, there are a multitude of Debian-based Linux distributions such as MEPIS and Libranet. Lastly, it is also recommended that you have a broadband connection.

Ready to go on a Debian installation spree? Let's get started.

Obtaining Debian


Just like most other distributions, you can download an ISO file and burn it onto a CD. There is a list of mirrors (PLEASE INSERT LINK: http://www.debian.org/CD/http-ftp/) where you can download from. Keep in mind that we'll be getting the Debian Stable ISO and we will upgrade it to Unstable after installation. For most of us, the file to download (as of today) is debian-30r2-i386-binary-1.iso. Download and burn the ISO, put the CD in your drive and reboot.



The Installation:

Much has been said about the Debian Installer. Most of it is very negative. However, it really doesn't live up to its expectations. It's actually a simple yet powerful installer. You are presented with a list of choices with the two most likely options at the top. You can jump around from one step to the other, but it's best to stick to the tried and true routine. The installer defaults work quite well for most people.

The first screen you encounter is the "Welcome to Debian GNU/Linux 3.0!" At the "boot:" prompt please enter "bf24" (without the quotes) and press enter. This is essential to do because it tells the installer to install the 2.4 kernel series. You will see some boot messages scroll past the screen. After this you will be greeted with a standard language selection screen. I'm going to assume this will be English for most of us. Press "Continue" on the Release Notes screen as this screen is just informational. Then we will arrive at the main installation screen.

Press enter to get to the keyboard configuration screen. Press enter again to accept qurerty/us as your keyboard unless you are sure you have a different kind. On the next screen, press enter again to select partitioning your hard disk as the next step. You will be presented with a list of hard drives and must pick which one you wish to partition.

The next two screens are informational so please make note of them and move on. You should now be presented with the cfdisk partitioning utility. You must create a minimum of two partitions, a swap and a root. First, let's set up the swap partition. Use the buttons at the bottom of the screen to create the partitions. Press the "New" button and then press.

"Primary" and then for the size put in a value about double the value of your RAM. Don't make it too big though, 512MB is a good high number. Press "Beginning" when it asks you where you want the partition. Then press the "Type" menu entry and then press enter twice. Make sure the partition is correctly shown as "Linux Swap" and the size is right.

Similarly, make the root partition. It should be atleast a few gigabytes, the more the better. There is no reason to change the type for this partition. Now press the "Write" button and then type "yes" to confirm your decision. Type q or press the "Quit" button to exit cfdisk. You will return to the installation screen.

Press enter to move to the swap partition initialize screen. The installer will ask you if you want to scan for bad blocks. Say no. Say yes to confirm the initialization of the swap partition. Press enter again to get to the initialize Linux partition screen.

You will be asked to select what filesystem you would like. While ext2 is a good choice, ext3 is better yet because it provides journaling capabilities. The journaling capacity of ext3 means fewer file system checks and less data corruption. Ext3 is the recommended choice here, although you can choose ext2 and even reiserfs.

On the next screen, say no when it asks you to run a bad-block scan. The next screen is another confirmation screen: say yes. You will see some messages as the installer formats your partition. On the next screen, say yes when it asks you to mount the root filesystem.



You will return to the installer menu. Press enter to get to the kernel installation screen. The installer should detect your Debian CD and ask you whether you want to use it as the primary medium. Say yes. The installer will then copy the kernel and some modules onto your hard drive.

Press enter again to get to the driver category screen. This is an important screen. For most people, the Debian installer should have detected your hardware and loaded appropriate drivers and you don't need to do it manually.



However, if at a later stage of the installation you find that (say) your network isn't working you need to return to this screen and loaded the appropriate driver. However, for now press enter to exit this screen and you should return to the installation menu again.

Press enter to configure the network if you are connected to the internet directly (not through a dial-up modem). The first screen you will see is the hostname screen. Change it to a desired name and press enter. On the next screen, say yes to automatic DHCP configuration unless you know what you're doing.

In a few seconds, you should get a confirmation that the settings were properly detected. If it does not or if the installer did not find a network interface altogether, you need to troubleshoot your network. Make sure the cable isn't loose and call your ISP to see if the network is having problems. If these tactics don't work, go back to the driver category screen and select a module for your network card. If the module installation is successful, come back to the network configuration screen and try again.

Press enter to install the base system. The installer will install base and core packages. It will not install X or KDE or Gnome or any kind of graphical interface. We will install it ourselves after installation is over.

After the base system is installed, press enter to get to the make system bootable screen. Now we will install the boot loader. Install LILO to the master boot record (this will work for most of us). If the installer detects any other operating systems on your computer it will ask you whether you would like to add them to the LILO boot menu. You should add these as you may need to boot them in the future.

Almost done! You can optionally make a boot floppy but I always skip this step. Select the "Reboot the System" option. The computer will reboot and you should see a LILO menu and Debian should boot by default.



Upon rebooting, you will be presented with a few questions about your system such as your time zone etc. Next, it will ask you to set the root password. Say yes to enabling MD5 and shadow passwords. Set a root password. Then it will let you add a user for daily use. Next, say yes to remove PCMCIA packages. Say no to PPP installation unless you have a dial-up connection.

For the next step make sure your Debian CD is in the drive. This is to ensure that the packages on it are scanned. When you are asked if you would like to add another apt source, say yes and then select the "Edit sources list by hand" option. A text editor will be opened. Append the following lines to the file:

# Primary
deb ftp://ftp.us.debian.org/debian testing main contrib non-free
#deb-src ftp://ftp.us.debian.org/debian testing main contrib non-free
deb ftp://ftp.us.debian.org/debian unstable main contrib non-free
#deb-src ftp://ftp.us.debian.org/debian unstable main contrib non-free


# non-US
deb ftp://ftp.ie.debian.org/debian-non-US testing/non-US main contrib non-free
#deb-src ftp://ftp.ie.debian.org/debian-non-US testing/non-US main contrib non-free
deb ftp://ftp.ie.debian.org/debian-non-US unstable/non-US main contrib non-free
#deb-src ftp://ftp.ie.debian.org/debian-non-US unstable/non-US main contrib non-free

# Experimental
#deb http://ftp.us.debian.org/debian ../project/experimental main contrib non-free
#deb-src http://ftp.us.debian.org/debian ../project/experimental main contrib non-free
# ***Do not edit above this line, ok to change sources below this line***

# Security updates

deb http://security.debian.org testing/updates main contrib non-free

# java

deb ftp://metalab.unc.edu/pub/linux/devel/lang/java/blackdown.org/debian unstable main non-free

Press Control-X to exit the text editor. It will ask you whether you want to save changes. Press "y" and then press enter. The configuration program will ask you whether you want to add another apt source. Press no. Say yes when it asks you to use security updates. When it asks you to run tasksel, select no because we still haven't upgraded to the unstable branch. Say no to run dselect also.

If you select to remove PCMCIA packages, it will do so now and delete unnecessary package files if needed. Setup will probably run exim configuration. Press 5 (No configuration) to exit this. You should be presented with a login prompt. Login with the root account.

The other file we need to modify is the /etc/apt/apt.conf file. Create that file using your favorite text editor and add the following lines:

APT::Default-Release "unstable";
APT::Cache-Limit 10000000;
Apt::Get::Purge;

The most important line of apt.conf is the first one which tells it to get packages in the "unstable" branch. To finalize our completion switching our Debian system to unstable, enter the following commands as root:

apt-get update
apt-get dist-upgrade

This should take a few minutes. The first command refreshes the list of packages in the apt system database and the second one upgrade packages on the system to unstable. Having a broadband connect really helpful here as the system downloads and installs packages.

After this process is finished, you will have a fully working Debian Unstable installation. However it is far from being a complete and up to date desktop. We don't even have our graphical system and window manager installed.

For the purpose of installing XFree, Debian provides a meta-package (a sort of super package) that contains all the packages you need. This package is called x-window-system. To install it, type:

apt-get install x-window-system

Similarly, there is a meta-package for Gnome and KDE. To install gnome and KDE
apt-get install gnome
apt-get install kde
So now you have either Gnome and/or KDE installed. You probably also want a display manager such as kdm and gdm to allow for graphical logins.

apt-get install gdm
or
apt-get install kdm

If you use a graphical display manager you're most likely going to want to run automatically at bootup. To configure bootup services, Debian has an excellent tool called rcconf. To install rcconf, you guessed it:

apt-get install rcconf

After it installs, run rcconf and select gdm or kdm as a service you would like to run.

No desktop system is complete without good hardware detection and plug and play support. Two plugs in play services that I like to use are discovery and hotplug. For example, just the other day I plugged in my USB keyboard into one of my computers. I didn't expect Debian to detect it. Not only did it detect it configured it for my use because I had hotplug and discovery running at bootup.

apt-get install discovery hotplug

Notice how you can chain two packages together into one command. This will install both discovery and hotplug. Also, run rcconf again to make sure these services are started at bootup.

So now we have a completely functioning Debian desktop! In the next part of this series I will show you how to properly configure audio, video, and printing. I will also give some great optimization tricks that will make Debian fly including upgrading to the 2.6 kernel.

Till then, happy Debian hacking!

About the Author: Tarun Agnani is a senior in Computer Science at university. He has a internship doing software development at the current moment. When he's not tinkering with computers (and breaking them), he enjoys pursuing the Rich Inner Life through friends, family, and fun. You can find his website here



Registruj se da bi učestvovao u diskusiji. Registrovanim korisnicima se NE prikazuju reklame unutar poruka.
offline
  • gamzzy 
  • Legendarni građanin
  • Pridružio: 24 Apr 2003
  • Poruke: 10725
  • Gde živiš: Novi Sad

Speed Improvements with hdparm

hdparm stands for “hard disk parameters”. Debian comes with fairly conservative hard drive parameters that do not take advantage of DMA that most new hard drives are equipped with. Debian does not comes with hdparm installed by default, so let's go ahead and install it.

Make sure you are logged in as root. To switch to root from a normal user account you can use the “su” command.

apt-get -y install hdparm

Before we begin, I must warn you that there is a reason Debian does not come with a default hdparm installation and that is hdparm is a risky command. Hdparm can cause unexpected data corruption! However, in my experience and on my system, I haven't had any problems.

Now we will perform some diagnostic tests on our hard drive to see which hdparm flags and settings provide us with the maximum speed.

I'm going to assume that your main hard drive is /dev/hda. This should be correct for most people. You can run hdparm on all your hard drives because it is a low level command and does not depend on the data present on the drive. For example, I have two drives. One contains operating systems (Linux, Windows) and the other one contains data. I ran hdparm on both my drives and it resulted in speed improvements.

Before running diagnostic tests, make sure no intensive programs are running at the same time. For example, you might want to log out of Gnome or KDE. You can press Ctrl+Alt+F1 to switch to a virtual console. To get back to X, press Ctrl+Alt+F7.

hdparm -Tt /dev/hda

You should see results like this:

/dev/hda:

Timing buffer-cache reads: 128 MB in 1.34 seconds =95.52 MB/sec

Timing buffered disk reads: 64 MB in 17.86 seconds = 3.58 MB/sec


Of course your numbers will be different. Keep those numbers in mind or write them down. We want to set our hdparm parameters so those numbers will improve. But first we want to see what hdparm settings are already on our drive. To do that execute the following command:

hdparm /dev/hda

Here are some example results:

/dev/hda:

multcount = 0 (off)

I/O support = 0 (default 16-bit)

unmaskirq = 0 (off)

using_dma = 0 (off)

keepsettings = 0 (off)

nowerr = 0 (off)

readonly = 0 (off)

readahead = 8 (on)

geometry = 1870/255/63, sectors = 30043440, start = 0


Explaining all those parameters is beyond the scope of this article. You don't need to know what they mean to benefit from them in any case.

Try the following command on your system. If your system hangs then the flags are not appropriate for your drive. Reboot and try another setting.

hdparm -X66 -d1 -u1 -m16 -c3 /dev/hda

If the command works on your computer, great! We can now test to see if it has improved our hard drive speed by running the diagnostic test again with hdparm -Tt /dev/hda.

Regardless of whether the first command worked for you, try these other settings

hdparm -X34 -d1 -u1 -m16 -c3 /dev/hda

As always run the diagnostic test and see which numbers are best for you. Note down the exact command that results in the biggest speed improvement for you because we will need it later.

If both commands make your system crash, your drive may not support some of these features. You can do some more research on hdparm by reading the manual page of hdparm by running man hdparm.
Please note that hdparm settings are not permanent. That is, they are lost once your system reboots. So we need to start it every time the system boots. This is where the hdparm.conf file comes in.

nano -w /etc/hdparm.conf


At the very bottom of the file, insert the following:

command_line {
hdparm -X34 -d1 -u1 -m16 -c3 /dev/hda
}


Replace hdparm -X34 -d1 -u1 -m16 -c3 /dev/hda with the optimal command for your system. The default hdpam.conf file also has a nice explanation of parameters. After you get a feel for them, you can experiment to further fine tune your settings. You should see a significant difference in your system performance. I was quite surprised with the noticeable boost I got on my system. It is generally true that the hard drive is the slowest component in a computer. This is because most hard drives have actual moving parts. The speed of the hard drive has an impact on the rest of the system. This is why if you have ever upgraded an old hard drive to a newer, faster one you notice an improvement in overall system performance.

Now that we are zipping happily through Linux Land, we need some tunes.


Configuring Sound

The first step in configuring sound is finding out what chipset your sound card uses. Linux provides us with many interesting system utilities. One of these is lspci. This command will simply list all the PCI devices on your computers. Most modern computers exclusively use PCI connectors for sound, networking. Every card except video cards (which use AGP) are connected via PCI.

Since we are interested in audio devices, we have to filter out the lspci information using grep. Execute the following command:

lspci | grep audio

This should give you the sound card chipset information we need. On my computer, I get that I have a Ensoniq ES1371 [AudioPCI-97]. Note down your card information. What we are going to do is install a module for our sound card. To install modules at any time in Debian, we can use the modconf utility. It is a powerful utility so be careful with it. Double check you are loading the right module.


Run modconf as root:


modconf

Select “kernel/drivers/sound” and press enter. You will be presented with a list of kernel modules for sound cards. Scroll through the list and look for any modules matching your sound card and press enter again. For my system, I selected es1371. You will be asked if you are sure if you want to install to module. Say yes. If you're asked to enter kernel parameters, don't enter anything. You should see a screen that tells you that the module was installed successfully.

If the module loads, you are almost done with configuring your sound setup. The last thing you have to do is add yourself to the “audio” group. All users under the audio group have access to the sound card. So if you're not in the group, you can't play and sound.

As root, issue the following command:

adduser username audio (replace username with your normal username)

You will have to log out and log back in to have these new group permissions take affect. Log out now and back in. Test out your sound using a player such as XMMS. If your sound does not work, try searching on Google for a solution. Most sound cards should work with Linux and Debian. Hardware support has improved in Linux to a point where it can be said it is par with Windows.

Now we have one aspect of multimedia solved, we can move on to the other one: video.


Configuring Video


In the first article, I showed you how to install the X Window System. As you've probably noticed that when installing certain packages Debian will ask you questions. This configuration of packages as they are installed is through a system called debconf. It is just one of the unique things in Debian that makes for a more integrated system. When you install the X Window System, debconf will ask you several questions relating to your video setup. Answering these questions should result in a usable X setup. However, if it turns out your setup is not working or you need to reconfigure something you can reconfigure your X Window setup using the dpkg-reconfigure command like so:

dpkg-reconfigure xserver-xfree86

You can use dpkg-reconfigure for anything else. All dpkg-reconfigure lets you do is give you another opportunity to see the configuration options for a package.

The only reason to execute the above command is if you are having problems with your video setup. Once you have a working set up, you can execute gdm or kdm to test it out. If all goes well, congratulations! Configuring X Windows is one of the biggest hurdles new Linux users face but once you get used to it, it really isn't all that bad.

So assuming we have a working X configuration and our sound is also working, we are now ready to move on to bigger and better things. We have already installed either Gnome or KDE (or both). The next thing on our checklist is to configure playing videos.

Due to some controversial licensing issues with Debian's policies, popular codecs such as DivX and Quicktime and others are not included. Neither is the multimedia player called mplayer. This situation is well known in the Debian community and there is much debate over it. If you are like me and do not understand the legal aspects of software and just want your videos to work, you can install unofficial mplayer packages. This is really not as difficult as it sounds. All we have to do is add one line to our sources.list file, update our apt sources, and install mplayer and related sources. Log in as root and issue this command:

echo deb ftp://ftp.nerim.net/debian-marillat/ unstable main >> /etc/apt/sources.list

This command adds the nerim.net ftp site (which contains mplayer deb packages) as one of our sources. Now we need to tell Debian to refresh its package list:

apt-get update


Now that this is done, we can finally install mplayer and the codecs:

apt-get -y install mplayer-586 w32codecs

Optionally, you can also install a video player called Totem. It is my personal favorite because it has a simple graphical interface and resembles Windows Media Player in some ways.

apt-get -y install totem

Try opening some video files using either mplayer or Totem. They should work. You might have to configure Gnome or KDE so that every time you open a video file it opens in your favorite video player by default. This is relatively easy to do these days with modern desktop environments.

Great! Sound and video done. What else? Don't forget printing.


Configuring Printing

Back in the old days of Linux, you'd pretty much have to buy a new printer if you wanted to use Linux on a desktop. Thankfully, those days are long gone. Some of this progress can be attributed to the CUPS system. The CUPS system is slowly replacing the old LPD system. So the best way to get up to speed with printing in Debian is to install cups and some related packages. On my computer, I executed this as root:

apt-get -y install cupsys cupsys-client cupsys-bsd

After CUPS is installed, we have several options when it comes to configuring CUPS. The easiest way is if you have Gnome or KDE. If you have KDE, you can go to the KDE Control Center and click on “Peripherals” and then “Printers”. Make sure you select CUPS as your printing system. You can add a printer using the Control Center.

Personally, I am more familiar with Gnome as I am a Gnome user. To set up printing in Gnome, you need to install the package gnome-cups-manager. Do this as we always do with apt-get -y install gnome-cups-manager. Then run gnome-cups-manager as root. Double click on “New Printer” and use the wizard to add a new printer. Try printing out a test page.

If the above method fails or if you don't use KDE or Gnome, you can use the built in CUPS configuration system. In my opinion, the built in configuration utility is a little less friendly than the other methods we have explored. The CUPS utility web based which means you can view it in a browser. Using your favorite browser, open the address

http://localhost:631/admin

It should ask you for your username and password. Enter root as the username and put in the root password. Click “Add Printer” and put in the required fields. You can put any name you want. In the next screen, most people should select “USB Printer #1” if they have a USB printer. If you have a parallel one you need to change this selection of course. Most new printers are USB printers.

In the next few screens, the utility will ask for the make and model of your printer and you should have this information available. You can use the CUPS configuration utility to print a test page. It's usually a good idea to go ahead and print a test page just to see if your set up works and if the colors look OK.


Conclusion

Whew! It seems like a lot of work to get Debian to play sound, video, printing. I think the work is well worth it and it really gives you a real sense of how Debian works. One of the great things about Linux is that you really get to educate yourself as a user. This article just scratches the surface of what Debian and in general Linux is capable of. I hope you really experiment with system and tweak it your liking. Only by doing so you will not only have the satisfaction of a custom built system but also gain the insight to how the system works.

Debian provides us with a stable and solid system but it is by no means infallible. If and when something does go wrong, knowing the system inside and out is the best tool you have. I hope you've encouraged some among you who have been afraid to install Debian to take the challenge. It is truly a joy to use and I hope more people discover it everyday.

About the Author:Tarun Agnani is a senior in Computer Science at university. He has a internship doing software development at the current moment. When he's not tinkering with computers (and breaking them), he enjoys pursuing the Rich Inner Life through friends, family, and fun. You can find his website here



Ko je trenutno na forumu
 

Ukupno su 905 korisnika na forumu :: 13 registrovanih, 2 sakrivenih i 890 gosta   ::   [ Administrator ] [ Supermoderator ] [ Moderator ] :: Detaljnije

Najviše korisnika na forumu ikad bilo je 3466 - dana 01 Jun 2021 17:07

Korisnici koji su trenutno na forumu:
Korisnici trenutno na forumu: bobomicek, DragoslavS, FileFinder, ILGromovnik, Koca Popovic, Kubovac, ladro, Metanoja, operniki, Oscar2, repac, Trpe Grozni, Tvrtko I