Using portage
one of the best (and worst) things about gentoo is the portage system. think of portage as the equivalent of the windows installer, but without a graphical user interface, that acts as an "agent" between your computer and the software you want to install.
portage is run by using the command "emerge". the syntax is as follows:
emerge -<flags> <what to emerge>
portage will read the contents of your /etc/make.conf file to determine which gentoo mirror to download packages from. your make.conf file also contains an rsync server, which will update the local information available to portage so it has the latest list of packages. To sync portage, use the command
emerge --sync
Portage flags tell portage which action to take. Some of the available flags are
-u : update the package in question. -D : update the package in question, and any packages it depends on -N : re-emerge the package with new USE flags -v : verbose mode -a : ask before emerging the package(s) -C : uninstall the package in question. -s : search for package(s) in question. -p : pretend to emerge package (see what would happen)
- always use the -p flag before emerging any package. ***
If I had just run an emerge --sync and wanted to see if there was a new version of the ati video drivers, I would issue the command
emerge -p ati-drivers
If I wanted to search for vlc media player, I would issue the command
emerge -s vlc
To see all the packages on my system that could be updated,
emerge -uDNvp world
Your etc/make.conf contains your global USE flags. Portage reads these flags before emerging any package, and will use them to compile and optimize the package based on the flags you have set. To view a list of the packages available in portage, and the USE flags available for each, visit
http://gentoo-portage.com/Browse
If there is a USE flag you want to use for a specific package but don't want to use globally, you can specify the package and USE flag in /etc/portage/package.use.
nano -w /etc/portage/package.use
For example, if we wanted to emerge conky without the ivp6 USE flag, but we had the ipv6 USE flag in our make.conf, we would add a line such as
app-admin/conky truetype audacious -ipv6
to specify that portage emerge conky with the truetype and audacious USE flags, but not the ipv6 USE flag.
Some packages in portage may be masked (or blocked) for various reasons. You may run into an issue where you can't install a certain package because it or one of its dependencies are masked. To unmask a package, edit your /etc/portage/package.keywords file:
nano -w /etc/portage/package.keywords
to unmask a specific package, you'll need to package type and package name in the format <package-type>/<package-name>. For example, if we wanted to emerge masked versions of portage, we would add
sys-apps/portage **
to our package.keywords file. This strategy can be used to emerge any masked package.
Since there may be many different versions of each package in portage, and in many cases, the latest package may not always be the best. You can specify specific package versions and prevent portage from upgrading them by specifying
=pkg-type/pkg-name-version
in your package.keywords file. you can also tell portage to install a specific package on-the-fly using the syntax
emerge =pkg-type/pkg-name-version
The most common problem when using portage is circular dependencies and blocked or masked packages. package x may require package y which may require package z which cannot coexist with package x. there are a number of ways to circumvent these types of issues.
- uninstall packages blocking other packages. *
to do this, use portage's -C flag.
emerge -C <package to uninstall>
- upgrade or downgrade packages. *
change your package.keywords file and try to emerge problematic packages individually. to do this, you can specify the package version in your package.keywords file, or do it on-the-fly using
emerge =pkg-type/pkg-name-version
- run revdep-rebuild. *
to run gentoo's revdep-rebuild (review dependencies and rebuild packages) command, you will need to emerge the gentoolkit.
emerge gentoolkit
revdep-rebuild
this will rebuild any libraries that have broken associations. it is recommended to run revdep-rebuild every time you emerge packages that have significant impact on your system.
- try using a beta version of portage. *
add
sys-apps/portage **
to your /etc/portage/package.keywords file and then run
emerge portage
unsupported versions of portage may pull in other masked packages, so you'll have to note these packages and add them to your package.keywords in similar fashion. Once a newer version of portage is installed, you'll want to run
emerge --sync
and try emerging your packages again.
you don't need to understand all of this information- just remember that it is here and you can use it as a reference if needed.