Professor Norm Matloff's Beginner's Guide to Installing and Using Linux 1

Dr. Norm Matloff

Department of Computer Science

September 17, 2008

University of California at Davis


Contents

Overview

Background Needed

I have tailored the material here to beginners. No special sophistication in computers is needed. Any typical Microsoft Windows user should be able to understand the instructions here and install Linux in less than an hour's time. (Do not be intimidated by the length of this document; you probably will not have to use most of it.)

What Is Linux?

Linux is a form of the Unix operating system. Though originally Unix was used mainly by engineers and scientists and thus was not very familiar to the general public, a lot of what you take for granted on computer systems today began in Unix. A notable example is the Internet--the first major operating system to implement the TCP/IP protocol at the heart of the Internet was Unix, and that led to the general acceptance of the protocol.

In the early 1990s, computer science student Linus Torvalds decided to write his own version of Unix, which he called Linux. Other ``homegrown'' versions of Unix had been written, such as MINIX, but what distinguished Linux was the scale of worldwide participation involved. Torvalds innocently put a message on the Internet asking if anyone wanted to help, and he got a torrent of responses.

There are a several reasons why Linux is mainstream today. First, it became known as a very reliable, stable operating system, with one result being that Linux has become a major platform for large corporate Web servers. Another reason is that it, and the vast majority of the software associated with it developed elsewhere, is free. Many companies have found that it is cheaper to run Linux on their PCs, both for this reason and because of reduced maintenance costs.

There are several good reasons for you to use Linux:

If you are a university computer science student, there are some very important additional advantages:

Linux Distributions

Linux comes in various distributions, called distros by Linux afficionados--but they are all Linux in terms of functionality. Some of the most popular are Ubuntu, Red Hat, Fedora, SuSE, MEPIS, PCLinuxOS and so on.

Which One Is Best?

Remember, there are tons of good distros out there. Any of the above would be fine, as would many others, but here is the short answer: Use Ubuntu. It is arguably one of the most user-friendly of the distros, and it has a large user community you can access in the Ubuntu forum on the Web, probably the most active one out there.

I now use Ubuntu myself on my home computers, as well as on my office computer, after years of using the Fedora/Red Hat Linux distros. I find that Ubuntu's package installation works much better, for example.

If you have an old machine, especially one with limited memory (i.e. RAM), you may wish to give Puppy Linux or Damn Small Linux a try. I installed them (one at a time) on an old 1998 laptop with only 64M of memory! And they take as little as 50M of disk space. See Section 3.5 for details.

Obtaining Linux

