OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

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.


image

7.5.2. Package formats


7.5.2.1. RPM packages


7.5.2.1.1. What is RPM?


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 other 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.


image

7.5.2.1.2. RPM examples


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]#

[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

[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

[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]#

[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.


image


7.5.2.2. DEB (.deb) packages


7.5.2.2.1. What are Debian packages?


This package format is the default on Debian GNU/Linux, where dselect, and, nowadays more common, aptitude, is the standard tool for managing the packages. It is used to select packages that you want to install or upgrade, but 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.


The Debian web site contains all information you need, including a "dselect Documentation for Beginners".


According to the latest news, the Debian package format is becoming more and more popular. At the time of this writing, 5 of the top-10 distributions use it. Also apt-get (see Section 7.5.3.2 is becoming extremely popular, also on non-DEB systems.


image

7.5.2.2.2. Examples with DEB tools


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

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

nghtwsh@gorefest:~$ dpkg -S /bin/cat

coreutils: /bin/cat

More information can be found in the Info pages for dpkg.


image

7.5.2.3. Source packages


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). For RPM-based distributions, the source is often provided in the program-version.src.rpm. Debian, and most distributions based on it, provide themselves the adapted source which can be obtained using apt-get source.


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.


image


Top OS Cloud Computing at OnWorks: