From Sabayon Wiki
Revision as of 20:50, 6 October 2013 by Yudjin (talk | contribs) (Created page with "{{I18n| de en ru}} Portage - это система управления пакетами, используемая в Gentoo и Sabay...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
i18n: de en ru

Portage - это система управления пакетами, используемая в Gentoo и Sabayon для установки, удаления и поддержки прикладных программ в вашей системе. Portage состоит из Portage tree (дерева портеджей), команды emerge и настроек в файле make.conf.

Дерево портеджей

Дерево портеджей - это локальная копия (находится в /usr/portage) списка пакетов в главном репозитории. Каждый раз когда вы устанавливаете программное обеспечение при помощи emerge, происходит поиск в дереве портеджей. Если имя пакета найдено, происходит подсчет его зависимостей, загрузка исходного кода пакета и его зависимостей, распаковка кода, его сборка и установка запрашиваемого ПО в вашу систему.

Поддержка дерева портеджей
Вы должны регулярно обновлять дерево портеджей (раз в неделю, или чаще) для того чтобы система "знала" о актуальных версиях ПО:

 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.


Make.conf is a configuration file that controls many aspects of: the way Portage works, the way the emerge command behaves and the way GCC compiles code. (Note: for a more in-depth guide on make.conf, check out the make.conf wiki page or the make.conf.example file in /etc.)

USE flags
USE flags are special flags set in make.conf, in the package.use file or right on the command line that control what features and/or programs you want to build in support for when you emerge packages. This is one of the features that makes Sabayon and Gentoo so flexible, you can build a package so that it only has the features you'll be using built in to it. For example: My laptop doesn't have a DVD burner in it. By setting the USE flag "-dvdr", I was able to emerge the CD/DVD burning program K3B without DVD burning support.

The rest of the make.conf file is too expansive to get in to in this overview, and beyond the scope of a simple introduction to the portage system. For more information on CFLAGS, Advanced Masking, setting Portage Directories and other advanced options, check out the make.conf wiki.