How to use the command 'urpmi' (with examples)

How to use the command 'urpmi' (with examples)

The urpmi command is a powerful package management tool used in Mageia, a popular Linux distribution derived from Mandriva. It allows users to install, update, and manage software packages. With a wide range of options and complementary commands (urpm.update, urpme, urpmi.addmedia, among others), urpmi offers a comprehensive suite of tools to maintain a Mageia system efficiently.

Install a package from the repository or from a local RPM file:

Code:

sudo urpmi package|path/to/file.rpm

Motivation:

This command is crucial when you need to install new software on your Mageia system. Whether the package is available in the official Mageia repositories or you’ve downloaded an RPM file locally, urpmi handles the installation process smoothly, resolving any dependencies automatically.

Explanation:

  • sudo: This is used to execute commands with superuser privileges, necessary for installing system-wide software.
  • urpmi: The core command for installing packages in Mageia.
  • package: Specifies the name of the package you want to install from the repository.
  • path/to/file.rpm: Provides a path to a local RPM file when the package is not in the repositories.

Example Output:

installing package version x.y.z
Installed successfully

Download a package without installing it:

Code:

urpmi --no-install package

Motivation:

Sometimes, you might want to download a package but not install it immediately, either due to testing purposes, limited internet access later, or simply because you need the RPM file for distribution to other systems.

Explanation:

  • urpmi: Initiates the package processing command.
  • --no-install: Tells urpmi to download the package files without installing them.
  • package: The name of the package to be downloaded from the repository.

Example Output:

package-x.y.z.rpm downloaded successfully

Update all installed packages:

Code:

sudo urpmi --auto-select

Motivation:

Keeping your system up-to-date is a critical aspect of system maintenance, ensuring you receive the latest security patches and software improvements. This command performs an update of all installed packages on your system.

Explanation:

  • sudo: Provides necessary permissions to modify system files.
  • urpmi: The command responsible for handling package updates.
  • --auto-select: Automatically selects all updates for the installed packages.

Example Output:

100 packages updated, 0 added, 0 removed.

Update a package on one or more machines on the network:

Code:

sudo urpmi --parallel local package

Motivation:

For system administrators managing multiple Mageia machines, updating packages across a network is an efficient way to maintain consistency and security. This command allows simultaneous updating without having to log into each machine separately.

Explanation:

  • sudo: Grants necessary permissions for package updates.
  • urpmi: Engages the package management tool.
  • --parallel local: Specifies that the update should occur on various machines as defined in /etc/urpmi/parallel.cfg.
  • package: The specific package to update on the networked machines.

Example Output:

Updating package on local machine...
Updating package on remote machine 192.168.0.10...
Package update completed successfully on all machines.

Mark all orphaned packages as manually installed:

Code:

sudo urpmi $(urpmq --auto-orphans -f)

Motivation:

Orphaned packages are those that were installed as dependencies but are no longer required by any installed package. By marking them as manually installed, you ensure that these packages are not removed automatically during a system cleanup, thereby preventing potential loss of functionality.

Explanation:

  • sudo: Provides administrative access.
  • urpmi: Engages the command for package handling.
  • $(urpmq --auto-orphans -f): This sub-command lists orphaned packages. urpmq is a query package tool specific to Mageia, with --auto-orphans finding packages not required anymore and -f marking them to prevent auto-deletion.

Example Output:

Marked 5 orphaned packages as manually installed

Conclusion:

The urpmi command offers considerable flexibility and automation for managing software packages on Mageia Linux systems. From installing and updating packages to managing network-wide installations and controlling orphaned packages, urpmi provides versatile solutions to streamline system administration. Understanding and utilizing the examples provided will empower you to maintain your Mageia systems efficiently and effectively.

Related Posts

How to Use the Command 'pixiecore' (with examples)

How to Use the Command 'pixiecore' (with examples)

Pixiecore is a versatile tool designed to manage the network booting process of machines, particularly in environments where PXE (Preboot Execution Environment) is used.

Read More
Efficient Package Building with `pkgctl build` (with examples)

Efficient Package Building with `pkgctl build` (with examples)

The pkgctl build command is a powerful tool designed for package maintainers and developers to build software packages inside a clean chroot environment.

Read More
How to Use the Command 'cargo remove' (with examples)

How to Use the Command 'cargo remove' (with examples)

The cargo remove command is part of Cargo, the package manager for Rust.

Read More