Home Previous Up Next3.4. Installing pre-compiled software packages.
About
Contents
Projects
Thwab
Articles
Downloads
عربي

3.4. Installing pre-compiled software packages.

Section quotes:

  • "A well-used door needs no oil on its hinges. (...) Software rots if not used. These are great mysteries."
        -- The Tao Of Programming by Geoffrey James.

Section contents:

3.4.1. Before you start.

Most free developers release there programs in the form of source code, to install you have to be expert enough and having builing packages installed, mean while the pre-compiled packages are ready to be installed using distribution specific package manager, this manager could tell installed packages (query), remove, update and install new package, it also could handle packages relationships (package A depends on package B and conflicts with package C), most famous package manager is the RedHat Package Manager (RPM), only used RedHat, Mandrake and other RedHat based distributions, RedHat released under terms of GNU GPL, any one is allowed to create a distribution based on this manager, most distributions has this tool or at least a tool to convert from this format to it's own format. Debian has it's own powerful 'deb' packages and Slackware uses usual tarballs ('tgz' compressed archives). Package manager saves you troubles and save your time, all you have to do is to get a small ready package (they are compressed) and ask the manager to install it, it will make sure you have it's requirments (dependency) and you don't have an package that conflict with it, then install it and do basic configurations, imagine that Debian package manager could upgrade a package while it's working without closing it, and even more it could upgrade the whole distribution without reboot! Package managers does not denying you from installing software your own way, for example from source tarballs or binary archives.

 Warning

Any change happened at any of the following folders: '/bin', '/sbin', '/usr', '/lib or '/var' and all subfolders except '/val/local' and '/usr/local' will confuse the package manager, you should install your own binaries on '/usr/local'.

Before you look for a software on the internet, search on your distributions CDs, you could search by hand or using distributions specific tools for example with Mandrake you could use RPM drake: 'Mandrake Control Center -> Packages -> add'
then type something and click search, and with RedHat use 'Main Menu -> Settings -> Packages' or run 'redhat-config-packages' which is a less flexible tool than RPM drake, it lackes searching.

redhat-config-packages
Exercises
Try to install (eg. Mandrake conttrol center) to install: WINE and some games like 'rocksndiamons', 'frozenbubbles', 'marbels' and 'lbreakout2', then use run to execute them for example type 'wine sol'

 Tip

To install an RPM file on Mandrake it's enough to (double) click it, then you will be asked for root password, this file should be packed for Mandrake you get packages from links found on '2.2. After Installation.' section.

 Warning

Installing packages needs root user privileges, if you try to install them (from console) as regular user it will fail, but sometimes it won't say so and a display bogus message like "could't read so and so" or "could't write so and so".

Packages packed for some distribution may and may not work on another, it may not work because of 'dependency problem', for example if package A needs (we say depends) on version X of library B, but the other distribution have an older version of B so it does not satisfy A dependency requirments, you could solve this by upgrading the B library from the other distribution, for example if you have a package for RedHat 8.0 but you are using 7.2, you try to install it and it asks for glibc 3.2 but you have 2.9, you could upgrade this library then install your package, but you may end with upgrading too many packages.

Some packages are compiled for specific CPU and others are generic (like source code,wordlists,themes and documentations), for CPU specific packages we found CPU name written at the end of the filename just before last period, for example:

kernel-2.4.21.i586.rpm
kernel-2.4.20.athlon.rpm
gcc-3.2.ppc.rpm
mplayer-0.9.i386.rpm
winex-20032203.src.rpm
xmms-skins-1.8.noarch.rpm
generic packages ends with 'noarch' or 'src' and in Debian they ends with 'all'. For CPU specific packages it could be for 'i386' which means any Intel Architecture 32-bit (called IA32) including Pentium, while 'i586' works on Pentium I or better, theoretically 'i586' packages will work faster than 'i386' because it uses optimized Pentium specific machine instructions, 'i686' needs at least Pentium II or better and it's faster than both prevoius, 'athlon' (or 'k7' in Debian) is optimized for AMD CPUs like 'Athlon' and 'Duron' those CPUs could be used as 'i386' or 'i586' but with optimized packages you will get unbtble performance. To tell your CPU type use:
bash# arch
bash# cat /proc/cpuinfo

Instead of having all packages optimized for your CPU, sometimes it's enough to have optimized kernel and 'glibc'. Binary device drivers depends not only on your kernel version but also for what CPU the kernel optimized. Issue the following commands and notice the output:

