Finding Packages

~ # emerge -s nmap
~ # emerge -s wine

Installing Packages

~ # emerge --ask --verbose pciutils
~ # emerge -av gentoo-source
~ # emerge -av net-analyzer/nmap app-arch/lzop

Removing Packages

~ # emerge -Cv app-emulation/wine

This reference is not meant to be complete or authoritative, it's a crash course. Only daily necessary skills with Portage will be discussed, the See Also section has links to more information. The reader is expected to know GNU/Linux at an administrative level.

The emerge utility of portage provides the methods to install, upgrade and remove packages. Other utilities such as eclean and equery are use for maintenance or information purposes.

Updating the Tree

Based on settings in /etc/make.conf the system will fetch the latest copy of the Portage tree from the designated host. After this update, emerge is used to check for updates, install those updates and to possibily remove old cruft from the system.

Some example settings from /etc/make.conf


Then ask for an update (as root)

root@host # emerge --sync

Time of execution varies based on delta between the local tree and what is latest, more changes equal more time.

Installing Packages

Portage provides very simple tools to install packages and the dependent packages with little or no headache. Simply search ( -s or --search) for the package you want/need then install, such as htop, then pretend to emerge the package to see what additional packages will be installed. Running this with the verbose flag will show the USE flags, very helpful.

root@host # emerge -s htop
[ Results for search key : htop ]
[ Applications found : 1 ]

*  sys-process/htop
      Latest version available: 0.8.3
      Latest version installed: [ Not Installed ]
      Size of files: 418 kB
      Description:   interactive process viewer
      License:       GPL-2

Check what other things may be necessary for this package (-pv is --pretend --verbose)

root@host # emerge -pv htop

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] sys-process/htop-0.8.3  USE="-debug" 419 kB

Total: 1 package (1 new), Size of downloads: 419 kB

Then finally install

root@host # emerge htop

Upgrading Packages or World

There are two types of upgrades, partial and full, or regular and deep. The partial or regular will only update packages that have a direct update. Using the deep option will update the package and it's dependencies.

# Regular: view update then do it update
root@myhost # emerge -puv world
root@myhost # emerge -uv world

# Deep: view update then do it update
root@myhost # emerge -puvD world
root@myhost # emerge -uvD world

If the system USE flags are changed then a check should be made to determine which packages need to be rebuilt.

root@myhost # emerge -puvDN world

Checking Installed Packages

The utility equery provides information about the packages, use flags and other good stuffs. There are short options available, long options used for descriptive purposes. Say equery with no options to view short options and other commands.

root@myhost # equery which glibc
root@myhost # equery uses glibc
root@myhost # equery size glibc
root@myhost # equery depgraph glibc
root@myhost # equery depends glibc

Cleaning the System

Portage can remove packages too, it will also suggest a list of packages that aren't needed that may be removed at the administrators discretion.

# What might be albe to be removed?
root@myhost # emerge --clean --pretend --verbose world
root@myhost # emerge --depclean --pretend --verbose

# Pretend to remove cpio
root@myhost # emerge -pvC cpio
# Really remove
root@myhost # emerge -C cpio

This little BASH snippet will iterate over every package installed and use equery to determine it's dependencies.

for p in `equery --nocolor --quiet list`; do
	pkg=$(qatom $p|awk '{ print $1 "/"  $2 }')
	buf=`equery depends $pkg`
	if [ -n "$buf" ]; then
		echo "Dependencies for: $pkg";
		echo "  $buf";

See Also

Change Log