Package management in Sabayon using Portage tree

Portage is a package management system that is used by Gentoo and Sabayon to install, uninstall and maintain software on your system. The Portage system consists of the Portage tree, theemerge command and the settings in your make.conf file.


The Portage Tree

The Portage tree is a local copy (located in /usr/portage) of the central software package repository. Whenever you install software on your system with the emerge command, the Portage tree is searched. If a matching package name is found, it’s dependencies are calculated, the source code for the package and its dependencies are downloaded and then they’re all compiled and installed onto your system.
Maintaining the Portage tree
You should update your Portage tree on a regular basis (about once a week or so) to help keep your system up to date:

 emerge --sync

Another area of the Portage tree that needs maintenance is the /usr/portage/distfiles directory. This is where all the downloaded source code and binary packages are stored. Every 4 to 6 months or so you should delete everything in this directory to save storage space. You can do this by using the rm command:

 rm -rf /usr/portage/distfiles/*

The emerge command

The emerge command is the primary way you, the user, will interface with Portage. To run “emerge”, you should first open up the terminal program of your choice and login as root.
(Note: this document only covers the basics of emerge. for an in-depth guide, check out the emerge wiki page or the emerge man page)

Installing packages
To install a package, simply type “emerge” and the name of the package you want to install. For example, if you wanted to install the Opera web browser:

 emerge opera

Some package names aren’t what you would expect them to be, If you wanted to emerge firefox for example:

 emerge mozilla-firefox

It is usually safer to add the –ask option to emerge and check that it will really install what you want before proceeding:

 emerge -a mozilla-firefox
 These are the packages that would be merged, in order:
 Calculating dependencies... done!
 [ebuild     U ] www-client/mozilla-firefox-2.0 [2.0_beta2]     
 Would you like to merge these packages? [Yes/No]


If you’re having trouble finding a package you can search the Portage tree for it. For example:

 emerge -s firefox

would output something like this:

 [ Results for search key : firefox ]
 [ Applications found : 2 ]

     Latest version available:
     Latest version installed:
     Size of files: 39,034 kB
     Description:   Firefox Web Browser
     License:       MPL-1.1 NPL-1.1

     Latest version available:
     Latest version installed: [ Not Installed ]
     Size of files: 12,751 kB
     Description:   Firefox Web Browser

You can also check out the Gentoo Online Package Database to locate packages:

Uninstalling Packages
To uninstall a package, the emerge command is ran with the “–unmerge” modifier. For example, if you wanted to uninstall Opera:

 emerge --unmerge opera

(Note: This is the “safe” way to remove emerged programs, There are methods to remove a package and all of its dependencies, but they can lead to b0rked system.)

Updating The System

First you should update the portage tree as shown above in maintaining the Portage tree

After the portage tree is updated, you can update your system by typing:

 emerge -auDN world

This will “re-emerge” any package that has a newer version available in the Portage tree.
(Note re-emerging a program is different than reinstalling it: the existing version on your system is replaced with the recompiled package, leaving your configuration files, program settings, bookmarks, most recently used files, themes etc. intact.)

Performing a system update might result in some configuration files needing to be updated. For more information about this, check the emerge wiki.


About pacesettergraam

A good and realistic person

Posted on September 6, 2012, in linux, sabayon and tagged , . Bookmark the permalink. 1 Comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: