8장. 데비안 패키지 관리 도구

차례

8.1. 데비안은 패키지를 다루는 무슨 프로그램을 제공하나요?
8.1.1. dpkg
8.1.2. APT
8.1.3. aptitude
8.1.4. synaptic
8.1.5. tasksel
8.1.6. 다른 패키지 관리 도구
8.2. Debian claims to be able to update a running program; how is this accomplished?
8.3. How can I tell what packages are already installed on a Debian system?
8.4. How do I display the files of an installed package?
8.5. How can I find out what package produced a particular file?
8.6. Why is "foo-data" not removed when I uninstall "foo"? How do I make sure old unused library-packages get purged?

8.1. 데비안은 패키지를 다루는 무슨 프로그램을 제공하나요?

그래픽 또는 텍스트 기반 인터페이스부터 패키지 설치에 사용되는 로우 레벨 도구에 이르기까지 데비안 패키지를 관리하는 데 사용되는 여러 도구가 있습니다. 사용 가능한 모든 도구는 하위 레벨 도구에 의존하여 올바르게 작동하며, 여기에 복잡성 감소로 표시됩니다.

aptitude 또는 synaptic 같은 높은 수준 패키지 관리 도구는 그 자체가 시스템에서 패키지를 관리하려면 dpkg에 의존한다는 것을 이해하는 것이 중요합니다.

데비안 패키지 관리 유틸리티에 대한 자세한 내용을 보려면 데비안 참조제2장. 데비안 패키지 관리를 참조하십시오. 이 문서는 다양한 언어와 형식으로 제공됩니다. DDP 사용자 매뉴얼 안의 데비안 참조를 보십시오.

8.1.1. dpkg

이것은 주요 패키지 관리 프로그램입니다. dpkg를 여러 옵션으로 호출할 수 있습니다. 공통 용도:

  • 모든 옵션 찾기: dpkg --help.

  • 지정된 패키지에 대한 제어 파일(및 기타 정보)을 출력: dpkg --info foo_VVV-RRR.deb.

  • 하드 디스크의 파일 시스템에 패키지(패키지 풀기 및 구성 포함)를 설치: dpkg --install foo_VVV-RRR.deb.

  • 하드 디스크의 파일 시스템에 데비안 아카이브의 압축을 풉니다(configure 안 함): dpkg --unpack foo_VVV-RRR.deb. 이 명령이 반드시 패키지를 사용 가능한 상태로 남겨두는 것은 아닙니다: 일부 파일은 제대로 실행하려면 추가 사용자 지정이 필요할 수 있습니다. 이 명령은 프로그램의 이미 설치된 모든 버전을 제거하고 패키지와 관련된 preinst( 7.6절. “데비안 preinst, postinst, prerm, 그리고 postrm script 는 무엇인가요?” 참조) 스크립트를 실행합니다.

  • 이미 푼 패키지를 구성: dpkg --configure foo. 무엇보다 이 액션은 패키지 관련된 postinst ( 7.6절. “데비안 preinst, postinst, prerm, 그리고 postrm script 는 무엇인가요?” 참조)를 실행합니다. 이 패키지를 위해 conffiles 에 나열된 파일을 업데이트합니다. 주의하세요. 'configure' 연산은 그 패키지 이름 (e.g., foo)을 받습니다, 데비안 아카이브 파일 이름(e.g., foo_VVV-RRR.deb) 아님.

  • 데비안 아카이브에서 단일 파일 "blurf"(또는 "blurf*" 파일 그룹)을 추출: dpkg --fsys-tarfile foo_VVV-RRR.deb | tar -xf - 'blurf*'.

  • 패키지 제거 (설정 파일은 아님): dpkg --remove foo.

  • 패키지 제거 (설정 파일 포함): dpkg --purge foo.

  • 문자열(또는 정규식) "foo*"가 들어간 패키지의 설치 상태를 나열: dpkg --list 'foo*'.

8.1.2. APT

APT는 Advanced Package Tool, apt-get 프로그램을 제공하는 데비안 패키지 시스템에 대한 개선된 인터페이스입니다. 패키지 검색 및 관리, 패키지에 대한 정보 쿼리, libapt-pkg 라이브러리의 모든 기능에 대한 저수준 액세스를 위한 명령줄 도구를 제공합니다. 자세한 내용은 /usr/share/doc/apt-doc/guide.html/index.html 에 있는 사용자 가이드를 보세요.(apt-doc 패키지를 설치해야 될 겁니다)