bash# rpm -q /boot/vmlinuz # only for RPM, discussed later
bash# uname -a
bash# uname -r

3.4.2. RPM packages.

First read the manual page of the 'rpm' tool (with 'man rpm'), 'rpm' tool could do many things like: query for informations about a file or package, installing a package, remove an installed package.

Query for a package or a file

All queries is done using 'q' options, to query for information about an installed package use 'i' option like 'rpm -qi gpm' which display information about 'gpm' package, to query about a package file that need not be installed, use 'p' option in the form:
bash# rpm -qi -p PACKAGE-VER.ARCH.rpm
where 'PACKAGE-VER.ARCH.rpm' is the file name of the package, if you want to query about files list on a package use 'l' option for example 'rpm -ql mysql', have you ever wondered where are the documentation for a specific package ? simply query for 'd' option, like 'rpm -qd mysql'. Where are the 'apache' configuration files ? use 'c' option for example 'rpm -qc apache2', in RedHat they call it 'httpd' so use 'rpm -qc httpd'. To know which package some file or program come from use:
bash# rpm -q -f /PATH/TO/THE/FILE
bash# rpm -q -f $(which COMMAND)
notice how we have used 'which' to tell the full filename of the command.
Do you think that you have removed an important file ? or force installing a package without satisfying it's requirments, how could you verify your entire package system ? try :
bash# rpm -Va

Installing or upgrading packages

First be root, if you are in a harry here is the method:

bash# rpm -Uvh PACKAGE-VER.ARCH.rpm
you will see hash '#' as progress indicator, this options check for previous old version and upgrade if found, and do new installation elsewhere. If you want 'rpm' to do new installation (exit without any action if previos version found) using :
bash# rpm -ivh PACKAGE-VER.ARCH.rpm
to build a source package use:
bash# rpm --rebuild PACKAGE-VER.src.rpm
you could optimize it for Athlon (you will notice much speed) using : rpm --rebuild --target=athlon PACKAGE-VER.src.rpm to optimize it for Intel Pentium II (you will not notice much difference) use rpm --rebuild --target=i686 PACKAGE-VER.src.rpm

Removing packages

Be a root then use 'e' option, like:
bash# rpm -e PACKAGE-VER

