URPMI Package Management tool for Mageia System

URPMI is Mageia’s command line tool for managing packages and repositories (media). It’s powerful command-line tool which is used to automatically download and install new software packages, upgrade existing software packages, update the package list index, and to upgrade the entire Mageia system. urpmi handles dependencies automatically (checks and resolves dependencies). Some other package manger utilities which are being used widely in Linux are yum, dnf, apt-get, dpkg, rpm, Zypper, pacman, urpmi, pkg, apt, etc.,

Now, i’m going to play on our Mageia 5 box to explain and cover mostly used Urpmi commands with examples.

1) Common syntax/file location for URPMI

See below for common syntax/file location of URPMI command.

[General syntax for apt]
urpmi [options] [pkg1] [pkg2] ...

[most popular URPMI commands]
[urpmi urpme urpmf urpmq urpmi.update urpmi.addmedia urpmi.removemedia]

[contains information about all urpmi Sources, Name and Path]
/etc/urpmi/urpmi.cfg

[URPMI cached file location]
/var/cache/urpmi/rpms

2) Install a Package or packages

Use the below command to install any package or packages on your system. In this case i’m going to install nano, gedit. Every time urpmi ask your confirmation to install the corresponding package. if you want to avoid the confirmation you can do by this adding --force option with urpmi.

[Install a single package]
$ sudo urpmi nano
$MIRRORLIST: media/core/release/nano-2.3.6-3.mga5.x86_64.rpm
installing nano-2.3.6-3.mga5.x86_64.rpm from /var/cache/urpmi/rpms             
warning: Generating 4 missing index(es), please wait...
Preparing...                     #############################################
      1/1: nano                  #############################################

[Install more than one packages]
$ sudo urpmi nano gedit
$MIRRORLIST: media/core/release/nano-2.3.6-3.mga5.x86_64.rpm
    $MIRRORLIST: media/core/release/gedit-3.14.3-1.mga5.x86_64.rpm             
installing gedit-3.14.3-1.mga5.x86_64.rpm nano-2.3.6-3.mga5.x86_64.rpm from /var/cache/urpmi/rpms
Preparing...                     #############################################
      1/2: nano                  #############################################
      2/2: gedit                 #############################################

[Install a package without confirmation]
$ sudo urpmi --force nano
    $MIRRORLIST: media/core/release/nano-2.3.6-3.mga5.x86_64.rpm
installing nano-2.3.6-3.mga5.x86_64.rpm from /var/cache/urpmi/rpms             
Preparing...                     #############################################
      1/1: nano                  #############################################

3) Remove a Package or packages

Use the below command to remove/erase any package or packages on your system. In this case I’m going to remove nano, gedit.

[Remove a single package]
$ sudo urpme nano
removing nano-2.3.6-3.mga5.x86_64
removing package nano-2.3.6-3.mga5.x86_64
      1/1: removing nano-2.3.6-3.mga5.x86_64
                                 #############################################

[Remove more than one packages]
$ sudo urpme nano gedit
removing gedit-3.14.3-1.mga5.x86_64 nano-2.3.6-3.mga5.x86_64
removing package nano-2.3.6-3.mga5.x86_64
      1/2: removing nano-2.3.6-3.mga5.x86_64
                                 #############################################
removing package gedit-3.14.3-1.mga5.x86_64
      2/2: removing gedit-3.14.3-1.mga5.x86_64
                                 #############################################

4) update a Package or packages

Use the below command to update any package or packages on your system. In this case I’m going to update nano, gedit to latest version.

[update single package]
$ sudo urpmi nano
Package nano-2.3.6-3.mga5.x86_64 is already installed

[update more than one packages]
$ sudo urpmi nano gedit
Packages gedit-3.14.3-1.mga5.x86_64, nano-2.3.6-3.mga5.x86_64 are already installed

5) Search a package

If you don’t know the exact package name which you want to install, Use the search option it will return the matching string. In this case I’m going to search nano. We can search when we knowing only a part of an rpm name.

[Search a package]
$ urpmq nano
nano

[Find package knowing only a part of an rpm name]
$ urpmq --fuzzy chrome
perl-Physics-Psychrometry
x11-driver-video-openchrome

[Find package knowing only a part of an name (from rpm & description)]
$ urpmf --summary chrome
x11-driver-video-openchrome:X.org driver for Unichrome cards from the OpenChrome project
perl-Physics-Psychrometry:Perl extension for calculating Psychrometric
mono-icon-theme:Monochrome Theme for KDE4
x11-driver-video-openchrome:X.org driver for Unichrome cards from the OpenChrome project
perl-Physics-Psychrometry:Perl extension for calculating Psychrometric
mono-icon-theme:Monochrome Theme for KDE4

[search on the summary of the packages]
$ urpmf --summary email -a client
claws-mail:The user-friendly, lightweight and fast GTK2 based email client
roundcubemail:Round Cube Webmail is a browser-based multilingual IMAP client
thunderbird:Full-featured email, RSS, and newsgroup client

