Difference between revisions of "User:Doru001/Pacman - An Introduction"

From ArchWiki
Jump to: navigation, search
(Removing packages)
(Blanked the page)
Line 1: Line 1:
=== Overview ===
Packages in ''arch repositories'' are constantly upgraded. When a package is upgraded, its old version is removed from the repository. There are no major arch releases. Each package is upgraded as new versions become available from upstream sources. The repository is always coherent. (The packages in the repository always have compatible versions.) This type of repository is called a '''rolling archive'''. Before packages are upgraded in the '''core''', '''extra''' and '''community''' repositories, they are tested in the '''testing''' repository, to ensure that the distribution is stable.
{{ic|pacman}} saves to disk a '''list of packages''' available in the repository. This list is not automatically updated (refreshed). (The list is a.k.a. '''repository databases''' and the update of the list is a.k.a. '''synchronizing''' those databases.) The list can be refreshed using {{ic|pacman -Sy}}. {{ic|pacman -Syy}} refreshes the list even if it appears to be up to date. (Running {{ic|pacman -Syy}} is a good idea after the repository mirror used by {{ic|pacman}} is changed by the user. Mirrors can be out of sync and the package list from the old mirror may not correspond to the package list of the new mirror, even though the dates of the lists may suggest that they do.)
=== Installing packages ===
{{ic|pacman -S ''mypackage''}} installs {{ic|''mypackage''}} and all its dependencies. If {{ic|''mypackage''}} has been upgraded by the user since the last refresh of the package list, then the required version of {{ic|''mypackage''}} will not be found in the repository and {{ic|pacman -S ''mypackage''}} fails with a message. {{ic|''mypackage''}}'s dependencies are listed in the '''Depends On''' entry of {{ic|''mypackage''}}'s ''metainformation''. ({{ic|''mypackage''}}'s ''metainformation'' can be listed with {{ic|pacman -Si ''mypackage''}} for packages in the package list and with {{ic|pacman -Qi ''mypackage''}} for installed packages). If {{ic|''mypackage''}} or its dependencies are already installed, they are upgraded to the version in the package list. If {{ic|pacman -S ''mypackage''}} finds any conflicts (installed packages which are listed in the '''Conflicts With''' entry of the {{ic|''mypackage''}}'s ''metainformation'') then it fails with a message. {{Warning|However, {{ic|pacman -S ''mypackage''}} does not check for broken dependencies which may appear from the possible upgrade of {{ic|''mypackage''}} or one of its dependencies. It is possible that an already installed package which depends on an upgraded package is unable to function with the new version of the upgraded package. This can happen if the package list has been refreshed by the user but all installed packges have not been upgraded and it could result in a non functional system after reboot.}}
The solution is to never run {{ic|pacman -Sy}}, which could be followed by {{ic|pacman -S ''mypackage''}}, but to always run {{ic|pacman -Syu}}, which upgrades all packages after the refresh of the package list. This ensures that when {{ic|pacman -S ''mypackage''}} is run all packages installed on the system have compatible versions.
After {{ic|pacman -Syu}} is run there is a small chance that corrections on the system will be needed in order to have it running as desired. Important corrections are advertised here: [https://www.archlinux.org Arch Home]. They are very rare (six in 2012). However, it is advisable to run {{ic|pacman -Syu}} only when time to perform corrections is available to the user and not when the system is relied upon. It is advisable to run {{ic|pacman -Syu}} often in order to minimize the difficulty of adjustment, whenever it arises.
See also [[Pacman#Installing packages|Installing packages]].
=== Removing packages ===
{{ic|pacman -R ''mypackage''}} removes {{ic|''mypackage''}}. If other packages depend on {{ic|''mypackage''}}, then it fails with a message. To remove them too, {{ic|pacman -Rc ''mypackage''}} should be run. {{Warning|The list of packages to be removed should be carefully checked before they are removed. Otherwise, packages required by the system to function may be
inadvertently removed.}} {{ic|pacman -R ''mypackage''}} does not remove {{ic|''mypackage''}}'s dependencies which have been installed as dependencies (not explicitly, '''Install Reason''' in {{ic|''mypackage''}}'s ''metainformation'') and are not required by other packages. For that to happen, {{ic|pacman -Rs ''mypackage''}} must be run. The complete command would be {{ic|pacman -Rcs ''mypackage''}}.
See also [[Pacman#Removing packages|Removing Packages]].
=== Notes ===
{{ic|pacman}} always lists packages to be installed or removed and asks for permission before it takes action. To inhibit any action, {{ic|-p}} should be used.
{{ic|pacman}} operates at a lower level compared to {{ic|yum}} and {{ic|apt}}. This requires more attention from the user, but it also empowers him or her with better control over his or her system.
For those who have used other Linux distributions before, there is a helpful [[Pacman Rosetta]].

Revision as of 10:55, 6 February 2013