To remember options notice what they mean: U (Up-Grade),i (install),v (verbos),h (hash[#]),e (erase)

Practical session.

bash$ rpm --help
# gives you help about it
bash$ man rpm
# Shows the manual pages of rpm
bash$ rpm -qi -p /mnt/cdrom/RedHat/RPMS/ggv*.rpm
# Gives some info about ggv
bash$ rpm -qf /boot/vmlinuz
kernel-2.4.18.i586
bash$ rpm -qf `which sol`
gnome-games
bash$ su root
password:********
bash# rpm -Uvh /mnt/cdrom/Mandrake/RPMS2/*xmms*.rpm
lib-xmms:   ########################################
xmms:       ########################################
xmms-smpg:  ########################################
xmms-skins: ########################################
bash# exit
bash$
for example, let's assume that you have MPlayer package files at your home folder, and you want to install them, type:
# to know where we are
bash$ pwd
/home/ahmad
# list the files
bash$ ls mplayer*.rpm
mplayer-common-1.0pre2-1.i386.rpm	mplayer-1.0pre2-1.i386.rpm
mplayer-gui-1.0pre2-1.i386.rpm	mplayer-skin-default-1.0-2.noarch.rpm
# be the root user
bash$ su
password:
bash# rpm -Uvh mplayer*.rpm
mplayer-common:		########################################
mplayer:		########################################
mplayer-gui:		########################################
mplayer-skin-default:	########################################
# back to be regular user
bash# exit
bash$ 
if you try to install them one by one you will fail, because they depend on eah other, that why we put 'mplayer*.rpm' which is substituted by the four files.

Another example if you are using RedHat or Fedora which lacks the support for MP3 and you have downloaded it's plugin 'xmms-mp3' from let's say 'http://dag.wieers.com/packages/xmms-mp3' then just install it as usual with 'rpm -ivh xmms-mp3*.rpm' then run 'xmms' and enable the 'libmpeg123' plugin.

Before I know 'apt' or 'yum' I was using this nice trick, I used to create a file listing of all 'rpm' files on each CD and give it the name of the CD using:

# Put the first CD
bash$ mount /mnt/cdrom # or just wait until RedHat autorun mount it
bash$ ls /mnt/cdrom/Fedora/RPMS > ~/fc2.cd1.txt
bash$ eject
# put the second CD
bash$ mount /mnt/cdrom
bash$ ls /mnt/cdrom/Fedora/RPMS > ~/fc2.cd2.txt
# and so on
now if I want to know on which CD I could found MYPKG, I use:
bash$ grep 'MYPKG' ~/fc2.cd*.txt

3.4.3. Debian packages.

Debian 'deb' packages are manipulated using 'dpkg' command line tool, (now 'dpkg' is just backend tool there are smarter, more simple tools), those package files named something on the form 'PACKAGE_VER-REV_ARCH.deb' where PACKAGE is the package name,VER is the upstream version, REV is Debian specific revision numbers, ARCH is the architecture the it should work on like 'i386' and 'all'. to install a package use '--install' or '-i' option followed by name, in other words
'dpkg -i PACKAGE_VER-REV_ARCH.deb', and to remove it use '--remove' or '-r' followed by package name (without the version) in the form:
'dpkg -r PACKAGE', this will remove the package but it keeps it related user files (configurations, so when you install it again you won't start from zero), to remove it completely use the option '--purge', those two could not remove necessary packages like kernel-image (BTW. this how Debian calls the kernel binary itself) add '--force-remove-essential option to '--remove' or '--purge option.

When you install a package it will be configured, using 'debconf' (which could be interactive if it could not guess) if you just want the files to be copied use '--unpack' option instead. Then you could use '--configure' followed by package name you want configure, you could use 'dpkg-reconfigure' tool followed by package name, or just use 'dpkg -a' to configure all unconfigured packages. 'dpkg -C' will search for partially installed packages and fix them.

To search for the name and small description of an installed package using usual shell wildcards ('*' and '?'), use 'dpkg -l' followed by the pattern between strong quote

bash# dpkg -l '*xfree86*'
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  xfree86-common 4.3.0-0ds3v1   X Window System (XFree86) infrastructure
ii  xserver-xfree8 4.3.0-0ds3v1   the XFree86 X server
this has the same effect if you use 'dpkg-query' with the same arguments. to get detials about an installed package (by it's name you found with '-l') you could use '-p' option with 'dpkg' or 'dpkg-query' followed by package name 'dpkg -p PACKAGE' or 'dpkg-query -p PACKAGE', those details is called for some why control fields(or control file), to display it for a package file (that need not be installed) use '-f' option in the form 'dpkg -f PACKAGE_VER-REV_ARCH.deb',
bash # dpkg -f fbset_2.1-14_i386.deb
Package: fbset
Version: 2.1-14
Section: base
Priority: optional
Architecture: i386
Depends: libc6 (>= 2.3.2.ds1-4), debconf (>= 0.5) | debconf-2.0, makedev (>= 2.3.1-24) | devfsd
Installed-Size: 264
Maintainer: Guillem Jover 
Description: framebuffer device maintenance program
 Program to modify settings for the framebuffer devices (/dev/fb[0-9]*
 or /dev/fb/[0-9]*) on Linux, like depth, virtual resolution, timing
 parameters etc.
 .
 This program is useful for all Linux/m68k kernel versions, and
 for late 2.1 kernels and above on most other architectures.
'-I' option (queries related to files can't be done with 'dpkg-query') provide this information and more for a package file
bash # dpkg -I fbset_2.1-14_i386.deb
 new debian package, version 2.0.
 size 82012 bytes: control archive= 3061 bytes.
      14 bytes,     1 lines      conffiles            
     305 bytes,    19 lines   *  config               #!/bin/sh
     583 bytes,    15 lines      control              
    2249 bytes,    31 lines      md5sums              
     326 bytes,    25 lines   *  postinst             #!/bin/sh
     206 bytes,     8 lines   *  postrm               #!/bin/sh
    2177 bytes,    37 lines      templates            
 Package: fbset
 Version: 2.1-14
 Section: base
... the rest of the output is omitted ...
To list files provided by a package use '-L' option with 'dpkg' or 'dpkg-query' in the form 'dpkg -L PACKAGE', to do that with a package file use something like 'dpkg -c PACKAGE_VER-REV_ARCH.deb', to do the opposite finding what package a file belongs to using wildcards PATTERN for file name in the form "dpkg -S 'PATTERN'".

You could use 'tasksel' (or 'gnome-tasksel' for GUI) to add or remove software packages not by name but by task, it list some tasks like "web server", then you could select tasks to install or remove, issue the command 'tasksel -s' to install recommended system packages.

One of Debian best features is virtual packages, those are just common names for other packages, for example a virtual package like 'editor' it could be 'vim' or 'emacs' (depending on your taste that you tell Debian), if a package needs text editor one will be install, for example in other systems if a package needs a web browser the packager will put his favorite as dependency, mean while with Debian they specify a virtual package called www-browser which install your favorite browser, another example is a virtual package 'vi' which could be VIM, 'nvi' or 'elvis'. To list alternatives for 'editor' virtual package use 'update-alternatives --display editor', to set which one do you like to be your editor use 'update-alternatives --config editor'.

Debian has a package called 'debsums' which verify installed packages using 'md5sum'.

3.4.4. Slackware 'tgz' packages.

The most simple package format (they did not bother making a complicated design), for sure what do you expect if the name is Slackware. Any package is just a tarball (compressed TAR archive with 'gzip') having a special folder having information and installation shell script, this is not so bad 'GNU tar' and 'GNU gzip' are very powerful tools, and tested for long time. To install those Slackware 'tgz' packages use 'installpkg' and to remove it use 'removepkg', also 'removepkg' could be used to get an installed package in the form of 'tgz' Slackware package.

3.4.5. Next generation tools.

It's simple to install a package if all dependencies are satified, you have correct version of each dependency installed, this is ideal it's difficult to track all those dependencies by hand, GNU/Linux policy is "DO NOT reinvent the wheel" packages depends on functions of other packages, for example a package for drawing needs HTML browser to display help, instead of reinventing the brower it depends on a free standard browser. You will fail to install a package dependening on a file that is not yet installed, package manager will complain about that, where on Earh could you get this file, what package provide this file ?

What if you want to upgrade many package or the entire system, how could you do that ? New generation of package manager appeared to solve the problem of dependency, those tools are just front end to old tools.

3.4.6. 'apt' Package Tool.

Debian has the first smart package system, it's called 'apt' short for 'Advanced Package Tool', or more humle 'A Package Tool', it replaces the 'dselect', both are front ends to 'dpkg', 'apt' is not ported to 'rpm', you could use it with RedHat Linux. 'apt' tools searchs automatically for packages to satisfy dependencies, it search current directory, official CDs and maybe networks (LAN, official and user added internet mirrors), the official 'apt' site is 'www.apt-get.org' to get the source code, but if you are using Debian then 'apt' is installed by default, while if you are using RedHat Linux and Fefora you could get it from RPM repositories, it's an RPM package called 'apt' see '2.2. After Installation.' section for those sites, for example get it from http://apt.freshrpms.net or http://dag.wieers.com. The command line interface is 'apt-get', also there are user interfaces like the menu driven console application 'aptitude' (see '1.5. How to install Linux ?' section, in specific 1.5.6 subsection), and we have graphical interfaces like 'synaptic' and 'gnome-apt'. those are found on separated packages.

Use 'apt-setup' at least once to set package sources (where to get packages) for example to add first 13 CDs and nearest official Internet Debian repository, you could do this by hand editing the file '/etc/apt/sources.list' to have some line like this

deb http://www.somewhere.net	stable main contrib non-free
then you update your 'apt' database with
bash# apt-get update

To install a package, just tell 'apt-get' it's name in the form: 'apt-get install PACKAGE', for example to install 'epiphany-browser' type:

bash# apt-get install epiphany-browser
it will search 'apt' database to know the best way to get it and it's missing dependency (if any) then it will ask you to put the CD (or it will download it from the internet), all you have to do is to say yes and rest. If you want to get the package without installing it, replace 'install' with 'download'. You could use 'disk-upgrade' to upgrade the whole distribution while it's running, type:
bash# apt-get update
bash# apt-get dist-upgrade
files download from the Internet (or LAN) are saved '/var/cache/apt/archives' you could use 'clean' to remove them:
bash# apt-get clean

The 'apt-cache' tool could help you to find a package for example:

bash# apt-cache search foo
replace 'foo' with what ever you like.

Another smart Debian tools is called 'debfoster' it will search for packages (specially libraries) that are not needed any more, for example if you install package 'A' which needs 'B', 'B' will be also installed, now if you remove 'A' and it's the only package that needs ''b, then 'B' is no more used. By running 'debfoster' it will detect them and ask you if you want to remove them.

3.4.7. 'urpmi' for Mandrake.

Mandrake has it's own smart tool, just like apt-get but using 'rpm' back end, it's the command line interface for RPM Drake, see it's official site at 'www.urpmi.org'. To install a package (and it's dependencies) use 'urpmi mypackage' to remove a package (what depends on it) use 'urpme mypackage' to update packages database use 'urpmi.update -a', to update (eg. security updates) the whole distribution use 'urpmi --update --auto-select', to upgrade use 'urpmi --auto-select ' to display files on a package file use 'urpmf mypackage.rpm' (also you could use usual RPM queries), to tell to which package some file belongs to use 'urpmf myfile' and to packages that nothing depends on use 'urpmi_rpm-find-leaves'

Thanks to Alla'a Abdulfatah a Linux-egypt member for this 'urpmi' information.

 Warning

If you are using your local language (eg. Arabic) and you are using a terminal that does not supporting it (eg. does not support bidirectional languages) you could use somethting like 'LC_ALL=C urpmi mypackage.rpm' to see messages in English.

3.4.8. 'yum' for RedHat.

Since RadHat Linux 8.0 (maybe before) and also with Fedora, RedHat offers their 'up2date' and 'yum' tools to access RedHat Network to get updates (there is a red button applet flashes when you click you see the GUI inteface to it), this is a payed service, but there are some free sites (not supported by RedHat) that could use the same tools.

Those tools make it easy to get and install packages through the Internet, it also solve dependencies just like 'apt'. First you have to add RPM repositories to the file '/etc/sysconfig/rhn/sources' like rpm.livna.org and freshrpms.net, using the format :

yum fedora-us-stable-fc2 http://download.fedora.us/fedora/fedora/2/i386/yum/stable
yum fedora-us-testing-fc2 http://download.fedora.us/fedora/fedora/2/i386/yum/testing
yum livna-stable-fc2 http://rpm.livna.org/fedora/2/i386/yum/stable
yum flash-plugin http://macromedia.mplug.org/apt/fedora/2
yum dag http://apt.sw.be/redhat/fc2/en/i386/dag
and to the file '/etc/yum.conf' like the following format:
    [livna-stable]
name=Livna.org Fedora Compatible Packages (stable)
baseurl= http://rpm.livna.org/fedora/2/i386/yum/stable
gpgcheck=1
    [livna-testing]
name=Livna.org Fedora Compatible Packages (testing)
baseurl=http://rpm.livna.org/fedora/2/i386/yum/testing
gpgcheck=1
    [livna-unstable]
name=Livna.org Fedora Compatible Packages (unstable)
baseurl=http://rpm.livna.org/fedora/2/i386/yum/unstable
gpgcheck=1
    [flash-plugin]
name=Macromedia flash-plugin site
baseurl=http://macromedia.mplug.org/apt/fedora/2
    [dag]
name=Fedora Core 2 Dag Wieers' repository
baseurl=http://apt.sw.be/redhat/fc2/en/i386/dag
for example to use 'up2date' to download and install add missing (because RH policy) multimedia software just pass names as arguments:
bash# up2date flash-plugin xmms-mp3 xine totem mozilla-j2re mozilla-acroread
this will install 'flash-plugin', MP3 plugin for 'xmms' (then you should run 'xmms' and enable this plugin), 'xine', 'totem' media players, Sun microsystems JAVA 'j2re', and Adobe acrobat reader with one command. Another example to install 'audacity' sound studio issue:
bash# up2date audacity
you could also use 'yum' to install 'lame' package:
bash# yum install lame
refere to Fedora-Multimedia-HOWTO by Eric Steven Raymond found at 'www.tldp.org'.

3.4.9. 'slack-get' for Slackware.

The Slackware reply on 'apt-get' is 'slack-get'.

ToC
Copyrights & Copylefts
What is Linux?
How to install Linux?
Halloween Documents

ArabEyes
Wikipedia
OpenSource
GNU
FSF's FSD
OSI's OSD
Linux.org
Linux.com
LinuxToday
SlashDot
FreshMeat
LWN.net

About Islam
What is Islam ?
We love Jesus; honored and not crucified.
Do you love Jesus or Paul ?
Who is Muhammad [PBUH] ?
Articles
Your scanner works on Linux
Linux cleaning Windows Viruses
Report
Unwanted Advertisements
Bugs and misspellings
Dead links:

 

Best viewed with free web browsers

You may get more high quality software from here for free
proud to be 100% Microsoft FREE GNU FDL


Generously Hosted by www.JadMadi.net

Previous Up 3.4. Installing pre-compiled software packages. Next
Copyright © 2007, Muayyad Saleh AlSadi