데비안 Jessie를 시작으로 자주 사용되는 일부 apt-getapt-cache 명령은 새로운 apt 바이너리를 통해 동등한 명령을 제공합니다. 즉, apt-get update, apt-get install, apt-get remove, apt-cache search, 또는 apt-cache show 같은 일부 인기 있는 명령도 apt, 즉 apt update, apt install, apt remove, apt search, 또는 apt show를 통해 간단히 호출할 수 있습니다. 다음은 이전 명령과 새 명령에 대한 개요입니다:

 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는 여러 소스에서 명령줄을 사용하여 패키지를 검색하고 설치하는 단순한 방법을 제공합니다. dpkg와는 달리, apt-get은 .deb 파일을 인지하지 못하며, 패키지 이름과 함께 동작하며 /etc/apt/sources.list 에서 온 .deb 아카이브만 설치 가능합니다. apt-get은 .deb 아카이브[5]를 configure 된 소스에서 다운로드한 후 dpkg를 부릅니다.

apt-get 사용하는 일반적 방법 몇 가지:

  • 시스템에 알려진 패키지 목록을 업데이트하려면, 실행하기:

    apt update
    

    (패키지 목록을 업데이트하려면 이 작업을 정기적으로 실행해야 함)

  • foo 패키지와 그 종속을 설치하려면, 실행하기:

    apt install foo
    
  • 시스템에서 온 foo 패키지를 제거하려면, 실행하기:

    apt remove foo
    
  • 패키지 foo와 시스템에서 온 그 설정 파일을 제거하려면, 실행하기:

    apt purge foo
    
  • 새 버전이 가능한 패키지 나열하고 실행하기:

    apt list --upgradable
    
  • 시스템에 있는 모든 패키지 업그레이드(추가 패키지 설치 또는 패키지 제거 없이)하려면, 실행하기:

    apt upgrade
    
  • 시스템에 있는 모든 패키지 업그레이드, 패키지 업데이트 필요하면, 추가 패키지 설치 또는 패키지 제거 하려면 실행하기:

    apt full-upgrade
    

    (The command upgrade keeps a package at its installed obsolete version if upgrading would need an extra package to be installed, for a new dependency to be satisfied. The full-upgrade command is less conservative.)

Note that you must be logged in as root to perform any commands that modify packages.

Note that apt-get now also installs recommended packages as default, and thanks to its robustness it's the preferred program for package management from console to perform system installation and major system upgrades.

The apt tool suite also includes the apt-cache tool to query the package lists. You can use it to find packages providing specific functionality through simple text or regular expression queries and through queries of dependencies in the package management system. Some common ways to use apt-cache are:

  • To find packages whose description contain word:

    apt search word
    
  • To print the detailed information of a package:

    apt show package
    
  • To print the packages a given package depends on:

    apt-cache depends package
    
  • To print detailed information on the versions available for a package and the packages that reverse-depends on it:

    apt-cache showpkg package
    

For more information, install the apt package and read apt(8), apt-get(8), sources.list(5) and install the apt-doc package and read /usr/share/doc/apt-doc/guide.html/index.html.

8.1.3. aptitude

aptitude is a package manager for Debian GNU/Linux systems that provides a frontend to the apt package management infrastructure. aptitude is a text-based interface using the curses library. Actions may be performed from a visual interface or from the command-line.

aptitude can be used to perform management tasks in a fast and easy way. It allows the user to view the list of packages and to perform package management tasks such as installing, upgrading, and removing packages.

aptitude provides the functionality of apt-get, as well as many additional features:

  • aptitude offers easy access to all versions of a package.

  • aptitude makes it easy to keep track of obsolete software by listing it under "Obsolete and Locally Created Packages".

  • aptitude includes a fairly powerful system for searching particular packages and limiting the package display. Users familiar with mutt will pick up quickly, as mutt was the inspiration for the expression syntax.

  • aptitude can be used to install the predefined tasks available. For more information see 8.1.5절. “tasksel”.

  • aptitude in full screen mode has su functionality embedded and can be run by a normal user. It will call su (and ask for the root password, if any) when you really need administrative privileges.

You can use aptitude through a visual interface (simply run aptitude) or directly from the command line. The command line syntax used is very similar to the one used in apt-get. For example, to install the foo package, you can run aptitude install foo.

Note that aptitude is the preferred program for daily package management from the console.

For more information, read the manual page aptitude(8) and install the aptitude-doc package.

8.1.4. synaptic

synaptic은 그래픽 패키지 관리자입니다. 사용자에게 친숙한 방식으로 소프트웨어 패키지를 설치, 업그레이드 및 제거할 수 있습니다. 적성에 의해 제공되는 대부분의 기능과 함께 사용된 리포지토리 목록을 편집할 수 있는 기능도 있으며 패키지와 관련된 사용 가능한 모든 문서를 탐색할 수 있습니다. 자세한 내용은 Synaptic 웹사이트를 참조하십시오.

8.1.5. tasksel

특정 작업을 수행하려고 할 때 요구 사항을 충족하는 적절한 패키지 제품군을 찾는 것이 어려울 수 있습니다. 데비안 개발자는 tasks를 정의 했는데, task는 특정 활동과 관련된 여러 개별 데비안 패키지의 모음입니다. task는 tasksel 프로그램 또는 aptitude 를 통해 설치할 수 있습니다.

