Package Management In Gentoo Linux


Gentoo Linux is a Linux distribution that is distributed in source format. That means the source code can be compiled locally according to the user’s requirement. Since the operating system is available in the source format it can be optimized for a specific type of computer.

Like Arch Linux, Gentoo Linux also follows a rolling release cycle to update the operating system into a new version. Portage is used in Gentoo for software distribution and package management. In this article, we are going to discuss portage, emerge flag, and its commands.

Emerge/Portage-

Portage is the official package manager and software distribution system of Gentoo Linux. Emerge is a frontend to portage or it provides the command-line interface to the portage system. It has various commands which can be used to perform operations like installation, removal, upgradations, etc. Some important commands are discussed below in this article.

Emerge/Portage Commands-

emerge --sync – It will sync your system with current Gentoo repository
emerge --search string or emerge -s string – Searches for the given string in the all available package if a package matches the given string will be displayed. This command accepts a regular expression as a string argument.
emerge --update --deep world -Check and update all the packages on the system to the latest version
emerge --searchdoc string or emerge -S string – Searches for the package name if matches with the given string will be displayed with full description in the terminal.
emerge package_name(s)– Will install the given package or packages
emerge -uD package_name(s)– Update the package or packages with their dependencies
emerge --depclean package_name(s) or emerge -c package_name(s)– This command will remove the specified package or packages.
emerge --depclean – Remove the packages that are orphaned.
emerge -evp --deep world– Will display the list of all the packages currently installed on the system

To use some other useful package management tools like equery, it is recommended to installgentoolkit. To install it use the following command-
emerge app-portage/gentoolkit
Some useful equery commands are-
equery depends package_name(s)– List all the package that depends on the mentioned package.
equery files package_name(s)– List all the file that is owned by a package
equery belongs filename– Will list all the package that owns a particular file.

ebuild –

By default package management systems like Pacman(in Arch Linux) use binary packages directly but in Gentoo Linux instead of using these binary packages or using precompiled binaries like RPM binaries, it uses a format known as the ebuild. An ebuild is a shell script that contains the description of software that how to obtain, configure, compile, and install it.

USE Flag –

The portage system offers the USE flags in Gentoo. It allows users to mention which software feature they like to include or exclude while building packages. To know which USE flags are available for a specific package, use the following command in your terminal-
equery uses package-name (To use it first install gentoolkit)
For specific use of USE flag please follow this guide Using USE flags. If still you have a query you can write in the comments below of this article.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.