Tools/urpmi
From Mandriva
One of the most important Mandriva specific tools is, without a doubt, urpmi, which allows for better and easier package management in your Mandriva Linux box. If you master the use of urpmi , you will never again suffer the dependancy hell that many inexperienced users complain about. For instance, urpmi sylpheed will install the Sylpheed mail client, and all the required libraries.
Other places to learn more about urpmi
Urpmi is an important tool for all Mandriva Linux users. It pays to take the time to learn to use it. This page gives you an overview of the most often used options. Below are other resources with more detailed information about urpmi:
- http://www.urpmi.org/ : The home of good urpmi documentation in French and English.
- man pages: check the man pages for all the options. Those are the most uptodate sources of information (Remember: they can also be opened in many browsers, just enter: man:urpmi in the addressfield).
- Uprading Mandriva Linux with urpmi discusses upgrading Mandriva Linux from one major version to another using urpmi
Besides a very basic introduction, this page tries to cover what is not already covered in the two above sources of information. We assume that you know how to use a man page and that you have read the above page. Once you have done so, come back to this page: there is more information about not so obvious problems you may run into.
Using urpmi
Quicklist of common tasks
Command | What it tells you |
---|---|
urpmq -i xxx.rpm | info on the package xxx.rpm in the current directory |
urpmq -il xxx.rpm | info on the package xxx.rpm in the current directory & list of files that it installs |
urpmq --changelog xxx.rpm | print changelog of the package in the current directory |
urpmq -R xxx.rpm | which package(s) require(s) the xxx.rpm in the current directory |
urpmf /path/to/file | which package has installed "file*" in /path/to |
urpmi --fuzzy --test xxx | shows all rpms that match string "xxx". |
rpm -q --whatprovides /path/to/file | similar to urpmf, but works with both hdlist.cz & synthesis.hdlist.cz |
urpmi.update updates | updates the local data about available packages in the medium "updates" |
urpmc | updates the local data about available packages in all media |
Command | What it does |
urpme xxx | removes the package xxx (and those that depend on it) |
urpmi --keep xxx.rpm | installs package xxx.rpm from the current directory and it's dependencies, but if anything has to be removed it will not |
urpmi --update --auto-select | installs available updates from your enabled media |
urpmi --keep --auto --auto-select | update all packages from your enabled media, but don't remove anything: just tell if anything didn't work |
urpmi --test --keep --auto --auto-select | update all packages from your enabled media but don't install or remove anything, just tell if it will work |
urpmi --auto-select | automatically select upgradeable packages |
urpmi.addmedia
This is where the whole thing starts. You add a software repository (a.k.a. medium, mirror) using the urpmi.addmedia command.
One can start at Mandriva Club mirror finder, at the Purchase and download site, or you can get a list of software sources from the Easy Urpmi page. The format for adding a new repository is as follows:
urpmi.addmedia nameofmedia ftp://ftp.site.com/path/to/Mandriva/RPMS with ../base/hdlist.cz
but effectively you are working behind the scenes juggling the same as if you are using edit-urpm-sources.pl which is the GUI in Mandriva Linux Control Center under Software Management --> Select from where software packages are downloaded when updating the system
The Mandriva Linux ftp mirrors for final release versions contain at least:
- main which contains most important programs, supported by Mandriva
- contrib which contains some more optional programs added by contributors, but which do not necessarily get (security) updates
- update which is used for correcting for example security problems. Everyone should have this source configured, even with a very slow internet connection. When adding an update source add the --update switch so urpmi can distinguish it from a regular source.
To be able to install packages from a mirror, urpmi needs one of two files containing in compressed format either: the most essential or the most complete set of data.
You can use synthesis.hdlist.cz to save bandwidth or hdlist.cz to have access to all data contained in the package headers. For instance, urpmf or rpmdrake cannot find names of files inside non-installed packages if you are using synthesis.hdlist.cz.
Please see Policies/Mirror_Structure and Policies/SoftwareMedia for a complete overview of the mirror structure which can be found on most mirrors.
Recovering lost sources (cds)
If you find you do not have all your cdroms/dvds listed as media you can:
urpmi.addmedia --distrib cdrom removable://mnt/cdrom
with cd1 in your drive. This assumes that you have a version of Mandriva older than 2007.1, where /mnt became /media and that the cd or dvd is in the drive known as "cdrom".
Copying CD's to a home directory and using those as source
If you don't like juggling CD's when updating your system and you have room to spare, make a directory (for example: /home/uid/CDS/), copy the base/ and Mandriva/ directories recursively from the first install-CD there. Then copy the RPMS2 to RPMS8 directories from all the CDs/DVD into the Mandriva/ directory. After removing or disabling the install CD's as sources do as root:
urpmi.addmedia --distrib HD file://home/uid/CDS
As from Mandriva Linux 10.1 the directory structure on the CDs has changed. The directories which you need to copy recursively are:
CD1:/media/main CD2:/media/main2 CD3:/Applications /Drivers /media/commercial /media/dkms /media/drivers /main3 CD4:/kde3.3 /media/main4 CD5:/media/main5 CD6:/Applications /media/main6
when done:
cd /home/uid/CDS genhdlist
Then use the media manager via Mandriva Linux Control Center --> Software Management --> Select from where software packages are downloaded when updating the system to set up your new directory as a source and disable all the cd entries.
Another method is copying the ISO images to different mount points, which will also work on earlier versions, see section Copy CDs to Hard Drive and mounting each in loopback
Copying rpms (including install CDs) to single directory and using it as a source
Make a directory, for example ~/RPMS , to hold all the rpms
To copy a bunch of rpms (from the install cds, for example) :
find /INSTALL_CDS/ -name *.rpm -print -exec cp {} ~/RPMS \;
If you have copied the install CDs to the hard drive, or have their ISO images on the drive (see Copy CDs to Hard Drive on how to mount them), this can be done in one step.
In this example, the CDs were mounted as /INSTALL_CDS/CD1, /INSTALL_CDS/CD2, etc.
cd ~/RPMS genhdlist
It will then create a hdlist.cz file and a sythesis.hdlist.cz file based on what it finds in the directory it is in.
Find the pubkeys for the rpms and copy them into ~/RPMS/pubkey. They should be in INSTALL_CDS/CD1/media/media_info :
mkdir ~/RPMS/pubkey cp /INSTALL_CDS/CD1/media/media_info/pubkey* ~/RPMS/pubkey/
then as root add the source:
urpmi.addmedia local_rpms file://home/uid/RPMS/ with hdlist.cz
Please see note on discussion tab of this page
Adding all urpmi sources from a mirror
urpmi can add all the sources (e.g. main, updates, contrib ...)from a chosen mirror with a single command. As root type in a console:
urpmi.addmedia --distrib "mirror_name"- ftp://"mirror_site"/pub/MandrivaLinux/official/version/"arch"
in which:
- "mirror_name" will obviously be the name by which the mirror is known
- "mirror_site" is the actual URL of the ftp server
- "version" is the current or other version of your Mandriva Linux for which you want to the add the media
- "arch" is one of :i586 or x86_64, or possibly others that do not exist for all Mandriva versions (for example sparc, pcc, etc.)
urpmi.update
The urpmi.update command updates the list of packages from a package repository. This list changes whenever the packages in the server change, so you need to update it whenever you want to install a new package from a changeable repository, like Mandriva Cooker (Be very careful with Cooker packages; they might work but installing them usually does cause problems further down the road on a stable version!). If you are using a repository for a final release, it normally does not change, so you do not need to update the list whenever you install. It works like this:
urpmi.update nameofmedia
or
urpmi.update -a
The -a argument means "all media".
urpmi.removemedia
If you want to get rid of a repository, this is the command to use:
urpmi.removemedia nameofmedia
urpmf
urpmf is the best of the "unknown" parts of the urpmi package management system. With it you can find any file that you may want, know what package it belongs to, see a description of the package and a bunch of other things.
Suppose that you want to compile an image viewer on your box. You decompress the tarball, and then run ./configure. Now, the configure script complains about jpeglib.h missing. (*NOTE: IMHO the configure script usually says "jpeg library missing", so this example is not so relevant) All that you have to do is:
urpmf jpeglib.h
That will output, for example:
libjpeg62-devel:/usr/include/jpeglib.h mozilla-devel:/usr/include/mozilla-1.4a/jpeg/jpeglib.h
This means that the jpeglib header file is part of the package libjpeg62-devel, and can now be installed with:
urpmi libjpeg62-devel
Another example: you might want to install a mail client, but you don't know any mail client for Linux. So you want to perform a search on the summary of the packages, for terms 'mail' and 'client'. The command
urpmf --summary 'mail' -a client returns:
evolution:Integrated GNOME mail client, calendar and address book. squirrelmail:Squirrelmail is a webmail client for PHP4. sylpheed-claws:Enhanced version of the Sylpheed e-mail client comsat:A mail checker client and comsat mail checking server. cscmail:CSCMail is a GTK email client written in Perl sylpheed:A GTK+ based, lightweight, and fast e-mail client tradeclient:Email Client with PIM features for X
The --summary option is used to perform a search on the summary, and the -a switch translates 'and'.
urpmi
This is the main package management command, which you use to install the package you want as well as the packages that it depends on:
urpmi nameofpackage
For instance, if you think that Sylpheed is a good e-mail client because it describes itself as 'lightweight', you install it with: urpmi sylpheed.
Caveat: doing urpmi nameofpackage usually but not necessarily results in the latest version of that package being installed. Urpmi will compare the version number of the installed package with that in the enabled media. The exception is that when an upgrade of a package is made available under a slightly different name while both the old and the new version remain available in the enabled media. It is sometimes necessary to do so for reasons of backward compatibility.
Here is a notable example urpmi autoconf will not result in the latest version being installed, for the highest version of that package name is autoconf2.5-2.60.
You should use the command urpmi autoconf2.5 instead, which will give you the latest 2.5*. Note thate on your Mandriva system, both versions should be installed: Mandriva will automatically choose the one that is most appropriate. See /usr/share/doc/autoconf-2.13/IMPORTANT.README.MDK for more information on this particular example.
See several remarks about urpmq --fuzzy below to learn how to avoid such versioning problems.
Another example of using urpmi is to update your system with the latest security updates/bugfixes.
urpmi.update updates && urpmi --update --auto-select
This example assumes you have an urpmi source called 'updates' which was declared to be an 'update source' when it was added. Because the contents of update sources change frequently, it is necessary to perform urpmi.update to check for new packages. The && characters mean "if the first command succeeds, then perform the second command". In the second command the --update switch means "only search in repositories declared as update sources", and the --auto-select switch means "select available updates of packages already installed". Urpmi will list the upgradeable packages and ask if you wish to proceed.
If add also the --auto switch, all upgradeable packages will be upgraded including all required dependencies. If you prefer using a graphical userinterface ('GUI') use rpmdrake in the Mandriva Linux Control Center: Software Management --> Look at available updates and apply any fixes or upgrades to installed packages
Installing a new kernel
Kernels are never upgraded, they are only ever installed. So you will never see your kernel upgraded when you run Mandriva Update. To install a new kernel from the command line :-
# urpmi.update updates /get the list of available updates from your updates source/ # urpmq --fuzzy kernel /list the available packages containing the word "kernel", / or: # urpmi -y kernel /"-y" is short for "--fuzzy" / The following packages contain kernel: <snip> .... kernel-2.4.22.10mdk kernel-2.4.22.26mdk kernel-2.6-source kernel-2.6.0-0.test5.1mdk kernel-BOOT-2.4.22.10mdk kernel-enterprise-2.4.22.10mdk kernel-enterprise-2.4.22.26mdk kernel-i686-up-4GB-2.4.22.10mdk kernel-i686-up-4GB-2.4.22.26mdk kernel-multimedia-2.4.22.21mm.1mdk kernel-multimedia-2.4.22.26mm.1mdk kernel-multimedia-smp-2.4.22.21mm.1mdk kernel-multimedia-smp-2.4.22.26mm.1mdk kernel-multimedia-source kernel-secure-2.4.22.10mdk kernel-secure-2.4.22.26mdk kernel-smp-2.4.22.10mdk kernel-smp-2.4.22.26mdk kernel-smp-2.6.0-0.test5.1mdk kernel-source <snip> .... #urpmi kernel-2.4.22.26mdk /pick the kernel you want to install/
The new files needed to boot will install in /boot alongside those of older kernel(s). The grub or lilo configuration will be automatically adjusted by adding a new stanza to allow you to boot the old and the kernels. The default 'linux' stanza will boot the new kernel. If you wish you can use the Mandriva Software Install GUI rpmdrake to install a new kernel: Mandriva Linux Control Center --> Software Management --> Look at installable software and install software packages,but you must run the Mandriva Update GUI first to force an update of the available media: MLCC --> Select from where packages are downloaded when updating the system --> Update or from the previously mentioned window in rpmdrake: File --> Update media
You will notice that one of the packages available is kernel-source This is the source code of the most recent kernel available in the update source (in this example 2.4.22.26mdk) You only need to install the kernel source package if you need to compile anything like a device driver (but it can also be handy to search the documentation included in the package). Be sure that you have installed the same version of kernel-source as the kernel you are running, or else the drivers you compile will not work.
urpmi --parallel pushes updates to machines in your network
This chapter applies only to Mandriva Linux Corporate Server
Updates are downloaded to one of the machines and from there pushed to the others on your network (see: http://archives.mandrivalinux.com/expert/2006-03/msg00001.php )
urpmi --parallel will update all machines you specify. See man urpmi for more and man urpmi.files, as well as: http://www.happyassassin.net/2005/05/04/a-quick-guide-to-urpmi-parallel .
urpmi parallel mode does what it sounds like: you run an urpmi command and it happens on many machines in parallel. In more detail - the machine you run the command on tests its result on each machine in the group in turn, downloads all necessary packages for all machines in the group, distributes the appropriate packages to each machine, then calls urpmi on the machine to do the actual installation. It's brilliant for quickly installing software on all your machines, or even keeping them all up to date with a couple of commands, and it saves on bandwidth, as each necessary package is downloaded only once. The only drawback at the moment is that you cannot include the server machine in the group, which makes it a little less good for small home networks.
So how to use it? It's pretty simple, really. First, make sure you can ssh from the server to each client machine as root (you have to enter a passphrase or password, but can be you set up to use keys and make use of ssh-add to avoid that). Now install urpmi-parallel-ssh on the server machine. Edit /etc/urpmi/parallel.cfg to look like this:
local:ssh:toy:htpc
the first parameter is the name of the group, make this whatever you like. Leave the second as ssh. The remaining parameters are the hostnames of the machines in the group; as many as you like (but not the server machine: urpmi will just fall over its own lock files).
Next you can use it. On the server machine, run:
urpmi --parallel local somepackage
As long as urpmi on the server has access to all packages required by all client machines from its urpmi media, everything should now work smoothly. The easiest way to ensure this is to have all machines - server and client - use the same urpmi media.
Furthermore, you can keep a group of machines up-to-date. For example on a home network, which includes zen (the server), toy and htpc, run this series of commands on zen to keep all the machines up to date with Cooker:
fanout "localhost toy htpc" "urpmi.update -a"
fanout runs a single command on several machines at once; it it uses ssh.
urpmi -auto-select -keep -noclean -v
noclean keeps the packages on zen after they have been installed; this means when one does the parallel command at the next stage, it doesn't go out and download them all again.
urpmi --parallel local -auto-select -keep -v
...and done. Once Rafael fixes urpmi so the server can be in the parallel group, it'll be even simpler.
Also read http://forum.mandrivaclub.com/viewtopic.php?p=207623 . If you can afford Mandriva Online Pro, you can do it with a Web Interface Mandriva Online - Professional Level. The professional level of Mandrivaonline enables you to update an entire computer network through a centralized and automated service. Thanks to a new web interface, scheduling updates or creating computer groups is intuitive!
Mandriva Online Pro ( 30 euros per computer per year) seems only available for Corporate Desktop (99 euros) or Corporate Club (minimum 2000 euros).
The closest you could get without paying anything is to set up urpmi --parallel and set up a cronjob on the master machine to run urpmi --parallel --auto-select --auto every day...
Some other ways to get updates to all your machines: http://archives.mandrivalinux.com/expert/2006-03/msg00020.php
References
urpme
This is the command that uninstalls software from your box. As with urpmi, it works out the dependancies and tells you if any software that's still installed depends on what you want to uninstall, giving you the chance to abort the procedure or to uninstall the package and those that depend on it. Usage is:
urpme nameofpackage
For instance, Sylpheed is so good that you want to get rid of Evolution, your former e-mail client. You can make some place on your hard drive with urpme evolution.
urpmq
urpmq allows you to query the rpm database, so you can find out information about the packages that you have installed or that you can install as well as other things in the database, like what media sources you have configured, like this:
[root@isis root]# urpmq --list-media contrib MandrivaClub club.comm_i586_9.0 cooker plf
Caveat: when using urpmq to look for packages, make sure you understand the difference between using it with or without the option --fuzzy. You might miss some packages you were looking for if you are not careful. If urpmq finds a package with the exact name than the one you queried, it will return this package only and by default, you will not see other packages which include the same name.
For example:
// Imagine your best pal told you about vegastrike, a cool 3D game. [root@localhost augustin]# urpmq vegastrike vegastrike // Great! There is a Mandriva package with this exact name! // But you don't see other packages which include this name! // We query again: notice the missing 'e' at the end of the package name. [root@localhost augustin]# urpmq vegastrik The following packages contain vegastrik: vegastrike vegastrike-data vegastrike-data-music // This time the query result is very different: // We see not one but three packages. // Compare the following query to the previous two. [root@localhost augustin]# urpmq --fuzzy vegastrike The following packages contain vegastrike: vegastrike vegastrike-data vegastrike-data-music // See the difference that the --fuzzy option makes.
urpmq --fuzzy is also great to see what other available version there may be to a package: sometimes a new major version does not provide full backward compatibiliy. For this reason the newer version will be distributed under a slightly different package name. Now, you are sure not to miss anything.
For example:
[root@localhost augustin]# urpmi mplayer // This will NOT install the latest version of mplayer. [root@localhost augustin]# urpmq --fuzzy mplayer The following packages contain mplayer: kmplayer mplayer mplayer-fonts mplayer-gui mplayer-skins mplayer1.0 mplayer1.0-gui mplayerplugin transcode xmms-mplayer // You see: the new 1.0 release is packaged separately. // You have been warned!!
Using Graphical interfaces
gurpmi
gurpmi is the graphical front-end for urpmi and can be used on the commandline to install/search a package from a medium or at the prompt. It is also used by rpmdrake to display messages that need user interaction.
rpmdrake
Mandriva offers a set of nice graphical tools to perform the same tasks. See Rpmdrake.
smart
Originally from Conectiva, packages smart, smart-update and smart-gui are python based tools still available from contrib. They are very fast, quite reliable and have some different nice aspects than the original Mandriva tools, but are not officially supported by Mandriva. Home is here: Smart Home . Now it is made available for many distributions offering "better package management".
A question of security
What are the security issues
Urpmi must be run as root in order to install the packages. A clever but malicious person could possibly trick a not so clever Mandriva user (I know that all the Mandriva users are clever, but let's assume that there is one gullible Mandriva user somewhere, just for the sake of the argument) to install a package that looks like a regular package used by many but that contains a Trojan Horse, some evil code. Once installed, the application may unleash some virus, worm or even some spyware... So far, there hasn't been any news of any such exploit having been attempted, but in a few years time, when GNU/Linux will be the most widely used OS, it is possible that some people would want to try to perform such a feat. Fortunately, they will fail, because a sane concern for security has always been part of the GNU/Linux community. Most packages are signed by the packagers to prove the authenticity. Please see: GnuPG for more details.
Besides a malicious person trying to trick you into installing their malware, what is more likely to happen is that you try to install some package that got corrupted, either during ftp transfer, or because of a scratch on your installation cd... Before installing, urpmi will check the integrity of the package using the MD5 Hash code and the included gpg package key. See relevant section below for details.
Sometimes, when using urpmi, people end up having rows of:
rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format
It is unclear what the origin of the problem is: maybe the file has become corrupted during an upgrade or when an urpmi process was killed by an impatient user.
The solution is to remove the file rpmdb: /var/lib/rpm/Pubkeys and import the public keys again. See: GnuPG
MD5 Hash
The MD5 hash is a code within the rpm package that lets rpm checks whether the package hash is okay or not. If for any reason the file is corrupted, rpm (and urpmi) will refuse to install it; ((prog|rpmdrake}} will prompt the user whether or not it may proceed.
Here is a recent example:
[root@localhost augustin]# urpmi kdesdk rpmdb: /var/lib/rpm/Pubkeys: unexpected file type or format error: cannot open Pubkeys index using db3 - Invalid argument (22) The following packages have bad signatures: /var/cache/urpmi/rpms/kdesdk-3.1.3-9mdk.i586.rpm: Invalid signature ((SHA1) DSA sha1 MD5 GPG GPG#70771ff3 NOT OK) Do you want to continue installation ? (y/N) y installing /var/cache/urpmi/rpms/kdesdk-3.1.3-9mdk.i586.rpm error: /var/cache/urpmi/rpms/kdesdk-3.1.3-9mdk.i586.rpm: MD5 digest: BAD Expected(97f2ba5a91888cd3af40f89be6b65868) != (393221db35071aa90eaa73816a9a5ba8) unable to install package /var/cache/urpmi/rpms/kdesdk-3.1.3-9mdk.i586.rpm
Notice the two lines Invalid signature ((SHA1) DSA sha1 MD5 GPG GPG#70771ff3 NOT OK) and MD5 digest: BAD Expected(97f2ba5a91888cd3af40f89be6b65868) != (393221db35071aa90eaa73816a9a5ba8). The file kdesdk-3.1.3-9mdk.i586.rpm is corrupted and will not be installed.
The solution is to remove the file from /var/cache/urpmi/rpms/ and download it again. Try again to install it with urpmi or rpm --import <filename>
If it still does not work, it means that your mirror has a corrupted file. Try downloading it manually from two or three other mirrors and save it in the /var/cache/urpmi/rpms/ folder. Always manually remove the previously downloaded file before attempting to use another mirror. Then install it again with urpmi.
It happens that the same corrupted file is mirrored in every ftp server. If you've tried several servers and you always run into the same problem, check in a Mandriva user forum or mailing list whether other users have the same problem with the same file. If this is the case, probably a new file will be released soon.
Troubleshooting
RPM database locked
View of one editor:
As superuser, enter:
killall urpmi urpmi.update urpme rpm urpmi.addmedia rm -f /var/lib/urpmi/.LOCK /var/lib/rpm/RPMLOCK
If that doesn't unlock the database, rebooting is always the solution.
Another editor's view:
This 'killall...' improves the chance of corrupting your RPM database, because you do not allow the process(es) to finish their work on it. Try to be patient, if you decide it really is hanging, make sure that you reboot the elegant way and don't reset the box, that improves the chance of corruption even more. (BTW 'su' is 'substitute user').
Rebuild your database
If the database becomes inconsistent (an inconsistency can lead rpm to tell you that a "package is already installed" when it is actually not, and vice-versa).
rm -rf /var/lib/rpm/__db*
rpm --rebuilddb
- * It is a good idea to regularly back up your /var/lib/rpm directory. Then you can always revert to a previously good database and reinstall the packages that came later with:
rpm -ivh --justdb --noscripts --notriggers
The "medium contrib uses an invalid list" error
rm /var/lib/urpmi/list.contrib
This will stop the error from happening without interfering with package installation.
RPM package verification
A really useful tool for checking a broken system is to verify the packages against the rpm database.
rpm -Va
This will tell you which packages have changed since you installed them (i.e. it lists all the ways in which your system is inconsistent with the rpm database) For example, if you have a power failure during boot, some files may become corrupt. (Or just if you have done something daft). Knowing this, you can fix your system to be as good as new by re-installing the packages concerned. (This can even be done on an un-bootable system, if you use a rescue CD to boot and fix it.)
To check a single package use rpm -V packagename (name is enough, version numbers etc. can be left out).
To verify one or more package's proper md5sum, hash and gpg signature:
rpm -K foo.123.rpm, or rpm -K foo*
Early bird slow
If msec is verifying your system it uses the rpm database, but that is done at nice 19, and usually very early in the morning. On a slow box this can take a long time. If ps -e shows msec, rpmv, grep and sort , you can speed up rpmdrake / urpmi by renicing rpmw, grep and sort to 0.
Upgrade to the latest Mandriva version using urpmi
Urpmi can also be used to upgrade your box to a newer version of Mandriva Linux: add the mirror's URL with the directory of the new versions packages to your urpmi configuration: Mandriva Linux Control Center --> Software Management --> Select from where software packages are downloaded when updating the system
(More) cool tricks using urpmi
Install from url or localfile
urpmi can be used to install local rpm's , and then resolve dependencies. For example, you just recompiled or created foo-1.0-1bar.rpm . You can easily use urpmi foo-1.0-1bar.rpm . It even works with http or ftp url (and even with ssh, provided that rsync is installed on both sides). If enabled bash_completion will work very well on such commands.
Getting a list of dependencies before installing
By using urpmq you can find out a lot of information about an rpm.
- urpmq -d gets a list of all rpm's that are needed to install one piece of software.
- urpmq -d bash see which rpm's are required.
- add the -m switch to see the ones not installed on the system at the moment.
- --sources will get the sources.
So, with urpmq -d -m --sources , you can easily get a list of url's that correspond to the rpm you need to get: quite handy if you lack a good connection to the internet.
Getting information about an rpm
urpmq -i can give you information about the rpm's you can install. Try urpmq -i bash . It only works with full hdlists, not with synthesis.
Installing non-rpm-packaged software
Where possible, you should use urpmi to install software, using packages from the correct urpmi sources for your current version of Mandriva Linux. Nearly everything you could want is available, if you have sources defined for contrib and plf: this is a way to avoid a great deal of pain! However, sometimes you may want to install a different package, or a more recent one than is available from the Mandriva sources.
The golden rule is, never bypass the rpm package database, if you can possibly help it, and never install a package forcibly. If you follow this rule, however annoying it may seem, you are guaranteed to never have a system in an inconsistent state. If rpm/urpmi won't let you install something, there's usually a good reason!
Compiling from source
Instead of the familiar trilogy of:
./configure make make install
use checkinstall instead:
./configure make checkinstall
You will then get an rpm that can be installed using urpmi, and can also be uninstalled when you want to. If the tarball already includes a good spec file, it is even easier:
rpmbuild -tb ballname.tar.gz
Installing binaries such as acrobat reader, or sun's java
These programs should end up in the /usr/local/ directory. This directory is intended for non-official packages. However, you may wish to add some symlinks if they are not in your $PATH. E.g. /usr/bin/java -> /usr/java/j2re1.4.2_04/bin/java
The Nvidia driver
The nvidia binary driver, if you use it, has its own horrid installer, which breaks all the above rules. The result works fine, but the process is not pleasant!
Rebuilding RPMS
If you have an rpm built for a system other than your own, it is possible to rebuild it.
Please refer to the Cooker Howto on rpm packaging for much more detailled information.
Copy CDs to Hard Drive and mounting each in loopback
If you don't like switching CD's when updating your system and you've got some room to spare, you can save the ISO images of the CDs to your hard drive and then tell urpmi to use those instead of the real CDs.
To start, make a directory for the ISO images of the CDs:
mkdir ~/iso
Then copy each of the CDs in:
dd if=/dev/cdrom of=~/iso/cd1 dd if=/dev/cdrom of=~/iso/cd2 dd if=/dev/cdrom of=~/iso/cd3 ...
Now as root make mount points for each of them:
mkdir /mnt/cd1 mkdir /mnt/cd2 mkdir /mnt/cd3 ...
and mount them in loopback:
mount -t iso9660 -o loop /home/uid/iso/cd1 /mnt/cd1 mount -t iso9660 -o loop /home/uid/iso/cd2 /mnt/cd2 mount -t iso9660 -o loop /home/uid/iso/cd3 /mnt/cd3 ...
Now edit the /etc/urpmi/urpmi.cfg file changing each entry as follows:
From (for example):
Installation\ CD\ 1\ (cdrom1) removable://mnt/cdrom/media/main { hdlist: hdlist.Installation CD 1 (cdrom1).cz key-ids: 70771ff3 removable: /dev/hdc with_hdlist: ../../media/media_info/hdlist1.cz }
to this:
Installation\ CD\ 1\ (cdrom1) file://mnt/cd1/media/main { hdlist: hdlist.Installation CD 1 (cdrom1).cz key-ids: 70771ff3 with_hdlist: ../../media/media_info/hdlist1.cz }
In other words, change the 'removable://mnt/cdrom' to 'file://mnt/cd1' for each of cd1, cd2, cd3, etc. Also, remove the line that reads:
removable: /dev/hdc
Note: As of 2007.1 /mnt for removables should be replaced by /media
References
Web forms to help you to set up your urpmi configuration :
- easyurpmi
- MandrivaUser.de's smart-urpmi
- MandrivaClub's MirrorFinder
Tutorials and documentation in French
- Introduction à urpmi (Guillaume Rousse)
- Installation et Configuration (Zébulon)
- Introduction à urpmi et rpmdrake (Linux-wizard)
Tutorials and documentation in English
- Installing and configuring software on Mandriva Linux (Zébulon)
- urpm - RPM Mandriva Style (Mandrakeuser)
- urpmi mini HOWTO (James Robinson)
- URPMI and RPM Tutorial (Walter Chang)
Tutorials and documentation in Spanish
- James Robinson's urpmi mini HOWTO, translated by Toni Hermoso
RSS feeds describing latest available development packages
Categories: HouseKeeping | Tool | Urpmi