[Search a package, ignore case-sensitivity (-Y) and display a summary of the package]
$ urpmq -Y --summary nano
nano : Tiny console text editor that aims to emulate Pico ( 2.3.6-3.mga5 )

6) Check package information

If you want to know the package detailed information before proceeding with the installation. Use the below command, it will give full information about the package like package version, size, repo name, etc..

[print package info]
$ urpmq -i nano
    $MIRRORLIST: media/core/release/media_info/20150615-211931-info.xml.lzma
Name        : nano                                                                                                                                   
Version     : 2.3.6
Release     : 3.mga5
Group       : Editors
Size        : 1834127                      Architecture: x86_64
Source RPM  : nano-2.3.6-3.mga5.src.rpm
URL         : http://www.nano-editor.org/
Summary     : Tiny console text editor that aims to emulate Pico
Description :
nano (Nano's ANOther editor) is the editor formerly known as
TIP (TIP Isn't Pico). It aims to emulate Pico as closely as
possible while also offering a few enhancements.

7) Update Repository Index

Use the below command to Update/Refresh Repository Index file which was mentioned under /etc/apt/sources.list or /etc/apt/preferences.

[Update Repository Index]
$ urpmi.update -a
medium "Live Core" is up-to-date
medium "Live Nonfree" is up-to-date
medium "Core Release" is up-to-date
medium "Core Updates" is up-to-date
medium "Nonfree Release" is up-to-date
medium "Nonfree Updates" is up-to-date
medium "Core 32bit Release" is up-to-date
medium "Core 32bit Updates" is up-to-date
medium "Nonfree 32bit Release" is up-to-date
medium "Nonfree 32bit Updates" is up-to-date

[Update Particular Repository Index]
$ urpmi.update "Core Release"
medium "Core Release" is up-to-date

8) Update Your System

Use the below command to Upgrade entire system packages to latest version.

[update entire system packages to latest version]
$ sudo urpmi --update --auto-select
or
$ sudo urpmi --auto-update

[Alternate command to update entire system packages to latest version]
$ MageiaUpdate

9) Clean local repository packages

This command removes .rpm files for packages that are no longer installed on your system, removing these files from /var/cache/urpmi/rpms may regain a significant amount of disk space.

[Clean local repository packages]
$ sudo urpmi --clean

10) Download a Package Without Installing

If you want to download any packages without installation, you can do it by adding --no-install option with apt-get command. After operation, you’ll find them in /var/cache/urpmi/rpms.

[Download a Package Without Installing]
$ sudo urpmi --no-install apache

$ ls -lh /var/cache/urpmi/rpms
total 1.3M
-rw-r--r-- 1 root root 998K Jul 20 02:22 apache-2.4.10-16.3.mga5.x86_64.rpm
-rw-r--r-- 1 root root 8.9K Jul 20 02:22 webserver-base-2.0-8.mga5.x86_64.rpm

11) Check package Dependencies

Check All Dependencies for particular Package.

[Check package Dependencies]
$ urpmq --requires-recursive nano
bash
bash-completion
dash-static
filesystem
glibc
info-install
lib64ffi6
lib64glib2.0_0
lib64lzma5
lib64magic1
lib64ncurses5
lib64ncursesw5
lib64pcre1
lib64zlib1
libgcc1
libstdc++6
nano
ncurses
pkgconfig
run-parts
setup
xz

12) List Installed Packages

Print the list of packages are installed on your system.

[List installed Packages]
$ rpm -qa | more
pinentry-0.8.3-4.mga5
lib64champlain0.12_0-0.12.9-3.mga5
lib64theoradec1-1.1.1-10.mga5
sound-juicer-3.14.0-2.mga5
glib2.0-common-2.42.1-2.mga5
libreoffice-langpack-hi-4.4.2.2-4.mga5
lib64tcl8.5-8.5.15-1.mga5
ibus-ui-gtk3-1.5.8-6.mga5

13) List installed package Location

List files location belongs to particular package.

[List installed Package file location]
$ urpmf nano
php-manual-en:/usr/share/doc/php-manual-en/function.time-nanosleep.html
man-pages-es:/usr/share/man/es/man2/nanosleep.2.xz
nano:/etc/nanorc
nano:/usr/bin/nano
nano:/usr/bin/rnano
nano:/usr/share/doc/nano
nano:/usr/share/doc/nano/AUTHORS
nano:/usr/share/doc/nano/ChangeLog
nano:/usr/share/doc/nano/NEWS
nano:/usr/share/doc/nano/README
nano:/usr/share/doc/nano/THANKS
nano:/usr/share/doc/nano/TODO
nano:/usr/share/doc/nano/UPGRADE

14) How to add Media

Adding Media (Mirror Servers) online sources to system which will retrieve/get all packages from mirror server while upgrading the system. Here i’m going to add Mageia 5 URL.

[Add a new repository/medium to the local system]
$ sudo urpmi.addmedia [Name] [url]

