Skip to content

Dpkg

dpkg는 데비안 패키지 관리 시스템의 기초가 되는 소프트웨어이다. dpkg 명령어가 .deb 패키지의 설치, 삭제, 정보 제공을 위해 사용된다.

dpkg 그 자체는 저레벨의 도구이며, APT와 같은 고급 도구들이 복잡한 패키지 관계와 패키지를 원격에서 받아오는 등의 일을 한다. 앱티튜드 (Aptitude), 시냅틱 (Synaptic) 등이 dpkg 자체보다 많이 쓰이는데, 패키지 의존성을 다루는 더 많은 방법과 더 이해하기 편한 인터페이스를 갖고 있기 때문이다.

데비안 패키지 "dpkg"는 dpkg 프로그램과 더불어 패키징 시스템이 작동하게 하는 dpkg-statoverride, dpkg-divert, dpkg-trigger and update-alternatives 외의 몇몇 프로그램을 설치한다. dpkg는 start-stop-daemon, install-info와 같은 프로그램을 설치하며, install-info는 일반적으로 하위 호환성을 위해 남겨진다. (현재는 별도로 개발, 배포된다.) 데비안 패키지 "dpkg-dev"는 아래에 설명된 다양한 도구들을 포함하고 있다.

Categories

dpkg list status

The first column of the dpkg -list corresponds to the status of a package. How to interpret this status.

Status of every package is represented by three characters xxx

First character: The possible value for the first character. The first character signifies the desired state, like we (or some user) is marking the package for installation

  • u: Unknown (an unknown state)
  • i: Install (marked for installation)
  • r: Remove (marked for removal)
  • p: Purge (marked for purging)
  • h: Hold

Second Character: The second character signifies the current state, whether it is installed or not. The possible values are

  • n: Not- The package is not installed
  • i: Inst – The package is successfully installed
  • c: Cfg-files – Configuration files are present
  • u: Unpacked- The package is stilled unpacked
  • f: Failed-cfg- Failed to remove configuration files
  • h: Half-inst- The package is only partially installed
  • W: trig-aWait
  • t: Trig-pend

Third Character: This corresponds to the error state. The possible value include

  • R: Reinst-required The package must be installed.

How to create package

debconf 항목 참조.

Example

dpkg를 사용한 예제를 알래와 같이 정리한다.

  • dpkg -i [.deb파일]: 주어진 파일을 설치한다.
  • dpkg -r [패키지명]: 시스템에서 해당 패키지를 삭제한다. (단, 삭제시 파일들은 남겨둔다.)
  • dpkg -P [패키지명]: 해당 패키지와 해당 패키지의 설정파일을 모두 삭제한다.
  • dpkg -x [.deb파일] [디랙토리]: 파일에 포함되어있는 파일들을 지정된 디렉토리에 풀어놓는다. 단, 주의 할점은 이명령시 해당 디렉토리를 초기화 한다.
  • dpkg -l: List packages concisely.
  • dpkg -l [패키지명]: 패키지 상세정보. 이름, 버전, 종속성 등이 출력된다.
dpkg --get-selections
패키지 목록 출력.
출력 상태는 #Package selection states항목에서 확인.
`dpkg --get-selections | grep -P '(?
설치된 전체 패키지 목록 출력. 단, 패키지의 아키텍처가 포함된다. (e.g. mesa-va-drivers:amd64)
출력 상태는 #Package selection states항목에서 확인.
`dpkg --get-selections | grep -P '(?
설치된 전체 패키지 목록 출력. 아키텍처를 제외한 패키지 이름만 출력된다.
dpkg --clear-selections
Set the requested state of every non-essential package to deinstall (since dpkg 1.13.18).
This is intended to be used immediately before --set-selections, to deinstall any packages not in list given to --set-selections.
dpkg --search filename-search-pattern..., dpkg -S filename-search-pattern...
Search for a filename from installed packages.
파일 경로를 입력하여 해당 파일이 어떤 패키지를 통해 설치되었는지 확인해 준다.

Package selection states

dpkg --get-selections명령을 사용하면 다음과 같이 출력된다.

linux-modules-extra-5.13.0-48-generic           install
linux-modules-extra-5.13.0-51-generic           install
linux-modules-extra-5.8.0-43-generic            deinstall
linux-modules-extra-5.8.0-59-generic            deinstall
linux-modules-extra-5.8.0-63-generic            deinstall
linux-sound-base                                install
mesa-va-drivers:amd64                           install
mesa-va-drivers:i386                            install
memtest86+                                      install
mesa-common-dev:amd64                           install
mesa-utils                                      install
mesa-va-drivers:amd64                           install
mesa-va-drivers:i386                            install
metacity-common                                 install
microsoft-edge-stable                           install
mime-support                                    install
install
The package is selected for installation.
hold
A package marked to be on hold is kept on the same version, that is, no automatic new installs, upgrades or removals will be performed on them, unless these actions are requested explicitly, or are permitted to be done automatically with the --force-hold option.
deinstall
설정 파일을 제외하고 제거된 패키지. 1
purge
The package is selected to be purged (i.e. we want to remove everything from system directories, even configuration files).
unknown
The package selection is unknown. A package that is also in a not-installed state, and with an ok flag will be forgotten in the next database store.

Linux Package management systems

Linux package management systems

dpkg

APT (Synaptic, Ubuntu Software Center, KPackage, Adept Manager), aptitude, dselect

RPM

APT-RPM, up2date, urpmi (Rpmdrake), ZYpp, YUM, DNF

Others

Pacman, ipkg, opkg, PPM, Upkg, PISI, Conary, Portage, Entropy, slapt-get, slackpkg, netpkg, swaret

Front-ends

PackageKit (GNOME Software, Apper), Autopackage, klik, Listaller, Zero Install

Related topics

AppData, AppStream, Application Packaging, Package format

See also

Favorite site

References


  1. 원문: The package is selected for deinstallation (i.e. we want to remove all files, except configuration files).