Configuring your system with variables
Updated 25 September 2019
- Configuring Portage
- Compilation options
- Protection of configuration files
- Download options
- Gentoo configuration
- How Portage behaves
As we mentioned [earlier] (files_and_directories), Portage can be configured with many variables, to be set in the file.
Configuration and compilation
When Portage builds applications, the following variables are passed to the compiler and to the configuration script:
- and define the desired compilation flags for C and C++
- provides platform information for the configuration script
- + is passed to the
makecommand and is usually used to set the level of parallel compilation. More detailed information about the parameters of
makecan be found on the make main page.
The USE variable is also used in configuration and compilation. It is covered in detail in previous chapters.
When Portage installs (merges) a new version of software, older versions are removed from the system. Portage gives user five seconds before actually deleting the older versions. These 5 seconds are defined by .
Protection of configuration files
Locations protected by Portage
Portage writes files provided by the newer version of a package on top of the old ones, unless those are located in a protected location. Which directories to protect is defined by the variable. This is usually where configuration files are located. Directories must be space-separated.
The file to be written to a protected directory is renamed and the user is warned if there is a new version (usually) of the configuration file.
To find out the current value of , read the output of
emerge --info | grep 'CONFIG_PROTECT='
To learn more about how Portage protects configuration files, use the
emerge --help config
Use to unprotect specific subdirectories in a protected directory.
If the requested information or data is not available on your system, Portage looks for it online. The following variables define the locations for information channels:
- stores the list of servers providing source code, or Distfiles.
- defines the location of the server that hosts prebuilt (binary) packages for your system
The third variable stores the location of the rsync server, which is used to update your Portage tree:
- defines the server where Portage retrieves the Portage tree from.
Variables and can also be set automatically by
mirrorselect. Install it first, by running
emerge mirrorselect. For information, refer to the mirrorselect help page:
If you have to use a proxy server, you can edit , and to set its address.
Commands for extraction
When Portage needs to extract source code,
wget is used by default. This behaviour can be modified by editing the value.
Portage can resume previously aborted fetching source code. The default is
wget, but this can be modified by editing .
Make sure that and save the code in the right place. Inside these variables, use and to define the location of the source code and the distfiles, respectively.
It is also possible to edit specific protocol settings: consider editing , , , , etc.
The rsync command that Portage uses to update the Portage tree cannot be replaced, but it is possible to edit variables that define its behavior:
- + contains the path to the list of the packages and/or categories that rsync must ignore when updating.
- defines how often rsync must try connecting to the mirror specified in the variable. The default value is 3.
- + defines how long (in seconds) a rsync connection can remain idle before it is considered to have exceeded the waiting time. The default value is 180, but if you are using a modem connection or have an old computer, you may want to set this variable to 300 or more.
Selecting a branch
You can switch between branches by redefining . By default, stable is used. Your architecture will be detected automatically. More information about Gento branches can be found in the next chapter.
To finely tune Portage functionality, feel free to edit the variable. The functionality of Portage has been discussed in previous chapters, such as [Portage Features] (portage_features).
How Portage behaves
The + variable is used to increase or decrease the nice value applied to Portage. The value _is added to the current
To learn more about
nice parameters, refer to the man page:
The variable ("false" by default) defines whether Portage turns off coloring in its messages.