Co to jest Pacman?
- 1 Ogólnie
- 2 Aktualizacja systemu
- 3 Synchronizacja lokalnej bazy pakietów z repozytoriami Manjaro
- 4 Searching for Software Packages
- 5 Dependencies
- 6 Orphans
- 7 Downloading and Installing Software Packages
- 8 Removing Applications and Software Packages
- 9 Cleaning the Cache
- 10 Holding Back Packages from being Upgraded
- 11 Learning pacman's options
- 12 Troubleshooting
- 13 See Also
Pacman jest menedżerem pakietów stworzonym przez Judda - twórcę systemu Arch Linux specjalnie dla tej dystrybucji i obecnie rozwijanym przez jego deweloperów. Nazwa jest skrótem utworzonym od package manager. Za jego pomocą możesz instalować, aktualizować, konfigurować, przeszukiwać lub usuwać pakiety. Pacman jest narzędziem konsolowym. Przedstawione poniżej komendy zakładają, że masz już uruchomiony terminal (konsolę).
W celu aktualizacji systemu, wydaj następującą komendę:
sudo pacman -Syu
Synchronizacja lokalnej bazy pakietów z repozytoriami Manjaro
Your Manjaro system has a database of all the software packages (e.g. system updates and applications) that are available from the official repositories. This is used to help pacman locate and download these packages for installation. When updating your system, its database will automatically be refreshed as well. However, using this command is more thorough, as rather than just refreshing or updating the database, it will actually rebuild it completely. To synchronise your database with the Manjaro repositories, enter the following command in the terminal:
sudo pacman -Syy
To simultaneously synchronise with the repositories and update your system, enter the command:
sudo pacman -Syyu
Searching for Software Packages
It is also possible to use pacman to search for software packages, both available for download from the Manjaro repositories, as well as those already installed on your system.
Searching the Manjaro Repositories
Manjaro's software repositories for any desired software, provided you know the name of what you want. The sudo prefix is not required for this. To search for a software package in the Official Manjaro repositories, the basic syntax is:
pacman -Ss [software package name]
For example, to search the repositories to see if a text editor called Leafpad is available, the following command would be entered:
pacman -Ss leafpad
Searching Your System
In addition, it is also possible to search for packages that have already been installed on your system. For basic information, enter the following command:
pacman -Q [software package name]
Otherwise, to gain far more comprehensive about an installed package, enter the following command:
pacman -Qi [software package name]
It is also possible to gain even more information, including related backup files as well as the date that the package was last altered by entering the command:
pacman -Qii [software package name]
Finally, for a list of all installed packages on your system, enter the following command:
To list all dependencies of a particular software package (i.e. other software that requires the specified software package in order to work), enter the following command:
pactree [software package name]
To list all orphans - that is, installed packages that are not used by anything else and that consequently serve no purpose - enter the following command:
It is highly recommended to remove orphans from your system, as although harmless, they still serve no purpose other than to take up room and resources. Rather than having to remove them one-by-one, the following command will search for and remove them for you:
sudo pacman -Sc $(pacman -Qdtq)
See this page Orphan Package Removal  for a more detailed exposition of this topic.
Downloading and Installing Software Packages
Software packages may be downloaded and installed from a range of sources, and not just from the official Manjaro repositories. However, please note that where installing packages from unofficial sources, you do so entirely at your own risk!
Packages from the Manjaro Repositories
To install a software package, the basic syntax is:
sudo pacman -S [software package name]
For example, to download and install leafpad, the following command would be entered:
sudo pacman -S leafpad
It is also possible to download software packages without actually installing them by entering the following command:
sudo pacman -Sw [software package name]
Packages from the AUR (Arch User Repository)
To install a package from the AUR using a wrapper for pacman like yaourt-
yaourt -S [software package name]
See The Arch User Repository for more details.
Packages Located Locally or From the Internet
To install a package already downloaded onto your system (the file name should end in pkg.tar.xz), the basic syntax is:
sudo pacman -U [/package_path/][software package name.pkg.tar.xz]
For example, to install a package located in the Downloads folder, the following command would be entered:
sudo pacman -U ~/Downloads/[software package name.pkg.tar.xz]
To install a package via a URL (i.e. located elsewhere on the internet), the basic syntax is:
Removing Applications and Software Packages
To remove a software package, the basic syntax is:
sudo pacman -R [software package name]
For example, to remove the software application Leafpad, the following command would be entered:
sudo pacman -R leafpad
It is also possible to remove package and its dependencies, provided those dependencies are not being used by any other packages. Deleting dependencies exclusive to a certain package is wise, as once the main package is removed, they will become orphans, serving no other purpose than to clutter up your system. To do so, enter the following command:
sudo pacman -Rs [software package name]
However, Pacman usually also creates backup configuration files when deleting packages. As such, for a more thorough (and cleaner) removal (ie. the package, its dependencies, and any configuration files usually generated by pacman) enter the following command:
sudo pacman -Rns
Cleaning the Cache
Your system cache is where downloaded software packages are stored for installation. Even after being installed, they may still remain in the cache. This is why on occasion it may be found that when re-installing a software package, it does not have to be downloaded again. However, it is possible to clear your cache to free up space on your system (and may be necessary in some rare instances to download and install new software packages).
To clear the cache of downloads that have already been installed, enter the following command:
sudo pacman -Sc
Otherwise, to clear the cache completely, enter the following command (and use with care):
sudo pacman -Scc
For tips on how to easily manage the /var/cache/pacman/pkg for your benefit see this wiki page Maintaining /var/cache/pacman/pkg for System Safety .
Holding Back Packages from being Upgraded
Courtesy the Arch Wiki
Pacman's settings are located in /etc/pacman.conf
To hold back a specific package from being updgraded
For multiple packages use a space-separated list, or use additional IgnorePkg lines.
Skipping a whole package group is also possible
Learning pacman's options
It is a very good idea to become familiar with the varied and powerful uses of pacman. A comprehensive list of options that can be used with pacman can be found by entering the following command:
To exit out of the list, simply press q.
A separate page for pacman troubleshooting is available here.