You can obtain your desired distro (assuming it's one of the free distros, such as Ubuntu) by downloading from the Web and burning a CD (its basic installation form is small enough to fit on a CD).

Or you can buy a book devoted to the distro, or buy a Linux magazine that includes a CD for it.

Important note: If you download Linux from the Web and burn it to a CD or DVD, make sure that you burn the ISO image, as opposed to copying the ISO file as you would in, say, a backup operation. Your burner software should have a choice in its menu for this.


Live-CD Linux Distributions

A more recent concept in Linux distributions is that of live CD distribution. Here the Linux package is on a bootable CD-ROM. The user inserts the CD in the drive, reboots, and then Linux boots up.

The advantage of this approach is that one does not have to get involved in disk partitioning, a sometimes difficult process. One is using Linux without actually installing it, thus without changing the disk partitioning.

A disadvantage is that it may not allow one's application programs to save files to the hard drive, unless one has already split the Windows partition, defeating much of the purpose. However, one can save files to a USB key.

So, the approach ideal for those who wish to just try Linux for a short period of time, but not so useful for long-term use.

The first well-known live-CD distribution was Knoppix, but there are many others today, including Ubuntu, whose CD you can use either as a live-CD or for permanent installation.

If you use the live-CD approach, you may of course skip Section 3 of this tutorial.

Live CDs As Rescue Tools

Among other things, Knoppix has developed a reputation as being useful as an OS rescue/repair tool, including for Windows! And now, most of the live CDs can be used this way. For details, see a Knoppix book or search on the Web.


Installing Linux

Assumptions

Generality/Specificity of Coverage

This part of the tutorial will not go into the details for installing one particular distribution. That would be impractical, since the details for any one distribution often change substantially from one release to the next. So instead, this section on installation will discuss the major points you should watch for during the procedure. It will sometimes use Ubuntu as an example for concreteness, but the principles should be similar for most other distributions.

Your Machine

It is assumed that you have an Intel-compatible desktop or notebook, with a bootable CD-ROM or DVD drive. You should have at least 128M of RAM. I recommend that you have at least 10G of disk space available for Linux, though 5G would probably be enough. If you have a smaller machine, try one of the distros designed specifically for that purpose, discussed in Section 3.5.

Determine Your Hardware Details

The Linux installation program will be able to sense most of your hardware information. So, you can probably skip our section here. But if you want to take about five minutes extra time here, it could be helpful later if you write down some of your hardware types before beginning installation.

You could download the free program Hardinfo, and run it to record a list of your hardware. Or to check your hardware from Windows XP, select My Computer $\vert$ Control Panel $\vert$ System $\vert$ Hardware $\vert$ Device Manager. Click General to get the amount of RAM and CPU type. Then go to Device Manager, and click on the `+' next to each component, e.g. "Disk drives,'' "Display adapters'' and so on. Write down the information, including your hard drive type, such as IDE; your video card make and model; your monitor make and model; the type of connection used for your mouse, such as PS/2; the make and model of your printer; etc.

Do you still have the manual which came with your monitor? If so, check the specs in the back, and write down the horizontal sync and vertical refresh rate, and the make and model.


Partioning Your Hard Drive

Today most Linux distros, such as Mandriva, SuSE and Ubuntu, do the disk partitioning for you. This is a major advantage, as partitioning is a vital but delicate operation. Later in this section, I'll give you some advice for the Ubuntu case, and also give you some options to use if you have a distro that does not do automatic partitioning.

But I do suggest that even if you will have automatic partitioning done, it would still be worthwhile for you to read Section 3.3.1. This would be useful both for the installation process and later on in your role as an ``informed consumer.''


What Is Partitioning?

Again, it is probably not necessary for you to know the material here, and it is rather detailed, but you may find it useful at some point. I do recommend that you take a few minutes and read this section.

A hard drive will consist of one or more partitions. A partition is a set of contiguous space (sequential blocks) on the disk, and is treated as an independent disk.

So, assuming you want your system to include both Windows and Linux (termed a dual boot situation, since you can boot either system), you will need at least one partition for Windows and one (actually two) for Linux.

It's important to understand how the naming works: In Linux systems, all I/O devices are treated as ``files.'' If your first hard drive is of the IDE type, the entire drive is probably called /dev/hda, i.e. the ``file'' hda within the directory /dev. In the case of SATA-type hard drives, the notation is /dev/sda etc.

Your first CD-ROM/DVD drive is likely /dev/hdc (your third ``hard drive''), your first USB port is likely /dev/sdf1 and so on.

Partitions within your first drive are called /dev/hda1, /dev/hda2 and so on. Your original Windows single partition was probably /dev/hda1.

Within a partition you'll have some type of file system. The disk consists simply of a long stream of bytes, with no structure, so the OS needs to have a way of organizing them into files, recording where in that stream each file has its bytes. But you don't need to know the details. Windows XP and Vista use the NTFS file system. The standard Linux file system is ext2 (number 0x83, sometimes called Linux native), or possibly ext3, for your main Linux partition and of type swap for your swap partition (number 0x82, used for temporary storage during the time the OS is running).

PCs were originally designed to have up to four ``real'' partitions, called primary partitions. After people found that to be too constraining, logical or extended partitions were invented. You should install Linux in a primary partition, for recovery reasons, but it is not necessary.

Before You Do the Partitioning

Before you start, give some thought as to how much of the original partition you want to keep for Windows and how much you want to leave for Linux. If you plan to become a serious Linux user,2 you'll want to allocate at least half of the space for Linux.

You really ought to run Windows' chkdsk command first, in case you have any bad sectors on your hard drive. You may also wish to defragment.

Partitioning Using GParted

Today most distros will invoke a partitioning program to do your partitioning. This could be the famous GParted program, or one that the authors of your distro wrote themselves.

You can use GParted on your own by downloading and booting a GParted live CD before you install Linux, but I'll assume here that your Linux installation program invokes either GParted or another program written specifically for your distro.

Since every distro will handle this a bit differently, what I will do here is just give you an understanding of what operations need to be done, with the specific mouse clicks needed varying from one distro to another.

I'll assume that you want your Windows and Linux systems to coexist on the same hard drive. So when your distro's installer program asks you whether you want to use the entire disk, be sure to say no! Of course, if you do want to erase Windows, or if you are installing Linux on a separate drive from Windows, you can go ahead and use the whole drive.

Here are the main steps in GParted, roughly stated (you may see some variation):

The Installation Process

To Begin

By the way, if you are upgrading or replacing another version or distribution of Linux, see Section 10 before beginning.

Put your Linux CD-ROM or DVD in the drive, and reboot. The installation program should begin.4

Questions You May Be Asked During the Installation Process

The trend in time is for the installation programs to actually ask you fewer and fewer questions, i.e. the process has become more and more automated. Most of the questions discussed in this section will NOT be asked--Ubuntu will probably ask none of them--but the information here will give you an idea of how to answer if they are asked.


Installing Tiny Linuxes

Post-Installation Configuration

This section describes some further steps I recommend taking after your installation is finished.

Help in Hardware Configuration

Having trouble getting some hardware component to work under Linux? I'll have some tips on that below, but keep in mind that a great source is the Web. Plug something like ``Linux install XXXX,'' where XXXX is the type of machine you own) into Google. Actually, it would be better to specify your distro, e.g. ``Ubuntu install XXXX.'' You'll find a number of reports of experiences by other people with your machine/distro.

Configuring Your Search Path (``Why can't I run my a.out?'')

Most Linux distros do not include your current directory, `.', in the PATH variable. Thus if for example you compile a program and then type

a.out

the shell may tell you that a.out is not found. You are expected to explicitly specify the current directory:

./a.out

If you consider this a problem, as I do, to remedy it in the case of the BASH shell (the default shell for most distros), edit the file  /.bash_profile In the line which sets PATH, append ``:.'' (a colon and a dot) at the end of the line, with no intervening spaces. Then log out and log in again, or do

source ~/.bash_profile

Configuring a Printer

Your Linux distribution should have some program to help you configure your printer if something went wrong during installation. For example, if you are running the GNOME GUI, select System $\vert$ Administration $\vert$ Printing.


Wireless Networking

Connecting

If you are running the GNOME windows manager, select System $\vert$ Administration $\vert$ Network. In KDE, it's System $\vert$ Network Device Control.

Highlight the entry for your wireless device. Your WiFi device is probably eth1. Make sure the box is checked. Then you'll probably have to click on Properties or something like that.

The names of wireless access points are called ESSIDs. You can determine which ESSIDs are within range of you by typing the command

$ iwlist scanning

into a terminal window. State the ESSID you want. (Note that some of the ones listed might be private.)

If you are connected to a router or a wireless access point, you probably get your IP address via DHCP, rather than statically.

Other Tools

Your Linux system will provide various tools to configure and monitor your network:

Useful commands from a terminal window are:

You can activate/deactivate your netword card during a session. In GNOME, this is done via System $\vert$ Administration $\vert$ Network.

If You Have a Problem

WiFi might work for you ``right out of the box,'' with no configuration on your part. If not, this section is for you.

Some wireless network cards typically sold with PCs today do not have direct Linux drivers available. A common example is the Broadcom BCM43XX series. However, you can still operate as usual after some preparation:

Know Your WiFi Card

You first need to determine which wireless card you have. On the laptop I use now, I determined this by running dmesg and lspci under Linux, and by exploring under Windows. Sure enough, it turned out to be a Broadcom BCM43XX series card.

I then obtained the driver files for my Broadcom wireless card. Windows said that it was using bcmwl5.sys for this card. I got it from my Windows partition, which on my machine is at

c:\windows\system32\drivers\bcmwl5.sys

(As noted in Section 11, this may not be easy to do directly. If you have trouble, boot Windows and copy the file to a USB key, then go back to Linux and read from the key.) Or, I could have downloaded it from the Web.

BCM43XX Series

As mentioned, many laptops come with this card. If your version of Linux uses kernel 2.6.15 or newer, then things will be pretty easy, as the kernel does include a driver for your card.

In Ubuntu, you merely need to request that the driver be downloaded and installed, as follows:5 Select System $\vert$ Administration $\vert$ Hardware Drivers. Check the Enable box for Firmware for Broadcom 43 Wireless Driver. You will be asked whether you want the firmware to be downloaded from the net; say yes. Then check Enabled after the download.

Other Cards/Kernels

For other machines, go to the ndiswrapper home page, http://ndiswrapper.sourceforge.net/. The program ndiswrapper allows Linux to use Windows drivers.

Other Considerations

I found in one wireless site that there seemed to be a problem with DNS, the system that translates ``English'' addresses like wwww.google.com to their numerical counterparts, e.g. 66.102.7.104. If you find that the former fails but the latter works, you probably have a DNS problem.

One way to handle this would be to configure your machine to have a secondary DNS site. You can use one given to you by your ISP, for instance. To add it, use the network configuration tool in your Linux distro. For example, under the GNOME GUI, select System $\vert$ Administration $\vert$ Networking $\vert$ DNS.

Encryption

For information on how to deal with WPA encryption, go to http://computerbits.wordpress.com/2006/10/27/fedora-core-6-installation-notes/or plug something like ``Fedora BCM43XX fwcutter'' into Google.


Configuring KDE/GNOME for Convenient Window Operations

Autoraise Etc.

You should find that windowing operations are generally easier in Linux systems than in Windows, in the sense of requiring fewer mouse clicks, if you set things up that way. Personally, I find it annoying in Windows that, when I switch from one window to another, I need to click on that second window. In most Linux windowing systems, I can arrange things so that all I have to do is simply move the mouse to the second window, without clicking on it. The term for this is focus follows mouse, and we can configure most Linux windowing systems to do this.

Also when I move from one window to another, I want the second one to ``come out of hiding'' and be fully exposed on the screen. This is called autoraise, and can be configured too.

You can arrange this configuration in less than one minute's time. Again, the exact configuration steps will vary from GNOME to KDE, and from one version to another within those systems, so I can't give you the general steps here but here is how it works on a GNOME system: click System $\vert$ Preferences $\vert$ Windows, and check Select Windows When the Mouse Moves Over Them (this may be referred to as focus on your system) and Raise Selected Windows After an Interval (this may be referred as autoraise). I move the slider for the latter all the way to the left, for 0.0 seconds. For KDE, as of September 2007 the sequence is K $\vert$ Control Center $\vert$ Desktop $\vert$ Window Behavior; after that, the choices are similar to those described for GNOME above: at Policy, choose Focus Follows Mouse and Auto Raise.

Saving Window Places Between Sessions

If upon bootup you'd like to have the same windows in the same places as in your last session, you can arrange this to occur automatically in GNOME by System $\vert$ Preferences $\vert$ Sessions $\vert$ Session Options and then checking the proper box.

Some Points on Linux Usage

To log out in GNOME, select System $\vert$ Shutdown. It is similar for other desktop managers.


More on Shells/Terminal Windows

In Microsoft Windows, most work done by most users is through a Graphical User Interface (GUI), rather than in a command window (Start $\vert$ Run $\vert$ cmd). In Linux, a lot of work is done via GUIs but also it is frequently handier to use a command window, called a terminal window. You should always keep two or three terminal windows on your screen for various tasks that might arise.

You can start a terminal window in GNOME by selecting Applications $\vert$ Accessories $\vert$ Terminal; the other desktop managers are similar.

You may be given a choice of several terminal types, say gnome-term, xterm etc., but it doesn't much matter which one you choose.6 If you are using gnome-term, you may wish to reduce the font size, by holding down the Control key and hitting the - key twice.

When you type commands in a terminal window, the program which reads and acts on those commands is called a shell. (Thus a terminal window is sometimes called a ``shell window.'')

I have an introduction to Unix shells, based on the T C-shell, tcsh at http://heather.cs.ucdavis.edu/~matloff/UnixAndC/Unix/ShellIntro.htmland http://heather.cs.ucdavis.edu/~matloff/UnixAndC/Unix/CShellII.html.

The default shell in Linux is bash. It is very good, but if you are used to using, say, tcsh,7 you can use the chsh command in any terminal window to change your login shell.

Cut-and-Paste Window Operations

The X11 windowing system used in Linux has its roots in 3-button mice. Today, most people have such mice (the middle wheel counts as a button), but if you don't, that's no problem, because Linux does 3-button emulation for you. The middle button is emulated by simultaneously clicking both left and right buttons.

To do a cut-and-paste operations, hold down the left mouse button and drag it to highlight the text you wish to copy. Then go to the place you wish to copy that text, and simultaneously push both the left and right buttons. Generally, more things are cut-and-pastable in Linux than Windows, so this is a big convenience.

Mounting Other Peripheral Devices

This section explains how to use DVDs, USB devices and so on under Linux.

Mount Points

Each I/O device that contains a file system must be mounted, i.e. associated with some directory. That directory is called a mount point. The files then appear in that directory.

These days most Linux distributions have a designated directory for mount points for DVD/CD-ROMs, USB devices, floppy disks, etc. This will vary from one distribution to another, but typical directory names are /mnt, /media etc.

You can check what is currently mounted by running the df command from a shell window (another good Linux learning experience). The mount points are listed along with the /dev files.8 Also, to list the /dev files for all your operating drives including USB flash drives, type fdisk -l.

For more detailed information, such as file system types, just run mount without any arguments.

Your machine's internal hard drives, and possibly other devices, will be mounted automatically at boot time. Many, but not all, such devices and their mount directories is maintained in the file /etc/fstab. The details are an advanced topic, but even without understanding everything, you might find it worthwhile to take a quick look at that file.

When you attach a device to your machine after bootup, your system will probably recognize it immediately, and maybe pop up a window showing the device's contents. If you have trouble, you can use the Unix mount command. This is an advanced command, but just to give you an idea, a typical usage would be

mount -t iso9660 /dev/hdc /mnt/yyy

This tells Linux that the I/O device corresponding to /dev/hdc, our CD-ROM, should be mounted at the directory /mnt/yyy. If that directory doesn't exist, you must create it first, using mkdir. The field -t iso9660 says that the file system type is ISO9660. This is standard for CD-ROMs, and you can probably omit it.


Reading Your DVD/CD-ROM and Floppy Drive from Linux

The files are available under the mount point, as explained above. If they contain music or video, you of course will need a program to access them; see Section 6.2.7.

CD/DVD Burning

You can use the shell-based cdrecord and dvdrecord programs, but it is much easier to use one of the GUI-based programs. I use gnomebaker.

If you do not have that program, you can download it from the Web. Under Ubunta, for instance, simply type

sudo apt-get install gnomebaker

Run the program by typing

gnomebaker

in a shell window. The GUI will come up.

In the bottom right-hand corner, set the size of the CD/DVD (a typical DVD has capacity 4.7G), then click Create Data Disk.

Then go to the Filesystem section in the upper-right portion of the window, and choose your directory. Then for each file you want to burn, click and drag it from the File section at the upper-right to the Data Disk (or Audio Disk) section at the bottom of the window. If you wish to copy an entire directory, just drag the directory name.

To burn an ISO image, select Actions $\vert$ Burn CD/DVD Image, then select the .iso file, and burn.

Using USB Devices

USB drives, including memory sticks, should have their filesystems mounted automatically when you attach them. Use the df command to check where they've been mounted (it could be in the directory /mnt/ /media etc.).

USB mice should become automatically usable when you attach them.

A Note on Ubuntu


Root Operations

Ubuntu works like any other Linux distro, except for one important point: Ubuntu does not have a root user account in the classic Unix sense. Instead, whenever executing a command which requires root privileges, one precedes the command by the term sudo (``superuser do''). One is then prompted for a password, which is the password for the first user account created at the time of installation.

If you have a lot of root-type work to do in a session, type

$ sudo -s

to create a new superuser shell, and do your work there.

Linux Applications Software

GUI Vs. Text-Based

Most people prefer to use GUI-based applications. If you are one of them, rest assured that there are tons of them available for Linux.

I do wish to mention, though, that the ``super hard core'' Linux users prefer to use text-based applications, rather than GUI ones. For instance, I and many others like the mutt e-mail utility (Section 6.2.3), which is text-based. Here's why, at least in my view:

However, in listing my favorite applications in Section 6.2 below, I've made sure to list both text-based and GUI programs.


My Favorite Unix/Linux Utilities and Applications

Text Editing

I use a modern extension to the vi editor, vim. This is the version of vi which is built in to most Linux distros. See my tutorial at http://heather.cs.ucdavis.edu/~matloff/vim.html.

Note: In the Fedora distro, somehow the version of vim that is linked to vi isn't configured fully correctly. I suggest using /usr/bin/vim directly.

Even though vim is text-based, it does have a GUI version too, gvim. This comes with nice icons, allows you to do mouse operations, etc. Unfortunately, most Linux distros seem to have only the text-based program. To get the GUI, you can download it yourself. In Ubuntu, do

sudo apt-get install vim-gnome

For this, you may need to edit /etc/apt/sources.list and uncommented the lines for Canonical's 'partner' repository


Web Browsing

Your Linux distro will come with a Web browser, probably Firefox, and possibly Konqueror in addition.

I almost always use Firefox. But believe it or not, sometimes I use the famous text-based browser, lynx. In some cases, it is just plain quicker and easier. Moreover, you can do cool tricks, such as recording keystrokes for later playback, thus enabling one to do certain Web operations automatically.

If you use Fedora, your Firefox system may not be configured for Java. If so, see http://www.mjmwired.net/resources/mjm-fedora-fc6.html#java. NOTE CAREFULLY: This site has some very long shell commands, which will not be completely displayed unless you make the browser window quite wide.

If you are short on memory (i.e. RAM), you may wish to use a lightweight browser, such as Galeon (related to Firefox but somewhat fewer features) or Dillo (really bare-bones).


E-Mail

I use the mutt e-mail utility. It is very flexible and customizable, and excellent features. For example, it has great search capabilities, important if you are a heavy e-mail user. I like its ability to record the fact that one has already replied to a message, and the fact that it allows you to save partially-written message for a later time when you can finish writing it. It is text-based, not GUI, but the functionality it gives is what really counts, in my view. See my tutorial at http://heather.cs.ucdavis.edu/~matloff/mutt.html.

In Ubuntu, download it by typing

sudo apt-get install mutt

If you prefer a GUI-based mail utility, many nice ones exist for Linux. Check the Web for these, or use the Thunderbird e-mail utility in the Firefox Web browser suite.

HTML Editing

I usually use Vim, along with some macros I've written for HTML editing, but I sometimes use Amaya, which is a full-featured GUI HTML editor, written by the Web policy consortium. One nice feature is that you can actually use the embedded Web links, good for testing them. See my tutorial at http://heather.cs.ucdavis.edu/~matloff/amaya.html.

There are many newer and more powerful packages, such as Quanta+, Bluefish and NVu.

Integrated Software Development (IDE)

For C/C++ work, I actually don't use an IDE. I find that the vim editor (cited above) and the ddd GUI interface to the gdb debugging tool, work great together. For example in vim I can type :make (which I have aliased to just M, or with gvim click on the make icon, and the source code I'm debugging will be recompiled. And as I've mentioned, it's important to me that I use the same text editor for all applications, which most IDE would not allow me to do. I use either GDB (try CGDB!) or DDD for my debugging tool. See my tutorials at http://heather.cs.ucdavis.edu/~matloff/vim.htmland http://heather.cs.ucdavis.edu/~matloff/debug.html.

DDD is also usable with my favorite programming language, Python.

However, if you love IDEs, try Eclipse. I've got a tutorial that is more complete than most, at http://heather.cs.ucdavis.edu/~matloff/eclipse.html. It can be used with C, C++, Java, Perl, Python and many others.

Also, for KDE users, there is a very well-received IDE named KDevelop. I lean toward Eclipse, though, as it is easier to learn, is cross-platform, and can be used with more programming languages.

Word Processing

I use LATEX because of its flexibility, its beautiful output, and its outstanding ability to do math. You may like Lyx, which is a great GUI interface to LATEX which is especially good for math work. See my tutorials at http://heather.cs.ucdavis.edu/~matloff/latex.html and http://heather.cs.ucdavis.edu/~matloff/lyx.html.

If you wish to work with files compatible with the Microsoft Office environment, there is a free suite of programs, OpenOffice, which provide Microsoft compatibility. It is packaged with most Linux distributions.

If you would like something that quickly converts an Office file to rough text form, say to use with e-mail attacments, try Antiword. In Ubuntu, install via

sudo apt-get install antiword


Playing Movies, Music, Etc.

MPlayer is free and very good. Its capabilities are amazingly broad.

The documentation is extensive, and hard to navigate, but here are a couple of things to get you started:

Installation:

It's easy in Ubuntu:

sudo apt-get install mplayer 
sudo apt-get install mencoder

Otherwise, build it yourself, as follows.

One downloads the source code, MPlayer-1.0pre7try2.tar.bz2 and the codecs, essential-20041107.tar.bz2, from www.mplayerhq.hu/design7/dload.html.

Unpack the codecs file first,

tar xfj essential-20041107.tar.bz2

This creates a new directory. Copy the contents of that directory to the directory /usr/local/lib/codecs (use mkdir to create it if necessary). (Note: There may be legality issues with some codecs. When in doubt about a particular codec, you should obtain it from a site like Fluendo that offers it for a nominal fee, See a discussion at http://fedoraproject.org/wiki/CodecBuddy.

Now, unpack the source code file, and go into the directory it creates. Then go through the usual sequence for building open-source software from source:

configure
make
make install

Note that if you want to use the GUI, the configure command should be

configure --enable-gui

After make install is done, you will probably get a message something like

 *** Download font at http://www.mplayerhq.hu/dload.html
*** for OSD/Subtitles support and extract to
/usr/local/share/mplayer/font/
*** Download skin(s) at http://www.mplayerhq.hu/dload.html
*** for GUI, and extract to /usr/local/share/mplayer/skins/

The fonts are needed for the subtitles (and for the GUI, if you use it). Just the iso1 font is needed. Download the font package, go to the indicated directory (/usr/local/share/mplayer/font/ in the above example), and then do the unpack operation. This will produce a subdirectory, e.g. font-arial-iso-8859-1.

Viewing a video:

To play a video or audio file, say x.avi, type

mplayer x.avi

If you specify several files, as a playlist, it will play them all. Hit the Enter key if you want to skip the rest of the current file and go to the next one.

To play a DVD, put the disk in the tray (see Section 5.3.2). Then type

mplayer dvd://1 -dvd-device /mnt/cdrom

where you will have to substitute a different mount point if it is not /mnt/cdrom (try running df or rummaging around in /media).

You have the following controls:

You can use mplayer, actually mencoder, which comes with the package, to do format conversion, e.g. AVI to MPG, change aspect ratio, and even do some primitive editing.

There are many, MANY, MANY different options.

You may wish to try other players, e.g. VLC.

Video Editing

Try Kino, Cinelerra, LiVES and many others.

Image Viewing, Manipulation and Drawing

I use xpdf to view PDF files, though Acroread for Linux is available. I like the fact that xpdf allows me to copy ASCII text from the file.

For collections of JPEG files and the like, I use xzgv; for viewing a single image, I use qiv.

Want something like Adobe Photoshop? The GIMP program is quite powerful, and free. It's included with most Linux distributions.

You can use GIMP to draw, but for ``quick and dirty'' tasks, I would suggest Dia, at http://www.gnome.org/projects/dia/.

Accessing Usenet Newsgroups

Linux distros generally come a text-based newsreader, either slrn or tin. I generally use slrn, but am not that happy with any known newsreader.

In the GUI arena, I sometimes use pan. You can download it from pan.rebelbase.com.

Firefox's Thunderbird program includes a newsreader too.

FTP

I usually use the text-based ftp and sftp, the latter being an SSH version for security.

If you do frequent uploads/downloads to/from a particular site and wish to automate them, another text-based program, yafc, is excellent.

A very nice GUI program, though, is gftp, which you can download from the Web if your Linux system doesn't already have it. In addition to the GUI, this program also has some functionality which ordinary FTP programs don't have.

Statistical Analysis

Use the statistical package that the professional statisticians use--R!

In my opinion from the point of view of someone with a ``foot in both camps''--I'm a computer science professor who used to be a statistics professor--the R statistical package is the best one around, whether open source or commercial.11 It is statistically modern and correct, and it also is a general-purpose programming language.

I have a tutorial on R at http://heather.cs.ucdavis.edu/~matloff/r.html.

Downloading New Software

There is a vast wealth of free software for Linux on the Web. Here's how to obtain and install it.

How to Find It

These days most downloads and installs are done automatically, say with yum or apt-get, as seen in Section 6.3.2 below. That helps you find it too. If you want to find application Z, instead of plugging ``Z'' into Google, plug ``yum install Z'' or ``apt-get install Z'' so as to narrow down the volume of response.


Automatic Download/Installation

In recent years, most Linux distros have made it very easy to download and install new software. In Fedora, for instance, one uses the yum command.

For example, to download the program yafc mentioned above, one simply types

yum install yafc

In Ubuntu, there is the apt-get command, which works similarly. For instance, to download the xpdf PDF viewer, I typed

sudo apt-get install xpdf

(Note: Ubuntu may ask you to install from your CD-ROM, but yours may be incomplete. If so, comment out the first line of /etc/apt/sources.list; this is the line telling Ubuntu to install from the CD-ROM.)

(See Section 5.4.1 for an explanation of sudo.)

With both yum and apt-get, one can direct where to download from, by making the proper entries in the file etc/apt/sources.list. For instance, for the R statistical package above, apt-get may not find it on its own, in which case we can add a line

deb http://cran.stat.ucla.edu/bin/linux/ubuntu gutsy/

to etc/apt/sources.list, telling apt-get that here is an alternative place it can look. (This is for the Gutsy edition of Ubuntu.)

By default apt-get will try to retrieve your requested program from your installation CD/DVD. You can change this by commenting-out the line in etc/apt/sources.list that begins with

deb cdrom:

Sometimes it may not be clear which package name to use with yum or apt-get. For instance, to install the GCC compiler, C library and so on, the command is

sudo apt-get install build-essential

How did I learn this? I did a Web search for ``apt-get GCC.''

To install the curses library (and include file), do

sudo apt-get install libncurses5-dev

Using RPMs

Though the methods in Section 6.3.2 have now made RPMs less important, you may find that the software you want comes in an RPM package, with a .rpm suffix in its name. To install such a package, type

rpm -i package_file_name

If you later wish to remove, i.e. uninstall a package, you can use rpm -e (`e' stands for ``erase''). You do NOT have to have the RPM file present to do this.

Some packages will have different versions for different C libraries. Red Hat uses glibc. Type

ls -l /lib/libc*

to see which version you have.

You may find that you need some library files for a program you download, and that you are missing those files. You can usually get these from the Web too. If a program complains about a missing file, try the ldd command (e.g. ldd x if the name of the program which needs the library is x); this will tell you which libraries are needed, where they were found on your system, and which ones, if any, were not found.

Dual-Boot Issues

You may wish to change some parameters of your dual-boot process, e.g. change the default OS. You can do this by editing the configuration file for your bootloader.

Most distros today use GRUB as their bootloader. Its configuration file is /boot/grub/menu.lst. By the way, note that GRUB's notation for partitions is (drive ID, partition number), so that for instance (hd0,1) means the second partition in the first hard drive.

Learning More About Linux


Wanna Get Good at Linux? Use It for Everything!

The only way to really learn Linux is to use it on a daily basis for all your computer work--e-mail, word processing, Web work, programming, etc.

As you do this, the expertise you'll want to pick up includes: file, directory and mount operations; process operations; roles of system directories (/usr, /etc, /dev, /sbin and their various subdirectories, e.g. /usr/lib; search paths; network operation and utilities such as netstat; and so on.

Don't try to do this all at once. Instead, take your time, and learn these naturally, as the need arises. As you use Linux more and more in your daily computer application work (e-mail, word processing, etc.), the needs will arise as you go along.

And remember, there's lots of help available if you need it.


Getting Help

Newsgroups

There are various Usenet newsgroups devoted to Linux, a few of which are:

comp.os.linux.setup
comp.os.linux.hardware
comp.os.linux.answers
comp.os.linux.announce (excellent for news of new programs, mostly
                     free, that run under Linux)

By the way, if you have a problem with hardware and post a query about it to a newsgroup, it is a good idea to include the output from the dmesg command. It gives a record of what occurred during bootup.

The Web

LUGs

There are Linux Users Groups (LUGs) in virtually every city. You can join if you wish, or just get to know them casually. They are great sources of help! And by the way, many of them hold monthly Linux Installfests, where you can see Linux being installed or have it installed on your own machine.

Troubleshooting

One of Linux's biggest strengths is its stability. If you are tired of getting Windows' infamous ``blue screen of death,'' then Linux is the OS for you. (It is also subject to far fewer virus and other attacks than Windows.) So emergencies are rare, but they can happen. Here are some tips for such cases.

Tools

Here are some commands you can run in a terminal window that you can use to investigate:

A Program Freezes

If an application program freezes up and you invoked it from the command line within a shell, you can in most cases kill it by hitting Ctrl-c in the terminal window from which invoked it. If this doesn't work, run the ``processes'' command by typing

ps ax

in another terminal window, and noting the process number of your program. Say for concreteness that that number is 2398. Then type

kill -9 2398

to kill the program.

If you have a program named, say, xyz, the command

pkill -9 xyz

kills all running instances of the program.

Screen Freezes

What if your entire screen freezes up? Again, this should be quite rare, but it is possible. I recommend the following remedies, in order:

Try NOT to simply poweroff the machine, as that may do damage to your files. It may not be permanent damage, as the OS will try to fix the problems when you next reboot, but don't just pull the plug unless you have no other recourse.

Inaccessible Partition

Suppose you reinstall or upgrade your Windows OS. This will probably restore the original boot procedure, rendering your Linux files inaccessible.

You can easily access the files by booting one of the live CD distros (Section 2.3 above). Do the following after booting:

$ cd /
$ mkdir mylinfiles
$ mount /dev/hda2 mylinfiles
$ cd mylinfiles
$ ls

(Of course, you may need to type a different /dev file name here; see Section 3.3.1 above.)

At this point, you will be in your Linux file system! You can then go down to your Linux home directory, via cd home or something like that.

You can then run GRUB from your live CD. Please check the Web for instructions.


If You Are Upgrading or Replacing Another Version or Distribution of Linux

(If you are installing Linux from scratch, skip this section.)

Suppose you already have Linux installed but are upgrading to a newer version of the same distribution or changing to a different distribution. First of course you will want to make sure you back up your old files, just in case sometimes goes wrong.

Note that in addition to any ``personal'' files you have, you may also have added some downloaded packages, whose files are now in places like /usr/local/. You may also have modified files in /etc, such as /etc/resolv.conf. You may wish to tar these into a save file too. (Don't copy the Linux system files, e.g in /usr/bin, though, since you want them to be replaced by their counterparts in the new version of Linux.)


Accessing Your Windows Files from Linux

At this point, most Linux distributions, except Fedora/Red Hat, give you access (at least read access) to your Windows partition from Linux. For some of them, they may do this automatically, in which case your Windows partition, say /dev/hda1 should be visible in the file /etc/fstab. If not, mount it yourself:

mkdir /dosc
mount /dev/hda1 /dosc
cd /dosc

You should now see your Windows files, and should be able to access them on at least a read basis.

For more information, including concerning write access, ss the Linux-NTFS Project, http://www.linux-ntfs.org/.

If You Wish to Remove Linux

If you wish to remove Linux from your machine, first remove LILO/GRUB as follows. Boot from your the Windows recovery CD that came with your machine. (Make sure you have the boot order set for your machine so that it tries to boot from CD or DVD before a hard drive.) When asked whether you want setup or recovery, hit R for the latter. Choose whichever disk your Windows system is on, probably C:. Change directories to WINDOWS if you are not already there, and issue the FIXMBR command. It will warn you that you will be restoring the Master Boot Record (MBR), which is what you want. Then hit EXIT to finish, and reboot without the CD.

Subsequently Windows will boot up as it did before you installed Linux.

Finally, use GParted to recover the former Linux space into your Windows partitions. Typically, this means deleting your Linux partitions (the ones that are not of type FAT32 or NTFS), and then expanding your NTFS partition. Don't forget that the next time you boot Windows, it will ask you if you want a disk check, which you should definitely answer Yes to.

About this document ...

Professor Norm Matloff's Beginner's Guide to Installing and Using Linux 1

This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.71)

Copyright © 1993, 1994, 1995, 1996, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999, Ross Moore, Mathematics Department, Macquarie University, Sydney.

The command line arguments were:
latex2html LinuxInstall.tex -split 0

The translation was initiated by Norm Matloff on 2008-09-17


Footnotes

... Linux1
The information contained here is accurate, to the author's knowledge. However, no guarantee is made in this regard.
... user,2
And as mentioned in Section 8.1, if you want to learn Linux, the only way to do it is to become a serious, every day user.
... OS.3
Most modern operating systems, including Windows and Linux, use virtual memory. This allows situations in which the total memory, i.e. RAM, needed for all of the programs we are currently running, exceeds the amount of physical memory we have. This is accomplished by temporarily placing some of the memory contents on disk, in the swap partition. Virtual memory also enables certain safety features, such as preventing one program from writing to the data of another.
... begin.4
If not, you must change the BIOS settings to make the CD-ROM bootable (and the first device checked during the boot process); see your computer's manual on how to do this.
... follows:5
This is for Ubuntu 8.04; 7.10 is very similar)
... choose.6
You may like gnome-term because it is more easily configurable, as to colors, size, etc.
...tcsh,7
Or if you want to use my shell tutorials, mentioned above.
... files.8
Recall from Section 3.3.1 that every I/O device is viewed by Linux as some /dev file.
... traveling.9
Which is in fact exactly the case as I write this paragraph.
... connection.10
Though I sometimes use VNC to access a remote image of my Linux desktop. See http://heather.cs.ucdavis.edu/~matloff/vnc.html.
... commercial.11
In some respects, it's even better than S, the commercial product it is based on.
Norm Matloff 2008-09-17