Arch linux обновить пакеты

Pacman Command in Arch Linux

I’ve recently started using a Arch Linux distribution Garuda Linux and the package management tool is pacman this article summarizes the most common actions with based on the following article from GeeksforGeeks.

Intro

Pacman is a package manager for the arch Linux and arch-based Linux distributions. If you have used Debian-based OS like ubuntu, then the Pacman is similar to the apt command of Debian-based operating systems. Pacman contains the compressed files as a package format and maintains a text-based package database. Pacman keeps the system up to date by synchronizing package lists with the master server. Pacman can install the packages from the official repositories or your own build packages.

Installing Packages using the Pacman

When we install any new operating system on our machine, the first task we do is to install the software packages on the system. Now, to install the packages on Arch Linux, use the command Pacman with -S option and mention the package name. The -S option tells the Pacman to synchronize and to continue. Here is one example

We can mention the many package names after the -S option, separated by space.

sudo pacman -S package1 package2 package3

Then Pacman will show the download and install size of the package and ask for to proceed, then simply press the Y key. Pacman categorizes the installed packages into two categories.

  • Implicitly Installed: The package that was installed using the -S or -U option.
  • Dependencies: The package is installed because it is required by another package.

Removing packages using the Pacman

When we don’t need the package anymore, then we should remove the package from the system. To remove the package with all its dependencies which are not required by other packages, use the following command:

To remove the package without removing its dependency use the following command:

To remove the dependencies which are not required anymore, use the following command:

Upgrading packages

In arch Linux, we can upgrade the full system by only one command using the Pacman. Use the following command to update the system:

Читайте также:  Установка apktool на linux

Let’s understand the meaning, S tell the pacman to synchronize the local database with the main database. u tells the pacman to upgrade the packages and y update the local catch on the system. Basically, this command synchronizes the local pacman database with the main repository database and then updates the system.

Searching for a Package

Now let’s see how we can search the package into the database of pacman. To search query in the name and description of the package in the database use the following command:

To search into already installed packages on the system, use the following command:

To search the query into the local database use the following command:

Cleaning the Package Cache

When pacman downloads the packages it stores the packages into the /var/cache/pacman/pkg/ and while uninstalling the package pacman does not delete these files. Pacman uses these files to downgrade the package or install the package. But it can take a lot of space to store these packages. So to delete the stored packages, use the following command:

To remove all stored packages and cache, use the following command:

Installing local packages

By using pacman we can install packages other than the main repository of Arch Linux. Use the following command to install the packages

sudo pacman -U path_to_file.pkg.tar.xz

sudo pacman -U http://www.example.com/repo/example.pkg.tar.xz

Troubleshooting