일반적으로 데비안 설치 프로그램은 표준 시스템 및 데스크톱 환경과 관련된 작업을 자동으로 설치합니다. 설치된 특정 데스크톱 환경은 사용되는 CD/DVD 미디어에 따라 달라지며, 가장 일반적으로 GNOME 데스크톱(gnome-desktop 태스크)입니다. 또한 설치 프로세스 전체에서 선택한 항목에 따라 시스템에 작업이 자동으로 설치될 수 있습니다. 예를 들어, 영어 이외의 언어를 선택한 경우 연결된 태스크도 자동으로 설치됩니다.

8.1.6. 다른 패키지 관리 도구

8.1.6.1. dpkg-deb

This program manipulates Debian archive (.deb) files. Some common uses are:

  • Find out all the options: dpkg-deb --help.

  • Determine what files are contained in a Debian archive file: dpkg-deb --contents foo_VVV-RRR.deb

  • Extract the files contained in a named Debian archive into a user specified directory: dpkg-deb --extract foo_VVV-RRR.deb tmp extracts each of the files in foo_VVV-RRR.deb into the directory tmp/. This is convenient for examining the contents of a package in a localized directory, without installing the package into the root file system.

  • Extract the control information files from a package: dpkg-deb --control foo_VVV-RRR.deb tmp.

Note that any packages that were merely unpacked using dpkg-deb --extract will be incorrectly installed, you should use dpkg --install instead.

More information is given in the manual page dpkg-deb(1).

8.2. Debian claims to be able to update a running program; how is this accomplished?

The kernel (file system) in Debian GNU/Linux systems supports replacing files even while they're being used.

We also provide a program called start-stop-daemon which is used to start daemons at boot time or to stop daemons when the runlevel is changed (e.g., from multi-user to single-user or to halt). The same program is used by installation scripts when a new package containing a daemon is installed, to stop running daemons, and restart them as necessary.

8.3. How can I tell what packages are already installed on a Debian system?

To learn the status of all the packages installed on a Debian system, execute the command

dpkg --list

This prints out a one-line summary for each package, giving a 2-letter status symbol (explained in the header), the package name, the version which is installed, and a brief description.

To learn the status of packages whose names match any pattern beginning with "foo", run the command:

dpkg --list 'foo*'

To get a more verbose report for a particular package, execute the command:

dpkg --status packagename

8.4. How do I display the files of an installed package?

To list all the files provided by the installed package foo execute the command

dpkg --listfiles foo

Note that the files created by the installation scripts aren't displayed.

8.5. How can I find out what package produced a particular file?

To identify the package that produced the file named foo execute either:

  • dpkg --search foo

    This searches for foo in installed packages. (This is (currently) equivalent to searching all of the files having the file extension of .list in the directory /var/lib/dpkg/info/, and adjusting the output to print the names of all the packages containing it, and diversions.)

    A faster alternative to this is the dlocate tool.

    dlocate -S foo
    
  • zgrep foo Contents-ARCH.gz

    This searches for files which contain the substring foo in their full path names. The files Contents-ARCH.gz (where ARCH represents the wanted architecture) reside in the major package directories (main, non-free, contrib) at a Debian archive site (i.e. under /debian/dists/bookworm). A Contents file refers only to the packages in the subdirectory tree where it resides. Therefore, a user might have to search more than one Contents files to find the package containing the file foo.

    This method has the advantage over dpkg --search in that it will find files in packages that are not currently installed on your system.

  • apt-file search foo

    If you install the apt-file package, similar to the above, it searches files which contain the substring or regular expression foo in their full path names. The advantage over the example above is that there is no need to retrieve the Contents-ARCH.gz files as it will do this automatically for all the sources defined in /etc/apt/sources.list when you run (as root) apt-file update.

8.6. Why is "foo-data" not removed when I uninstall "foo"? How do I make sure old unused library-packages get purged?

Some packages are split in program ("foo") and data ("foo-data") (or in "foo" and "foo-doc"). This is true for many games, multimedia applications and dictionaries in Debian and has been introduced since some users might want to access the raw data without installing the program or because the program can be run without the data itself, making "foo-data" optional.

Similar situations occur when dealing with libraries: generally these get installed since packages containing applications depend on them. When the application-package is purged, the library-package might stay on the system. Or: when the application-package no longer depends upon e.g. libdb4.2, but upon libdb4.3, the libdb4.2 package might stay when the application-package is upgraded.

In these cases, "foo-data" doesn't depend on "foo", so when you remove the "foo" package it will not get automatically removed by most package management tools. The same holds true for the library packages. This is necessary to avoid circular dependencies. However, if you use apt-get (see 8.1.2절. “APT”) or aptitude (see 8.1.3절. “aptitude”) as your package management tool, they will track automatically installed packages and give the possibility to remove them, when no packages making use of them remain in your system.



[5] Red Hat 패키지 매니저와 같은 다른 패키지 관리 시스템에서 이 도구를 사용할 수 있도록 하는 포트도 있으며, 이는 rpm으로도 알려져 있습니다