Most people are surprised to see that they have a running, usable computer after installing Linux; most distributions contain ample support for video and network cards, monitors and other external devices, so there is usually no need to install extra drivers. Also common tools such as office suites, web browsers, E-mail clients and such are included in the main distributions. Even so, an initial installation might not meet your requirements.
If you just can't find what you need, maybe it is not installed on your system. It may also be that you have the required software, but it does not do what it is supposed to do. Remember that Linux moves fast, and software improves on a daily basis. Don't waste your time troubleshooting problems that might already be resolved.
You can update your system or add packages to it at any time you want. Most software comes in packages. Extra software may be found on your installation CDs or on the Internet. The website of your Linux distribution is a good place to start looking for additional software and contains instructions about how to install it on your type of Linux, see Appendix A. Always read the documentation that comes with new software, and any installation guidelines the package might contain. All software comes with a README file, which you are very strongly advised to read.
The following sections give an overview of package managers. There is much more to this subject, even regular updates of source packages is manageable automatically; we only list the most commonly known systems. Always refer to the documentation for your specific distribution for advised procedures.
RPM, the RedHat Package Manager, is a powerful package manager that you can use to install, update and remove packages. It allows you to search for packages and keeps track of the files that come with each package. A system is built-in so that you can verify the authenticity of packages downloaded from the Internet. Advanced users can build their own packages with RPM.
An RPM package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.
Many distributions support RPM packages, among the popular ones RedHat Enterprise Linux, Mandriva (former Mandrake), Fedora Core and SuSE Linux. Apart from the advice for your distribution, you will want to read man rpm.
Most packages are simply installed with the upgrade option, -U, whether the package is already installed or not. The RPM package contains a complete version of the program, which overwrites existing versions or installs as a new package. The typical usage is as follows:
rpm -Uvh /path/to/rpm-package(s)
The -v option generates more verbose output, and -h makes rpm print a progress bar:
[root@jupiter tmp]# rpm -Uvh totem-0.99.5-1.fr.i386.rpm Preparing... ########################################### [100%] 1:totem ########################################### [100%] [root@jupiter tmp]#
New kernel packages, however, are installed with the install option -i, which does not overwrite existing version(s) of the package. That way, you will still be able to boot your system with the old kernel if the new one does not work.
You can also use rpm to check whether a package is installed on your system:
[david@jupiter ~] rpm -qa | grep vim vim-minimal-6.1-29 vim-X11-6.1-29 vim-enhanced-6.1-29 vim-common-6.1-29
Or you can find out which package contains a certain file or executable:
[david@jupiter ~] rpm -qf /etc/profile setup-2.5.25-1 [david@jupiter ~] which cat cat is /bin/cat [david@jupiter ~] rpm -qf /bin/cat coreutils-4.5.3-19
Note that you need not have access to administrative privileges in order to use rpm to query the RPM database. You only need to be root when adding, modifying or deleting packages.
Below is one last example, demonstrating how to uninstall a package using rpm:
[root@jupiter root]# rpm -e totem [root@jupiter root]#
Note that uninstalling is not that verbose by default, it is normal that you don't see much happening. When in doubt, use rpm -qa again to verify that the package has been removed.
RPM can do much more than the couple of basic functions we discussed in this introduction; the RPM HOWTO contains further references.
Update Agent, which originally only supported RedHat RPM packages, is now ported to a wider set of software, including non-RedHat repositories. This tool provides a complete system for updating the RPM packages on a RedHat or Fedora Core system. On the command line, type up2date to update your system. On the desktop, by default a small icon is activated, telling you whether or not there are updates available for your system.
Yellowdog's Updater Modified (yum) is another tool that recently became more popular. It is an interactive but automated update program for installing, updating or removing RPM packages on a system. It is the tool of choice on Fedora systems.
On SuSE Linux, everything is done with YaST, Yet another Setup Tool, which supports a wide variety of system administration tasks, among which updating RPM packages. Starting from SuSE Linux 7.1 you can also upgrade using a web interface and YOU, Yast Online Update.
Mandrake Linux and Mandriva provide so-called URPMI tools, a set of wrapper programs that make installing new software easier for the user. These tools combine with RPMDrake and MandrakeUpdate to provide everything needed for smooth install and uninstall of software packages. MandrakeOnline offers an extended range of services and can automatically notify administrators when updates are available for your particular Mandrake system. See man urpmi, among others, for more info.
Also the KDE and Gnome desktop suites have their own (graphical) versions of package managers.
This package format is the default on Debian GNU/Linux and its derivatives. The Debian package format is becoming more and more popular. At the time of this writing, 5 of the top 10 distributions use it.
There are many package managers tools for .deb packages, some who have existed for a longer time than others, with various strengths and purposes. In 'historical order', there is dselect, dpkg, the APT tools like apt-get and aptitude, and finally synaptic, a GUI tool. KDE also has a package manager, Kpackage, which manages both .rpm and .deb packages.
Checking whether a package is installed is done using the dpkg command. For instance, if you want to know which version of the Gallery software is installed on your machine:
nghtwsh@gorefest:~$ dpkg -l *gallery* Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed |/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad) ||/ Name Version Description +++-==============-==============-============================================ ii gallery 1.5-1sarge2 a web-based photo album written in php
The “ii” prefix means the package is installed. Should you see “un” as a prefix, that means that the package is known in the list that your computer keeps, but that it is not installed.
Searching which package a file belongs to is done using the -S to dpkg:
nghtwsh@gorefest:~$ dpkg -S /bin/cat coreutils: /bin/cat
More information can be found in the Info pages for dpkg.
Discovery of orphaned dependancy packages can also be found by using the deborphan command.
Debian’s APT (Advanced Package Tool) system is arguably the most effective Linux package system available. Most of the power of APT comes from the vast repository system. Almost any program you can possibly want is easy to install using one of the tools below.
apt-get is a widely-used package manager, even on non-DEB systems.
A powerful command line tool for handling .deb Debian packages is apt-get, which comes with an excellent man page describing how to install and update packages and how to upgrade single packages or your entire distribution. APT has its roots in the Debian GNU/Linux distribution, where it is the default manager for the Debian packages. APT has been ported to work with RPM packages as well. The main advantage of APT is that it is free and flexible to use. It will allow you to set up systems similar to the distribution specific (and in some cases commercial) ones listed in other sections. It also allows you to remove parts of meta-packages (packages consisting of many other packages), without removing the whole thing, or packages you wish to keep.
Generally, when first using apt-get, you will need to get an index of the available packages. This is done using the command
apt-get update
After that, you can use apt-get to upgrade your system:
apt-get upgrade
Do this often, it’s an easy way to keep your system up-to-date and thus safe.
Apart from this general usage, apt-get is also very fast for installing individual packages. This is how it works:
[david@jupiter ~] su - -c "apt-get install xsnow" Password: Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libwww-ssl0 Use 'apt-get autoremove' to remove them. The following NEW packages will be installed: xsnow 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 32.1kB of archives. After unpacking 168kB of additional disk space will be used. Get:1 http://archive.ubuntu.com edgy/multiverse xsnow 1:1.42-6ubuntu1 [32.1kB] Fetched 32.1kB in 0s (40.4kB/s) Selecting previously deselected package xsnow. (Reading database ... 148915 files and directories currently installed.) Unpacking xsnow (from .../xsnow_1%3a1.42-6ubuntu1_i386.deb) ... Setting up xsnow (1.42-6ubuntu1) ...
Note the -c option to the su command, which indicates to the root shell to only execute this command, and then return to the user’s environment. This way, you cannot forget to quit the root account.
If there are any dependencies on other packages, apt-get will download and install these supporting packages.
Note also the suggested apt-get autoremove to remove the package which is no longer required. This was a dependency needed for a package that has been removed previously.
More information can be found in the APT HOWTO.
dselect is also a standard tool for managing .deb packages. It is used to select packages that you want to find, to install, upgrade, or to just scroll to see what is available. It will also run during the installation of a Debian system and help you to define the access method to use, to list available packages and to configure packages.
One drawback of dselect is its complicated tree with obscure commands in the ncurses text interface. It can be very daunting to both new and advanced Debian users. That might be why it is not the most used package manager at this point. However, as in all software, its most salient commands or features keep it from falling in disuse. Expect to run at times into dselect commands if you deal with Debian or Debian-based distribution.
The Debian web site contains all information you need, including a “dselect Documentation for Beginners”.
aptitude is a very powerful command line tool for handling .deb Debian packages. It shares, with apt-get, the favors of a large contingent of Debian users. aptitude, like dselect, uses an ncurses text interface, but is much easier and more intuitive to use.
Among the strong points of aptitude, handling dependency problems, it keeps track of what packages are installed due to dependencies alone, and removes those packages when they are no longer needed.
You can also go to the top of the “Installed Packages” branch, and tell it to uninstall all installed packages. It will politely refuse to easily remove essential packages (by forcing you to type “Yes, I realize that this is a very bad idea” in order to proceed), but will clean your system of everything else. This is a good way to go back to the beginning without re-installing. While aptitude is a very powerful APT frontend, it is still quite daunting for a new user to use.
However, one feature to be wary of is its tendency to remove far more packages than you asked for. You can't pick and choose as easily as with other packages managers. Sometimes it's an asset and sometimes it's a liability.
A word of caution: use of both aptitude and apt-get does not always make for an easy marriage. If you choose one manager over another between these two, try to stick with it as much as possible.
synaptic attempts to meet the software installation needs of the new user. synaptic was originally released by a Debian derivative called Storm Linux which went under in 2001. It has an easy to use GTK interface and has very sensible defaults. Ubuntu, being heavily desktop-oriented, naturally centered their package management around synaptic.
One of the stronger points of synaptic is the search feature. It is easy to search and find a package, or information about it, even when you don't know its exact name. One of the drawback of synaptic is that it is a GUI manager, and at times, this proves to be a problem. In those cases, fire up apt-get or aptitude.
The largest part of Linux programs is Free/Open Source, so source packages are available for these programs. Source files are needed for compiling your own program version. Sources for a program can be downloaded from its web site, often as a compressed tarball (program-version.tar.gz or similar).
Specific requirements, dependencies and installation instructions are provided in the README file. You will probably need a C compiler, gcc. This GNU C compiler is included in most Linux systems and is ported to many other platforms.
Some distributions package managers use compressed tarballs to install packages and manage dependencies. Gentoo emerge is one example.
For RPM-based distributions, the source is often provided in the program-version.src.rpm.
Debian, and most distributions based on it, provide the adapted source which can be obtained using apt-get source.
The first thing you do after installing a new system is apply updates; this applies to all operating systems and Linux is not different.
The updates for most Linux systems can usually be found on a nearby site mirroring your distribution. Lists of sites offering this service can be found at your distribution's web site, see Appendix A.
Updates should be applied regularly, daily if possible–but every couple of weeks would be a reasonable start. You really should try to have the most recent version of your distribution, since Linux changes constantly. As we said before, new features, improvements and bug fixes are supplied at a steady rhythm, and sometimes important security problems are addressed.
The good news is that most Linux distributions provide tools so that you don't have to upgrade tens of packages daily by hand. Consult the documentation of the respective package manager tool for best results.
Most Linux installations are fine if you periodically upgrade your distribution. The upgrade procedure will install a new kernel when needed and make all necessary changes to your system. You should only compile or install a new kernel manually if you need kernel features that are not supported by the default kernel included in your Linux distribution.
Whether compiling your own optimized kernel or using a pre-compiled kernel package, install it in co-existence with the old kernel until you are sure that everything works according to plan.
Then create a dual boot system that will allow you to choose which kernel to boot by updating your boot loader configuration file grub.conf. This is a simple example:
## default num
# This sets which boots by default. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
default=0
## timeout sec
# Set a timeout, in seconds, before automatically booting the default entry.
timeout=10
splashimage=(hd0,0)/grub/splash.xpm.gz
## New kernel. Note that there is a separate boot partition at (hd0,0) or /dev/hda1.
# The root of the system is at /dev/hda8.
# If the boot directory were also on /dev/hda8, it would have:
# root (hd0,7)
# kernel /boot/vmlinuz-2.4.9-31 ro root=/dev/hda8
# initrd /boot/initrd-2.4.9-31.img
title Red Hat Linux new (2.4.9-31)
root (hd0,0)
kernel /vmlinuz-2.4.9-31 ro root=/dev/hda8
initrd /initrd-2.4.9-31.img
## Old kernel stanza left in in case new kernel fails
title old-kernel
root (hd0,0)
kernel /vmlinuz-2.4.9-21 ro root=/dev/hda8
initrd /initrd-2.4.9-21.img
After the new kernel has proven to work, you may remove the lines for the old one from the GRUB config file, although it is best to wait a couple of days just to be sure.
This is basically done in the same way as installing packages manually, except that you have to append the file system of the CD to your machine's file system to make it accessible. On most systems, this will be done automatically upon insertion of a CD in the drive because the automount daemon is started up at boot time. If your CD is not made available automatically, issue the mount command in a terminal window. Depending on your actual system configuration, a line similar to this one will usually do the trick:
mount /dev/cdrom /mnt/cdrom
On some systems, only root can mount removable media; this depends on the configuration.
For automation purposes, the CD drive usually has an entry in /etc/fstab, which lists the file systems and their mount points, that make up your file system tree. This is such a line:
[david@jupiter ~] grep cdrom /etc/fstab /dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
This indicates that the system will understand the command mount /mnt/cdrom. The noauto option means that on this system, CDs are not mounted at boot time.
You may even try to right click on the CD icon on your desktop to mount the CD if your file manager doesn't do it for you. You can check whether it worked issuing the mount command with no arguments:
[david@jupiter ~] mount | grep cdrom /dev/cdrom on /mnt/cdrom type iso9660 (ro,nosuid,nodev)
After mounting the CD, you can change directories, usually to the mount point /mnt/cdrom, where you can access the content of the CD-ROM. Use the same commands for dealing with files and directories as you would use for files on the hard disk.
In order to get the CD out of the drive after you've finished using it, the file system on the CD should be unused. Even being in one of the subdirectories of the mount point, /mnt/cdrom in our example, will be considered as “using the file system”, so you should get out of there. Do this for instance by typing cd with no arguments, which will put you back in your home directory. After that, you can either use the command
umount /mnt/cdrom
or
eject cdrom