Sometimes installing the packages with pacman we face some errors. Following are the mainly occurred errors with pacman:

  • Conflicting file error: This error occurs due to some conflict packages present in the repository. To solve this error we can manually rename the file or force the overwrite function. We can use the following command to overwrite the function:
    • pacman -S —overwrite glob package

    Garuda

    Garuda also brings a useful command update that abstracts all this interactions to keep your rolling system updated, still very important to understand the command line utilities to manage the packages and check the official man page for further details as this is always evolving.

    Reference

    Источник

    Менеджер пакетов Arch Linux Pacman

    Менеджер пакетов Pacman сочетает в себе простой формат бинарного пакета с простой в использовании системой сборки для легкого управления пакетами.

    Команды менеджера пакетов Arch Linux pacman

    Если вы только что установили Arch Linux, то непременно должны научиться использовать команды этого прекрасного менеджера.

    Как и другие менеджеры пакетов, Pacman может синхронизировать списки пакетов с репозиториями программного обеспечения, чтобы пользователь мог загружать и устанавливать пакеты с помощью простой команды, разрешая все необходимые зависимости.

    Синтаксис

    Опции

    pacman pacman [параметры] [файл(ы)] pacman [параметры] [пакет(ы)] pacman параметры] pacman [параметры] [пакет(ы)] pacman [параметры] [пакет(ы)] pacman [параметры]

    Использование Arch Linux Pacman с примерами

    Обновление пакетов

    Pacman предоставляет простой способ обновления дистрибутива Arch Linux. Все установленные пакеты можно обновить всего одной командой. Это может занять некоторое время в зависимости от того, насколько актуальна система.

    Следующая команда синхронизирует базы данных репозитория и обновляет системные пакеты, исключая локальные пакеты, которых нет в настроенных репозиториях:

    oleg@mobile:~:$ sudo pacman -Syu :: Обновление баз данных пакетов. core is up to date extra 1711,9 KiB 583 KiB/s 00:03 [###############################################] 100% community 6,7 MiB 1696 KiB/s 00:04 [###############################################] 100% multilib is up to date :: Запускается полное обновление системы. разрешение зависимостей. проверка конфликтов. Пакеты (14) cryptsetup-2.5.0-1 firefox-103.0.1-1 firefox-i18n-ru-103.0.1-1 harfbuzz-5.1.0-1 harfbuzz-icu-5.1.0-1 imagemagick-7.1.0.45-1 iptables-1:1.8.8-2 lib32-harfbuzz-5.1.0-1 lib32-libtiff-4.4.0-3 libtiff-4.4.0-3 linux-5.18.15.arch1-1 perl-libwww-6.67-1 wavpack-5.5.0-1 wine-staging-7.14-1 Будет загружено: 315,30 MiB Будет установлено: 958,47 MiB Изменение размера: 1,05 MiB :: Приступить к установке? [Y/n] 

    По сути, речь идет о синхронизации с центральным репозиторием (база данных основных пакетов), обновлении локальной копии базы данных основных пакетов, а затем выполнении обновления системы (путем обновления всех пакетов, для которых доступна более новая версия).

    Эта команда обязательно должна предварять команду, устанавливающую какой-либо программный пакет. Это крайне необходимо для сохранения устойчивости системы.

    Установка пакетов

    Вы можете с легкостью установить один или несколько пакетов с помощью команды pacman следующим образом:

    oleg@mobile:~:$ sudo pacman -S inkscape разрешение зависимостей. проверка конфликтов. Пакеты (10) cblas-3.10.1-1 graphicsmagick-1.3.38-3 gsl-2.7.1-1 gspell-1.10.0-2 gtest-1.12.1-1 lib2geom-1.2-1 python-lxml-4.9.1-1 python-numpy-1.23.1-1 ragel-6.10-3 inkscape-1.2.1-1 Будет загружено: 34,60 MiB Будет установлено: 228,47 MiB :: Приступить к установке? [Y/n] 

    Вам остаётся лишь решить: y или n.

    -S означает синхронизацию, то есть менеджер сначала синхронизируется.

    База данных менеджера разделяет установленные пакеты на две группы в зависимости от причины их установки:

    Явно-установленные Пакеты, которые были установлены общей командой pacman -S -U зависимости Пакеты, которые были установлены неявно, потому что требуются другим пакетом, который был установлен явно

    Не устанавливайте программные пакеты без предварительного обновления системы, так как это может привести к нарушению её устойчивости.

    Удаление установленного пакета

    oleg@mobile:~:$ sudo pacman -R smplayer проверка зависимостей. Пакеты (1) smplayer-22.7.0-1 Будет освобождено: 15,25 MiB :: Удалить эти пакеты? [Y/n]

    Все зависимости остаются не удалёнными.

    Для удаления пакета со всеми зависимостями команда выглядит так:

    oleg@mobile:~:$ sudo pacman -Rs smplayer проверка зависимостей. Пакеты (5) mpv-1:0.34.1-5 mujs-1.2.0-2 rubberband-3.0.0-2 uchardet-0.0.7-1 smplayer-22.7.0-1 Будет освобождено: 26,79 MiB :: Удалить эти пакеты? [Y/n] 

    Поиск пакетов

    Pacman запрашивает локальную базу данных пакетов с флагом -Q , базу данных синхронизации с флагом -S и базу данных файлов с флагом -F .

    Менеджер может искать пакеты в базе данных, как по именам пакетов, так и по описаниям:

    oleg@mobile:~:$ sudo pacman -Ss inkscape extra/inkscape 1.2.1-1 Professional vector graphics editor oleg@mobile:~:$ 

    Поиск уже установленных пакетов:

    oleg@mobile:~:$ sudo pacman -Qs smplayer local/smplayer 22.7.0-1 Media player with built-in codecs that can play virtually all video and audio formats oleg@mobile:~:$ 

    Поиск имён файлов пакетов в удалённых пакетах:

    Просмотр дерева зависимостей пакета:

    oleg@mobile:~:$ pactree smplayer smplayer ├─glibc │ ├─linux-api-headers>=4.10 │ ├─tzdata │ └─filesystem │ └─iana-etc ├─qt5-base │ ├─libjpeg-turbo │ │ └─glibc │ ├─xcb-util-keysyms │ │ └─libxcb>=1.7 │ │ ├─xcb-proto │ │ ├─libxdmcp │ │ │ └─glibc │ │ └─libxau │ │ └─glibc │ ├─xcb-util-renderutil │ │ └─libxcb>=1.7 │ ├─libglvnd provides libgl │ │ ├─libxext │ │ │ └─libx11 │ │ │ ├─libxcb │ │ │ └─xorgproto │ │ ├─mesa . │ │ ├─libsamplerate provides libsamplerate.so=0-64 │ │ └─libsndfile provides libsndfile.so=1-64 │ ├─rubberband provides librubberband.so=2-64 │ ├─shaderc │ ├─shaderc provides libshaderc_shared.so=1-64 │ ├─uchardet │ │ └─gcc-libs │ ├─vulkan-icd-loader │ ├─wayland │ ├─xdg-utils │ └─zlib ├─libx11 ├─zlib ├─gcc-libs └─hicolor-icon-theme oleg@mobile:~:$ 

    Очистка кеша пакетов

    Pacman хранит загруженные пакеты в /var/cache/pacman/pkg/ и не удаляет старые или неустановленные версии автоматически.

    Это имеет некоторые преимущества:

    • позволяет понизить версию пакета без необходимости получать предыдущую версию из других источников.
    • пакет, который был удален, можно легко переустановить прямо из папки кеша.

    Периодически очищайте кеш, чтобы папка не увеличивалась в размере.

    Для удаления всех кешированных пакетов, которые в данный момент не установлены, и неиспользуемую базу данных синхронизации, выполните:

    oleg@mobile:~:$ sudo pacman -Sc Оставить пакеты: Все локально установленные пакеты Каталог для кэша: /var/cache/pacman/pkg/ :: Удалить все остальные пакеты из кэша? [Y/n] y удаление старых пакетов из кэша. Каталог базы данных: /var/lib/pacman/ :: Удалить неиспользуемые репозитории? [Y/n] y удаление неиспользуемых репозиториев. oleg@mobile:~:$ 

    Для удаления всех файлов из кеша, дважды используйте переключатель очистки, это самый агрессивный подход, который ничего не оставит в папке кеша:

    Хорошо подумайте перед тем, как выполнять эту команду. Выполнить откат вы вероятнее всего не сможете и в случае ошибки работа системы будет нарушена.

    Установка локальных и сторонних пакетов

    Установка пакета, которого нет в официальном репозитории:

    $ sudo pacman -U http://www.example.com/repo/example.pkg.tar.xz

    Итоги

    Пакетный менеджер Pacman позволяет с легкостью работать с самым современным дистрибутивом Arch Linux. При разумном подходе он не менее устойчив остальных дистрибутивов Linux.

    Источник

Оцените статью
Adblock
detector