Raspberry Pi_Kor_17.2.2 package 관리도구 – dpkg

Published Book on Amazon

All of IOT

Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 1

All of IOT

Starting with the Latest Raspberry Pi from Beginner to Advanced – Volume 2

출판된 한글판 도서

최신 라즈베리파이(Raspberry Pi)로 시작하는 사

물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (상)

최신 라즈베리파이(Raspberry Pi)로 시작하는 사

물인터넷(IOT)의 모든 것 – 초보에서 고급까지 (하)

Original Book Contents

17.2.2  package 관리도구 – dpkg


"dpkg" 도구는 Debianpackage management system에 기반을 두고 있는 software로서, ".deb" packages를 설치하거나 삭제하고, package에 대한 정보를 제공하는 용도로 사용된다.


"dpkg" package "dpkg" program뿐만 아니라 "dpkg-deb", "dpkg-split", "dpkg-query", "dpkg-statoverride", "dpkg-divert", "dpkg-trigger"와 같이 packaging system을 실제로 작동시키는데 필요한 여러 가지 프로그램들이 함께 포함되어 있다.  


"dpkg" 자체는 low level 도구이며, 모든 명령을 text 형식으로 입력하는 CLI 방식으로 실행된다. 통상 "APT", "aptitude", "synaptic"와 같은 보다 상위 도구를 사용하여 원격에서 package fetch하기도 하고, 복잡한 package의 상호관계를 처리한다.


"dpkg" 도구를 사용하여 package를 관리할 때는 "dpkg" 명령을 사용한다. 이 명령을 실행하면 지정 action option에 따라서 내부적으로는 "dpkg-deb", "dpkg-query"와 같은 내부 명령들이 실행되도록 되어 있다.


이 명령은 다음과 같이 action option을 지정하는 형식으로 되어 있다.


[명령 형식]

dpkg  [option...]  action


[명령 개요]

    시스템의 package를 관리해 준다.

    user 권한    -- 일반 user.


[상세 설명]

    "dpkg"는 한번에 하나의 action을 지정하도록 되어 있고, 필요하면 option을 지정할 수 있다.


[주요 option]


-i, --install package-file...

Install  the  package.  If  --recursive  or -R option is specified, package-file must refer to a directory instead.

--unpack package-file...

Unpack  the  package,  but don't configure it. If --recursive or R option  is  specified,  package-file  must  refer  to  a  directory instead.

--configure package...|-a|--pending


Configure a package which has been unpacked but not yet configured.

If -a or --pending is given instead of package, all unpacked but unconfigured packages are configured.

-r, --remove package...|-a|--pending

Remove an installed package. This removes everything  except conffiles,  which may avoid having to reconfigure the package if it is reinstalled later  (conffiles are configuration files that are listed in  the DEBIAN/conffiles control file).  If -a or pending is given instead of a package name, then all packages unpacked, but marked to be removed in file /var/lib/dpkg/status, are removed.

-P, --purge package...|-a|--pending


Purge  an installed or already removed package. This removes everything, including conffiles.  If -a or --pending is given instead of a  package  name, then all packages unpacked or removed, but marked to be purged in file /var/lib/dpkg/status, are purged.

-V, --verify [package-name...]


Verifies  the integrity of package-name or all packages if omitted, by comparing information from the files installed by a package with the  files  metadata  information  stored in the dpkg database. The origin of the files metadata information in  the  database  is  the binary packages themselves. That metadata gets collected at package unpack time during the installation process.



    "dpkg-query" 관련 action

-l, --list package-name-pattern...

List packages matching given pattern.


The first three columns of the output show the desired action, the package status, and errors, in that order.

Desired action:

           u = Unknown

           i = Install

           h = Hold

           r = Remove

           p = Purge

Package status:

           n = Not-installed

           c = Config-files

           H = Half-installed

           U = Unpacked

           F = Half-configured

           W = Triggers-awaiting

           t = Triggers-pending

           i = Installed

Error flags:

           <empty> = (none)

           R = Reinst-required

-s, --status package-name...

Report status of specified package.


-L, --listfiles package-name...

List files installed to your system from package-name.


-S, --search filename-search-pattern...

Search for a filename from installed packages.


-p, --print-avail package-name...

Display details about package-name, as found in /var/lib/dpkg/available. Users of APT-based frontends should use apt-cache show package-name instead.



    "dpkg-deb" 관련 action

-b, --build directory [archive|directory]

Build a deb package.

-c, --contents archive

List contents of a deb package.

-e, --control filename [directory]

Extract control-information from a package.

-x, --extract archive directory

Extract the files contained by package.

-X, --vextract archive directory

Extract and display the filenames contained by a package.

-f, --field  archive [control-field...]

Display control field(s) of a package.

--fsys-tarfile archive

Display the filesystem tar-file contained by a Debian package.


-I, --info archive [control-file...]

Show information about a package.



-B, --auto-deconfigure

When a package is removed, there  is  a  possibility  that  another installed  package depended on the removed package. Specifying this option will cause automatic deconfiguration of  the  package  which depended on the removed package.


Ignore dependency-checking for specified packages (actually, checking is performed, but only  warnings  about  conflicts  are  given, nothing else).



Change default administrative directory, which contains many  files that  give  information  about  status  of installed or uninstalled packages, etc.  (Defaults to /var/lib/dpkg)



Change default installation directory which refers to the directory where  packages  are to be installed. instdir is also the directory passed to chroot(2) before running package's installation  scripts, which  means  that  the  scripts  see  instdir as a root directory.  (Defaults to /)


Leave a Reply