Linux extract deb file

Глава 8. Инструменты управления пакетами Debian

8.1. Какие программы для управления пакетами имеются в Debian?

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

Важно понимать, что высокоуровневые инструменты управления пакетами, такие как aptitude или synaptic , для управления пакетами используют apt , который, в свою очередь, использует dpkg для управления пакетами системы.

See Chapter 2. Debian package management of the Debian reference for more information about the Debian package management utilities. This document is available in various languages and formats, see the Debian Reference entry in the DDP Users’ Manuals overview.

8.1.1. dpkg

Это основная программа управления пакетами. dpkg может вызываться с многими параметрами. Наиболее часто используемые из них:

  • Показать список всех параметров: dpkg —help
  • Показать управляющий файл (и другую информацию) для указанного пакета: dpkg —info foo_VVV-RRR.deb
  • Установить пакет на жёсткий диск (т. е. распаковать и настроить): dpkg —install foo_VVV-RRR.deb
  • Распаковать архив Debian на жёсткий диск (но не настраивать): dpkg —unpack foo_VVV-RRR.deb . Учтите, что в результате данной операции пакет не обязан быть в рабочем состоянии; для правильной работы может потребоваться внесение изменений в некоторые файлы. Данная команда удаляет любую ранее установленную версию программы и запускает сценарий preinst указанного пакета (см. Раздел 7.6, «Зачем нужны сценарии preinst, postinst, prerm и postrm?»).
  • Настроить пакет, который был распакован ранее: dpkg —configure foo . Кроме всего прочего, эта команда запускает сценарий postinst указанного пакета (см. Раздел 7.6, «Зачем нужны сценарии preinst, postinst, prerm и postrm?»). Она также обновляет файлы, перечисленные в conffiles . Обратите внимание, что в качестве аргумента для параметра configure указывается имя пакета (т. е. foo), а не имя файла-архива Debian (т. е. foo_VVV-RRR.deb).
  • Распаковать файл с именем «blurf» (или группу файлов с именем «blurf*») из архива Debian: dpkg —fsys-tarfile foo_VVV-RRR.deb | tar -xf — ‘blurf*’
  • Удалить пакет (но не его файлы настроек): dpkg —remove foo
  • Удалить пакет (вместе с файлами настроек): dpkg —purge foo
  • Вывести состояние установки пакетов, содержащих в имени строку (или регулярное выражение) «foo*»: dpkg —list ‘foo*’
Читайте также:  Yersinia kali linux пример

8.1.2. APT

APT is the Advanced Package Tool , an advanced interface to the Debian packaging system which provides the apt-get program. It provides commandline tools for searching and managing packages, and for querying information about them, as well as low-level access to all features of the libapt-pkg library. For more information, see the User’s Guide in /usr/share/doc/apt-doc/guide.html/index.html (you will have to install the apt-doc package).

Starting with Debian Jessie, some frequently used apt-get and apt-cache commands have an equivalent via the new apt binary. This means some popular commands like apt-get update , apt-get install , apt-get remove , apt-cache search , or apt-cache show now can also be called simply via apt , say apt update , apt install , apt remove , apt search , or apt show . The following is an overview of the old and new commands:

apt-get update -> apt update apt-get upgrade -> apt upgrade apt-get dist-upgrade -> apt full-upgrade apt-get install package -> apt install package apt-get remove package -> apt remove package apt-get autoremove -> apt autoremove apt-cache search string -> apt search string apt-cache policy package -> apt list -a package apt-cache show package -> apt show package apt-cache showpkg package -> apt show -a package

Инструмент apt совмещает функциональность apt-get и apt-cache, а также по умолчанию использует красивый цветной формат вывода, что очень удобно. Для использования в сценариях или для продвинутого использования предпочтительнее использовать apt-get (а иногда он просто необходим).

apt-get provides a simple way to retrieve and install packages from multiple sources using the command line. Unlike dpkg , apt-get does not understand .deb files, it works with the packages proper name and can only install .deb archives from a source specified in /etc/apt/sources.list . apt-get will call dpkg directly after downloading the .deb archives [5] from the configured sources.

Часто используемые команды apt-get :

Источник

How to Extract Files from a DEB Package in Debian Systems

Have you ever wondered how you can extract individual files from a Debian file (.deb) without actually installing any software?

In this guide, we will walk you through how you can do so using the ar and dpkg-deb command line utilities.

The Architecture of a .DEB File

A binary package (.deb) consists of the following salient files:

  • debian-binary – This is a text file that indicates the version of the .deb package format.
  • control.tar.gz – This is a compressed file that contains metadata about the Debian package. It has 3 files – the md5sums file, the control file that contains file metadata, and the postinst script file.
  • data.tar.xz – A compressed file comprising all the files that will be installed on your system.