[Add a new repository/medium to the local system]
$ sudo urpmi.addmedia --distrib --mirrorlist 'http://mirrors.mageia.org/api/mageia.5.x86_64.list'

15) How to Remove Media

Remove a repository/medium from the local system.

[Remove a repository/medium from the local system]
$ sudo urpmi.removemedia [Name]

[Remove a particular repository/medium from the local system]
$ sudo urpmi.removemedia "Core Release"

[Remove all repository/medium from the local system]
$ sudo urpmi.removemedia -a

16) Update Mirror list

To add/refresh latest mirror list, just fire the below command.

[Update Mirror list]
$ sudo urpmi.addmedia --distrib ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/Mageia/distrib/cauldron/x86_64

17) Check active Media

To check list of media active on your Mageia system, use the below command to print it.

[Check active Media]
$ urpmq --list-media active
Live Core
Live Nonfree
Core Release
Core Updates
Nonfree Release
Nonfree Updates
Core 32bit Release
Core 32bit Updates
Nonfree 32bit Release
Nonfree 32bit Updates

18) Print Media with URL

To check list of media with URL, use the below command.

[Print Media with URL]
$ urpmq --list-url
Live Core /var/local/mga_rpms/core
Live Nonfree /var/local/mga_rpms/nonfree
Core Release http://mirrors.tuna.tsinghua.edu.cn/mageia/distrib/5/x86_64/media/core/release
Core Updates http://mirrors.tuna.tsinghua.edu.cn/mageia/distrib/5/x86_64/media/core/updates
Nonfree Release http://mirrors.tuna.tsinghua.edu.cn/mageia/distrib/5/x86_64/media/nonfree/release
Nonfree Updates http://mirrors.tuna.tsinghua.edu.cn/mageia/distrib/5/x86_64/media/nonfree/updates
Core 32bit Release http://mirrors.tuna.tsinghua.edu.cn/mageia/distrib/5/i586/media/core/release
Core 32bit Updates http://mirrors.tuna.tsinghua.edu.cn/mageia/distrib/5/i586/media/core/updates
Nonfree 32bit Release http://mirrors.tuna.tsinghua.edu.cn/mageia/distrib/5/i586/media/nonfree/release
Nonfree 32bit Updates http://mirrors.tuna.tsinghua.edu.cn/mageia/distrib/5/i586/media/nonfree/updates

19) Check package online source

We can see the rpm online source location, using below command. This only display the package URL and won’t download.

[Print Media with URL]
$ urpmq --sources nano
http://mirrors.tuna.tsinghua.edu.cn/mageia/distrib/5/x86_64/media/core/release/nano-2.3.6-3.mga5.x86_64.rpm

20) Reinstall a Package

Download and (possibly) reinstall a currently installed package.

[Reinstall Package]
$ sudo urpmi --replacepkgs nano
$MIRRORLIST: media/core/release/nano-2.3.6-3.mga5.x86_64.rpm
installing nano-2.3.6-3.mga5.x86_64.rpm from /var/cache/urpmi/rpms             
Preparing...                     #############################################
      1/1: nano                  #############################################

21) Rebuild your database

If the database becomes inconsistent which lead rpm to tell you that a “package is already installed” when it is actually not. Use the below command to rebuild the rpm database.

[Rebuild your database]
$ sudo rpm --rebuilddb

22) RPM package verification

Below command used to check broken system packages against the rpm database.

[RPM package verification]
$ sudo rpm -Va
S.5....T.  c /etc/info-dir
..?......  c /etc/bluetooth/pin
S.5....T.    /lib/modules/3.19.8-desktop-3.mga5/modules.alias
S.5....T.    /lib/modules/3.19.8-desktop-3.mga5/modules.alias.bin
.......T.    /lib/modules/3.19.8-desktop-3.mga5/modules.builtin.bin
S.5....T.    /lib/modules/3.19.8-desktop-3.mga5/modules.dep
S.5....T.    /lib/modules/3.19.8-desktop-3.mga5/modules.dep.bin
.......T.    /lib/modules/3.19.8-desktop-3.mga5/modules.devname
.......T.    /lib/modules/3.19.8-desktop-3.mga5/modules.softdep
S.5....T.    /lib/modules/3.19.8-desktop-3.mga5/modules.symbols
S.5....T.    /lib/modules/3.19.8-desktop-3.mga5/modules.symbols.bin

23) RPM sources

If you want to install packages from RPM source, make sure you have to download the SRPMS rpm file

[Download RPM Sources]
$ sudo urpmi.addmedia core_src ftp://ftp.mirrror.com/mirror/mageia/distrib/5/SRPMS/core/release

[Install package from RPM Sources]
$ sudo urpmi --install-src packagename

24) How to get help from urpmi

If you want to know more about URPMI additional options, try below commands.

[man page of urpmi
$ man urpmi]

[urpmi help, page]
$ urpmi --help

Enjoy…)

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...