Difference between revisions of "HOWTO: Installieren von Paketen auf Sabayon / Der komplette "Portage"-Leitfaden (redirect)"

From Sabayon Wiki
Jump to: navigation, search
(New page: {{I18n| ca de en es ...)
(redirect auf deutschen Artikel)
Line 1: Line 1:
{{I18n| [[Ca:HOWTO:_The_Complete_Portage_Guide|ca]]  [[De:HOWTO: The Complete Portage Guide|de]]  [[En:HOWTO:_The_Complete_Portage_Guide|en]]  [[Es:HOWTO:_The_Complete_Portage_Guide|es]]  [[Fr:HOWTO:_The_Complete_Portage_Guide|fr]]  [[Pl:HOWTO:_Instalacja_oprogramowania_w_Sabayon_/_Kompletny_przewodnik_po_portage|pl]] [[Tr:NASIL:Bütün Portage Rehberi|tr]]}}
#REDIRECT [[De:HOWTO:_Die_vollständige_Portage_Anleitung]]
{{Warning| '''Portage (emerge) is not the primary package manager for Sabayon, this article is for advanced users only. In other words if this fails for you, its your fault. You have been warned.'''}}
'''Q.'''What is a Shell ?
'''A.''' Shell is a command line interface or terminal, known to MS Windows users as The Command Prompt. (MS Windows' shell is terrible).
To get in a Shell, press Alt-F2 (The shortcut key for the Run command window) and type '''konsole''' or '''gnome-terminal''' or '''xterm''' depending on your preference.
To get into a Root Shell either use the su (switch user command) by typing su - (the - means to change to that user's settings and home directory) or press  Alt-f2  and  type '''kdesu shellprogram''' or '''gnomesu  shellprogram''' where shell program is konsole, gnome-terminal, xterm or another. Technically the Shell is actually the environment of the command line and not just the frontend for it. The most common Linux shell is BASH (Bourne Again Shell)
'''Q.''' What is all this Alt-F2'ing ?
'''A.'''Most useful tool bar known to new Sabayon Users is The Run Command Dialog, which allows you run all sorts of programs and commands simply by typing the name of the command and pressing enter. Alt-F2 is the Global shortcut (It works in KDE, Gnome, XFCE, etc) for this, it can also be accessed by right clicking desktop and select run Command from the menu.
'''Q.''' Why do you use && in your instructions ?
'''A.''' Because it is an easy way for doing multiple commands on the one line.
'''Q.''' What I need for this guide ?
'''A.''' You need a Sabayon Linux or a Gentoo Linux install, a ''working'' brain (not everybody has one :), some eyes and the ability to read, think and learn.
==Guide Starts Here==
'''Q.''' How do I Install Software in Sabayon ?
'''Short Answer''': In a root shell type '''emerge <packagename>''' where packagename is the name of the package you wish to install.
'''Longer answer:'''
This depends on what method you are using or what you software you want to install. '''GENERALLY YOU WILL WANT TO IGNORE THE FIRST TWO METHODS!!!'''
==Windows Software==
First of All if you are installing Windows software using WINE you type '''wine /path/to/setuporinstallerexe.exe''' in a user shell (where path to setup or installer is exactly that, note that Linux shell environment isn't fond of spaces and represents them as "\ ")
==Source Installation==
Note the instructions below are generic, for specific examples or commandline examples with all the correct options of each step use google :), or your brain.
# You download a source package using wget in shell or firefox or by some other means.
# You extract this source package often a tar.bz2 or tar.gz using tar in shell or using Ark or File-roller
# You move the extracted folder to /usr/local/src using cp -R in a root shell or using Konqueror or Nautilus as Root
# You read the README and INSTALL files in the extracted package directory in /usr/local/src
# You change directory by typing '''cd /usr/local/src/packagename''' (where packagename is the package name)
# Unless otherwise stated in the README and INSTALL files if a configure script exists, type '''./configure''' otherwise make one (usually required for svn or cvs installs) by typing '''autoconf'' (if autoconf gives errors type '''libtoolize && autoreconf''', then type '''rm configure && autoconf''')
# Unless otherwise stated in the README and INSTALL files if a makefile exists type '''make && make install'''
# Done
Finally, the EASIEST and BEST method for Sabayon or Gentoo is via Portage / emerge.
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 which is a collection of ebuilds, the emerge command which installs ebuilds, the portage configuration files and the third party portage / emerge tools.
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, its 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.
An ebuild is a specialized bash script format used by Gentoo & Sabayon, in order to give a set of instructions to emerge as an interface to the Portage software management system. An ebuild is an automated way to perform the compilation and installation procedures for software.
Each version of each application or package in the Portage repository has a specific ebuild script written for it.
The ebuild script is used by the emerge. The emerge tool uses the ebuild to perform its job: calculate any dependencies of the desired software installation, download the required files (and patch them, if necessary), configure the package (based on USE flag settings), compile, and perform a sandboxed installation (in /var/tmp/portage/[ebuild name]/image/ by default). Upon successful completion of these steps the installed files are merged into the live system, outside the sandbox.
Although most ebuilds found in the Gentoo Portage repository are used to compile programs from source code, there are also ebuilds to install binary packages, ebuilds that install only documentation or data such as fonts, and basic ebuilds called "metabuilds" which solely trigger the installation of other ebuilds (such as the GNOME or KDE metabuilds).
For instructions on the creation of ebuilds see [http://devmanual.gentoo.org/quickstart/index.html Gentoo Development Guide: Quickstart Ebuild Guide] and [http://devmanual.gentoo.org Gentoo Development Guide].
The emerge command-line tool is the heart of Portage. The command is fairly complex with many options and modifiers. It is written in the Python programming language. The emerge tool is the most important utility to access the features of Portage from the command line.
The program calculates and manages dependencies, executes ebuilds and maintains the local Portage tree and database of installed packages. The compilation settings used by ebuilds can be changed through the CFLAGS environment variable, based on the specifications of the individual computer and on the user's desire for optimization. The emerge utility executes ebuilds in a sandbox environment. This way the system is protected from software executed by the ebuild and resulting binaries are only merged after a successful build and sandboxed install.
What emerge installs as dependencies is affected by the USE flag-settings. They decide which optional features will be included when installing or upgrading an application. The emerge command can also be used to download and install binary files, although some people argue that using binary packages is not taking full advantage of Portage's power since it foregoes the compile-time optimization options normally available.
===To do stuff with emerge===
You can mix and match most of the flags or switches below. Emerge works best run as root.
See man emerge for more information.
====Syncing Portage / Updating Portage Tree====
{{Console| <pre class="clear">emerge --sync</pre>}}
This updates and rebuilds the local portage tree from syncing with online servers. You will want to run this command before you start installing/removing packages since it ensures that emerge uses the most recent information. Often you will also want to run
{{Console| <pre class="clear">layman -S</pre>}}
to update all overlays. (You can read more about overlays in [[#Overlays & layman]])
====Install packages====
{{Console| <pre class="clear"># emerge <packagename> </pre>}}
{{Console| <pre class="clear"># emerge =packagecategory/packagename-version</pre>}}
(=packagecategory/packagename-version is known as a valid package atom)
This installs or upgrades / downgrades a package.
{{Console| <pre class="clear"># emerge -u <packagename> </pre>}}
{{Console| <pre class="clear"># emerge -u =packagecategory/packagename-version </pre>}}
This upgrades to best version of a package, not necessarily the latest.
There are more then 11000 packages in Portage, below is a few of the valid package atoms that can be installed.
* www-client/mozilla-firefox-
* net-fs/samba-3.0.24
* media-video/mplayer-1.0_rc1-r2
* app-emulation/wine-0.9.30
* media-gfx/inkscape-0.44.1
Packages can be viewed either on
http://packages.gentoo.org/ (official)
Of course you can usually just specify the package name (eg mozilla-firefox, samba, mplayer, wine or inkscape)
====Remove packages====
{{Console| <pre class="clear"># emerge -C <packagename> </pre>}}
{{Console| <pre class="clear"># emerge -C =packagecategory/packagename-version </pre>}}
This removes a package.
{{Console| <pre class="clear"># emerge -c <packagename> </pre>}}
{{Console| <pre class="clear"># emerge -c =packagecategory/packagename-version </pre>}}
This cleans / removes a package and its unnecessary dependencies.
{{Console| <pre class="clear"># emerge --depclean </pre>}}
This removes all packages not listed in system or world files.
====Changing portage verbosity ====
{{Console| <pre class="clear"># emerge -v <packagename> </pre>}}
This makes portage verbose.
{{Console| <pre class="clear"># emerge -q <packagename> </pre>}}
This makes portage quiet.
{{Console| <pre class="clear"># emerge -s <packagename> </pre>}}
This searches for a package with the packagename.
{{Console| <pre class="clear"># emerge -S <packagename> </pre>}}
This searches for a package with the packagename or the search term in the package description.
====Asking and Pretending====
{{Console| <pre class="clear"># emerge -a <packagename> </pre>}}
This makes emerge, confirm each action, step with you the user.
{{Console| <pre class="clear"># emerge -p <packagename> </pre>}}
This makes emerge pretend to do the following action, but not actually do it. It is useful combined with the -v flag. The key for the information provided by pretend is shown below.
N = new (not yet installed)
S = new SLOT installation (side-by-side versions)
U = updating (to another version)
D = downgrading (best version seems lower)
R = replacing (remerging same version))
F = fetch restricted (must be manually downloaded)
f = fetch restricted (already downloaded)
B = blocked by an already installed package
====Other cool options====
{{Console| <pre class="clear"># emerge -1 <packagename> </pre>}}
doesn't add the package/s to the world file (list of packages you want installed) when installed packages.
{{Console| <pre class="clear"># emerge -o <packagename> </pre>}}
doesn't emerge the package/s you want only its dependencies
{{Console| <pre class="clear"># emerge -f <packagename> </pre>}}
doesn't install or unpack the package/s you want only fetching / downloading the source or binary package.
{{Console| <pre class="clear"># emerge --resume </pre>}}
resumes the last operation, which is useful it you stopped it mid way through using ctrl -c to kill it.
====Big updates & recompiles====
{{Console| <pre class="clear"># emerge world</pre>}}
{{Console| <pre class="clear"># emerge -e world</pre>}}
This reinstalls / upgrades everything on your world file / list of packages you want installed.
This is DANGEROUS if done without proper planning, package masking (see below) and the correct switches / flags.
For the best way to emerge world, see the howtos on the Gentoo Forums or the Gentoo Wiki, and Good Luck.
{{Console| <pre class="clear"># emerge system</pre>}}
{{Console| <pre class="clear"># emerge -e system</pre>}}
This reinstalls / upgrades everything all your core system packages.
This is not as dangerous as emerge world, but still needs correct planning.
==Overlays & layman==
Portage overlays are custom portage trees that contain packages not found or different from the packages in the main tree.
Overlays can be manually added by changing PORTDIR_OVERLAY="" in /etc/make.conf , but in Sabayon we prefer to use layman (overlay manager).
{{Console| <pre class="clear"># layman -l</pre>}}
This lists all overlays.
{{Console| <pre class="clear"># layman -S</pre>}}
This syncs all installed overlays. (like emerge --sync)
{{Console| <pre class="clear"># layman -s <overlayname> </pre>}}
This syncs the overlay with the overlayname.
{{Console| <pre class="clear"># layman -a <overlayname> </pre>}}
This adds / installs an overlay. You may need to edit /etc/make.conf to finalize.
{{Console| <pre class="clear"># layman -d <overlayname> </pre>}}
This removes / uninstalls an overlay. You may need to edit /etc/make.conf to finalize.
To sync the Sabayon overlay type:
{{Console| <pre class="clear"># layman -s sabayon </pre>}}
If you want to search for packages in ALL overlays, then do:
{{Console| <pre class="clear"># emerge eix && update-eix && update-eix-remote update </pre>}}
Now you can use '''eix <keyword>''' to search for keyword in all overlays(you can use '''-e''' option for exact match). Then you can use layman to add the needed overlay. Remember to run '''update-eix && update-eix-remote update''' from time to time.
For more on 3rd party packages and overlays see http://www.gentoo-wiki.info/HOWTO_Installing_3rd_Party_Ebuilds .
For more information of overlays see http://en.gentoo-wiki.com/wiki/Portage_Overlay
==Portage GUI Tools==
Kuroo and Porthole are GUI frontends for emerge / portage in KDE and Gnome respectively. However Kuroo is not actively developed and is no longer in the portage tree. Porthole is said to be less hassle than Kuroo because it ignores the portage rules which Kuroo complains about.
Two other portage GUI frontends, both based on the GTK, are Portato and Himerge (the latter written in Haskell).
Optional: You can speed up the portage GUI tools and emerge by typing as root '''emerge udept''', then as root typing '''dep -w''', this cleans up the Sabayon Linux world file and it takes some time but does speed up merging.
==Installing Himerge==
{{see also|[[HOWTO: Install Himerge]]}}
{{Console| <pre class="clear"># emerge -av himerge</pre>}}
==Hard masked Packages & /etc/portage/package.mask and /etc/portage/package.unmask==
Masked / Hardmasked packages are packages in portage that are locked or blocked from being installed for many reasons.
(=packagecategory/packagename-version) This is what is known as a valid package "atom".  Anytime you receive an error in Portage concerning package "atoms" one of three possibilities may exist:
# You typed the package atom incorrectly.  Check your typing and re-emerge.
# The atom only exists in the SabayonLinux overlay and you need to #layman -S to update the overlay and re-emerge the package
# The atom you are trying to install does not exist at all.
Examples of valid package atoms that may need to be masked or unmasked include
* =x11-drivers/xf86-video-i128-1.2.1
* =sys-apps/dbus-1.0.2
* <=dev-libs/dbus-glib-0.73
To mask a package add a line for that package containing either =validpackageatom or >validpackageatom or <validpackageatom or >=validpackageatom or <=validpackageatom depending on which version of that package you want to mask, in /etc/portage/package.mask
To unmask a package add a line for that package containing either =validpackageatom or >validpackageatom or <validpackageatom or >=validpackageatom or <=validpackageatom depending on which version of that package you want to unmask, in /etc/portage/package.unmask.
Packages are masked for a reason, this reason is either provided in portage, or can be identified by asking other people. Be careful when masking and unmasking packages.
More info here: http://www.gentoo-wiki.info/Masked
==Missing keyword==
If portage says: "masked by: missing keyword" while emerging, it means that the packages isn't available for your architecture yet, i.e. you are running x86_64 and the package has for instance "x86" keyword only. If you really need that package, then you can try: '''echo "category/package x86 ~x86" >> /etc/portage/package.keywords''' to override it for package in a category. (Note: I've used the unstable "~x86" since the rest of Sabayon is running with unstable keywords anyway). As Gentoo is source based there's good chance of package compiling and working without modifications.
More info here: http://www.gentoo-wiki.info/Masked
This file is used to run unstable packages on stable systems or ebuilds that haven't been tested on your platform. This file isn't that important to Sabayon users, but gentoo-wiki.com has more information if you are interested.
See here http://www.gentoo-wiki.info/MAN_make.conf_5
==etc-update & dispatch-conf==
These tools update configuration files after packages have been emerged.
man etc-update and man dispatch-conf , provide the need to know information.
When in doubt make a backup of your old config file and then update. If something bad happens restore to the backup.
==revdep-rebuild, equery, eix, and more==
revdep-rebuild rebuilds broken packages caused by reverse dependencies and libraries breaking.
revdep-rebuild -Xp before typing revdep-rebuild -X is a good idea.
-X makes it ignore specific package version, -p makes it pretend, similar to emerge -p
revdep-rebuild takes time and often involves big emerges, but your system should be working good by the end of it.
equery and eix are extended portage search tools, man equery and man eix provide their syntax and for further resources see gentoo-wiki.com and the Gentoo Forums.
==Thanks to==
*Gentoo Wiki (http://gentoo-wiki.com/ o http://www.gentoo-wiki.info)
*Gentoo Handbook (http://www.gentoo.org/doc/en/handbook/index.xml)
*Sabayon community
*<Psil0cybe> for proofread & spelling & typo fixing
* Voxiac for additions
* Necoro for portato information
--[[User:Appleman1234|Appleman1234]] 23:48, 15 February 2007 (PST)
[[Category:Portage|Complete Portage GuideEn]]

Revision as of 22:09, 3 August 2015