Читайте также:  Minimal linux with docker

Extracting Files From a Deb Package Using ar Command

The ar command is a utility that creates, modifies, and extracts files from their archives. An archive is basically a file that comprises multiple individual files which collectively make up a single file.

To demonstrate how you can extract files, we have downloaded a skype .deb installation file using the following wget command:

$ wget https://go.skype.com/skypeforlinux-64.deb

The ls command below confirms the existence of the .deb

Check Debian Package File

To extract the contents of the Skype Debian package, run the following ar command. The x option extracts the contents of the file while the v option displays the files extracted on the terminal.

Once extracted, you can list the files using the good old ls command as shown.

You will see the control and data archives alongside the Debian-binary file which contains the metadata of the Debian file.

Extract Deb Files in Linux

Extract Deb Package Files Using dkpg-deb Command

The dpkg-deb command is yet another utility that you can use to extract a Debian file. To extract the Skype Debian file, run the following command:

$ sudo dpkg-deb -x skypeforlinux-64.deb data

Once again, you can use the ls command to list the extracted files. Here you can see that all the files are organized into opt and usr directories.

Extract Deb Package Files in Linux

To get a better view of the extracted files, list the contents of the directory in a tree format, run:

Linux Directory Tree Listing

Conclusion

That concludes this guide on how to extract files from a .deb package without actually installing the software that comes bundled with the package. We hope that you found this helpful. Your feedback will be appreciated.

Источник

How to Extract / Decompress .deb file in Ubuntu 20.04/22.04 [Graphical & Command Line]

Got a .deb file and want to extract or decompress it? Here’s how to do the trick in Ubuntu, Debian and other Linux in different ways.

DEB file:

The file with .deb extension is an installer package for Debian and Ubuntu based systems. Similar to EXE file for Windows, DEB is a commonly used method to install apps in Ubuntu/Debian Linux.

Sometimes user might need to extract a file from deb, or edit the scripts in a third-party deb that are built incorrectly. And, here’s how to extract / decompress the package in both graphical and command line ways.

Method 1: Extract DEB with System Archive Manager:

The system archive manager in most of today’s Linux desktops has the ability to extract .deb files.

Firstly, right-click on the file in file manager and click on “Open With Other Application” option. Next, select ‘Archive Manager‘ to open it in pop-up dialog.

Читайте также:  Windows или linux популярность

When the deb opens in Archive Manager, you’ll mostly see the following 3 files:

While debian-binary stores the version of deb package format, data.tar.xz contains all the files to be installed on system. And, control.tar.gz includes the ‘control’ file with basic package information and list of dependency packages. As well, it may have ‘ pre-install ‘ and ‘ post-install ‘ scripts that run automatically during the installation process.

And, here you just need to choose the content you need, and click on ‘Extract’ button. Then browser and use them in file manager.

Method 2: Decompress & Re-pack DEB via dpkg-deb command:

dpkg-deb is the command line manipulation tool for .deb file. It’s a good choice to decompress and re-pack the package, as the previous method might NOT work sometimes.

Firstly, open a ‘terminal’ window (or connect to server console) from start menu. When it opens, run commands below as need:

NOTE: using dpkg-deb will mess up file permission and ownership on file extraction! If you want to re-pack them into DEB again, use ‘fakeroot’ to run the commands below as script or try Method 3.

    Navigate to the folder that contains the deb file via cd command. For example, go to ‘Downloads’ folder by running command:

dpkg-deb -R filename.deb tmp

And, to repack them from tmp folder into a new DEB package, use command:

dpkg-deb -b tmp new_file.deb

Method 3: use ar command to do decompress and re-package process:

ar is a command line tool to create, modify, and extract from archives. User may use ar command to handle DEB file without worrying about permission and ownership. And, ar is available NOT only in Ubuntu/Debian Linux, but also CentOS, Rocky Linux, and other Linux.

Open terminal (or connect to command console) and go to the directory that contains the DEB package. Then do commands below to extract ‘control.tar.gz’ and repack it.

NOTE: A deb package may contain either ‘control.tar.gz‘ or ‘control.tar.xz‘, use the commands below accordingly.

    Create and go to ‘tmp’ folder:

ar p ../filename.deb control.tar.xz | tar -xJ
ar p ../filename.deb control.tar.gz | tar -xz
cp ../filename.deb ../new_file.deb
ar r ../new_file.deb control.tar.xz
ar r ../new_file.deb control.tar.gz

Summary:

For desktop PC, the system Archive Manager can extract a .deb package in most time. Besides, dpkg-deb command is available to decompress all files and re-pack them, though ‘fakeroot’ is required to avoid permission and ownership issue! As well, ar is a good choice to extract and repack control archive without worrying about permission and ownership issue.

Источник

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