Dpkg linux установка пакета

Часто используемые команды dpkg

Операционная система Debian Linux, является прародителем для целого ряда различных дистрибутивов linux, таких как Knoppix, Kali, Ubuntu, Mint, и т.д. Дистрибутивы linux на базе Debian, используют различные инструменты для работы с пакетами, такие как: dpkg, apt, aptitude, synaptic, tasksel, deselect, dpkg-deb и dpkg-split. Коротко о каждом из них:

  • AptAdvanced Package Tool. Данный инструмент работает с deb архивами из источников, указанных в файле конфигурации /etc/apt/sources.list.

1. Dpkg, установка пакета

# dpkg -i flashpluginnonfree_2.8.2+squeeze1_i386.deb Selecting previously unselected package flashplugin-nonfree. (Reading database . 465729 files and directories currently installed.) Unpacking flashplugin-nonfree (from flashplugin-nonfree_3.2_i386.deb) . Setting up flashplugin-nonfree (1:3.2) . .

2. Dpkg, список установленных пакетов

# dpkg -l Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Desc . +++-=============================================-==================== . ii acpi 1.6-1 amd64 displays information . ii acpi-support-base 0.140-5+deb7u3 all scripts for handling . ii acpid 1:2.0.16-1+deb7u1 amd64 Advanced Configurati .
# dpkg -l nginx Desired=Unknown/Install/Remove/Purge/Hold | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) ||/ Name Version Architecture Desc . +++-=============================================-==================== . ii nginx 1.8.0-1~wheezy amd64 high performance .

3. Dpkg, удалить пакет

Для удаления .deb пакета используется ключ -r (remove) с указанием имени пакета, например «flashpluginnonfree«, полное название «flashplugin-nonfree_3.2_i386.deb«, указывать не обязательно.

# dpkg -r flashpluginnonfree (Reading database . 142891 files and directories currently installed.) Removing flashpluginnonfree . Processing triggers for man-db . Processing triggers for menu . .

Ключ -r позволяет удалить только сам пакет, что-бы удалить пакет вместе с файлами конфигурации, вместо -r, используйте ключ -P (purge):

# dpkg -P flashpluginnonfree

4. Dpkg, посмотр содержимого пакета

# dpkg -c flashplugin-nonfree_3.2_i386.deb drwxr-xr-x root/root 0 2012-12-14 22:54 ./ drwxr-xr-x root/root 0 2012-12-14 22:54 ./usr/ drwxr-xr-x root/root 0 2012-12-14 22:54 ./usr/bin/ drwxr-xr-x root/root 0 2012-12-14 22:54 ./usr/lib/ .

5. Dpkg, проверить, установлен пакет или нет

# dpkg -s flashplugin-nonfree Package: flashplugin-nonfree Status: install ok installed Priority: optional .

6. Dpkg, куда установлены файлы пакета

# dpkg -L mysql-common /. /usr /usr/share /usr/share/doc .

7. Dpkg, установить все пакеты из конкретной директории

Что-бы рекурсивно обойти указанную директорию и ее поддиректории, устанавливая все файлы *.deb, используйте ключи -R и —install. Следующая команда установит все *.deb файлы из директории debpackages:

# dpkg -R --install debpackages/ (Reading database . 465836 files and directories currently installed.) Preparing to replace flashplugin-nonfree 1:3.2 (using . /flashplugin-nonfree_3.2_i386.deb) . Unpacking replacement flashplugin-nonfree . Setting up flashplugin-nonfree (1:3.2) . .

8. Dpkg, распаковать пакет, не конфигурируя его

Для распаковки пакета используется опция —unpack, при этом не будет выполняться конфигурирование или установка:

# dpkg --unpack flashplugin-nonfree_3.2_i386.deb

9. Dpkg, конфигурирование распакованного пакета

# dpkg --configure flashplugin-nonfree Setting up flashplugin-nonfree (1:3.2) .

10. Dpkg, обновить информации о доступности пакета

Опция —update-avail обновляет устаревшую информацию о доступности пакета в файле пакетов:

# dpkg –-update-avail package_name

11. Dpkg, удаление информации о доступности пакетов

12. Dpkg, забыть удаленные и неиспользуемые пакеты

13. Лицензия dpkg

14. Версия dpkg

# dpkg --version Debian `dpkg' package management program version 1.16.16 (amd64). This is free software; see the GNU General Public License version 2 or later for copying conditions. There is NO warranty.

15. Получение краткой справки

Источник

Читайте также:  Invalid signature detected check secure boot policy in setup при установке linux

How to Use Dpkg Install

In Debian and its derivates like Ubuntu and Linux Mint, the dpkg package manager is used for managing the packages. Dpkg, which is installed by default on the Debian and its derivatives can be used to install, build, and remove .deb packages. In this article, you will learn how to use dpkg install in Ubuntu system.

  • View List of Installed Packages
  • Install .deb package using dpkg
  • Verify package installation using dpkg
  • Remove installed package using dpkg

We have performed the procedure mentioned in this article on the Ubuntu 20.04 system. Moreover, we have used the command line Terminal application for running the commands in Ubuntu. To open the Terminal, you can use the Ctrl+Alt+T keyboard shortcut.

Note that for installing the .deb package in your Ubuntu system, you must be root user or the normal user with sudo privileges.

View List of Installed Packages

Before installing a new package, you might want to list the installed packages on your system. To do so, use the dpkg command with –list or –l option as follows:

It will show you a long list of installed packages on your system.

Install .deb Package Using Dpkg

Installing a .deb package using the dpkg command is quite simple. Simply type dpkg followed by –install or –i option and the .deb file name.

Make sure you run the above command from the same directory where the .deb package resides. Alternatively, if you are running the above command from some other directory, mention the full path to .deb file as follows:

Читайте также:  Root privileges are required astra linux

The dpkg command installs the specified package only without any dependencies. In case, you are installing a package which requires some dependencies, you will receive an error like this:

Also, the dpkg will not install the package and will leave it in an unconfigurable and broken state.

To resolve this error, run the following command in Terminal:

This command will fix the broken package and install the required dependencies assuming they are available in the system repository.

Verify Package Installation Using Dpkg

Although you can verify the package installation by searching it through the Ubuntu dash menu. If it is available there, that verifies the package is installed.

However, the dpkg also allows you to verify the package installation. Simply type dpkg with –status or –s option to verify the package installation:

Remove Installed Package Using Dpkg

Once you no longer need an installed package, you can remove it using the dpkg command. For removing an installed package, you will need to mention the installed package name instead of mentioning the .deb package name that was used to install the package.

To find out the exact package name, you can use the following command with any keyword related to the package name:

In the case of Skype package, you can simply type skype:

Once you have found the exact name of the installed package, you can remove it using the following syntax using the –remove or –r option:

You can see that instead of typing the “skypeforlinux-64.deb”, we have simply typed the Skype installed package name.

Читайте также:  Macs fan control linux

In this article, you have learned how to install a .deb package using the dpkg command in the Ubuntu 20.04 system. You have also learned how to view a list of installed packages, verify the package after installation, and remove a package when you no longer need it. I hope you liked the article!

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.

Источник

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