diff options
author | xengineering <me@xengineering.eu> | 2023-02-04 12:49:19 +0100 |
---|---|---|
committer | xengineering <me@xengineering.eu> | 2023-02-05 15:31:09 +0100 |
commit | 84513c79d1ab4114a15919e8aa72b47dcff5dccf (patch) | |
tree | ae0cd4b22818267dce33dac016778defd6627ac9 /content | |
parent | 78eed530111fdc8640133da5bbf8a5f86d703a50 (diff) | |
download | website-84513c79d1ab4114a15919e8aa72b47dcff5dccf.tar website-84513c79d1ab4114a15919e8aa72b47dcff5dccf.tar.zst website-84513c79d1ab4114a15919e8aa72b47dcff5dccf.zip |
Add pacman essentials article
Diffstat (limited to 'content')
-rw-r--r-- | content/articles/pacman-essentials.md | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/content/articles/pacman-essentials.md b/content/articles/pacman-essentials.md new file mode 100644 index 0000000..54657e0 --- /dev/null +++ b/content/articles/pacman-essentials.md @@ -0,0 +1,107 @@ +{ + "title": "Pacman essentials", + "subtitle": "Arch Linux package manager explained for everyday users" +} + +#### Introduction + +The program `pacman` is the package manager of the [Arch Linux](https://archlinux.org/) +distribution. It should be exclusively used to install, update and remove +software to an Arch Linux system. + +As a terminal program it has no graphical user interface (GUI). This might be +uncommon for new users but has advantages like being simple, scriptable and +easily to document like on this page. + +With an open terminal and this guide you should be able to manage the software +on your Arch Linux instance in most cases. + +#### Getting necessary permissions + +A regular Linux user is allowed to use pacman to get information. This includes +for example the package search with `pacman -Ss <keyword>`. + +Only the user `root` is allowed to use pacman to update, install or remove +software packages. Other users are able to get temporary root permissions by +using a program like `sudo`. + +Thus a pacman call like `pacman -Syu` should be rewritten to `sudo pacman -Syu` +to run it with root permissions. It should be mentioned that using `sudo` is +not required if logged in as user `root` or could be substituted by another +program like `doas`. + +#### Full system update + +Every Arch Linux installation should be regularly updated. For this purpose +the following command is used: + +``` +sudo pacman -Syu +``` + +It runs interactively which means that questions should be answered by the user +with pressing `y` or `n` followed by the `Enter` key. The default option (the +bigger letter in `[Y/n]` or `[y/N]`) is a good option in most cases. + +Updating a system every week is a good rule of thumb. It is especially +convenient to update the system before poweroff because most of it can run +without interaction. The poweroff can also be automatically triggered after a +successful update with `sudo pacman -Syu && poweroff`. + +#### Package search + +One can search for existing packages with this command: + +``` +pacman -Ss <keyword> +``` + +`<keyword>` should be replaced by keywords like `firefox`. Furthermore the +package search on the [Arch Linux homepage](https://archlinux.org/) in the +upper right corner can be used. + +The Arch Linux wiki contains also a long [list of +applications](https://wiki.archlinux.org/title/List_of_applications) which is +an excellent place to search for needed programs by category. + +#### Package installation + +Installing a package is simple: + +``` +sudo pacman -S <package-name> +``` + +`<package-name>` should be replaced by the lower case package name found with +the package search (see above) like `firefox` or `gimp`. + +It is also possible to install multiple packages with a space-separated list of +packages like `sudo pacman -S firefox gimp` or together with a full system +update `sudo pacman -Syu firefox`. + +#### Package removal + +The recommended command to remove one or multiple packages is: + +``` +sudo pacman -Rs <package-1> <package-2> +``` + +The options `-Rs` select removal with `R` and recursive with `s`. The latter +option removes dependencies of this package too. Dependencies are packages +which are needed for the selected package to work. They get installed +automatically. The `s` option will leave a dependency on the system if +installed explicitly by the user or needed by another package. + +#### Further documentation + +This page is just a little cheat sheet especially targeted at new Arch Linux +users. The following references point to the official documentation about +pacman: + +- The manual page of pacman: `man pacman` (exit with `q`) +- Arch Wiki: [pacman](https://wiki.archlinux.org/title/Pacman) +- Arch Wiki: [pacman/Tips and tricks](https://wiki.archlinux.org/title/Pacman/Tips_and_tricks) + +They should be consulted to get further information and should be trusted more +than this page if in conflict with its content. |