dpkg 명령어

기본 설명

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

dpkg 자체는 APT 등과 같은 고급 도구에 비해 낮은 레벨의 도구이며 복잡한 패키지 관계와 패키지를 원격에서 받아오는 등의 일을 합니다. APT도 Ubuntu의 소프트웨어를 관리하기 위해 내부적으로 이 dpkg를 사용합니다.

 

사용 방법

dpkg -l

: 설치된 패키지 목록 확인 (레드햇 계열 : rpm -qa 와 동일)

 

dpkg -L <패키지명>

: 해당 패키지로부터 설치된 모든 파일목록 확인 (레드햇 계열 : rpm -ql 과 동일)

 

dpkg -C <.deb 파일>

: 해당 .deb 파일이 설치한 파일의 목록 확인

 

dpkg -s <패키지명>

: 해당 패키지에 대한 정보 확인

 

dpkg -I <.deb 파일>

: 해당 .deb 파일에 대한 정보 확인

 

dpkg -S <파일명>

: 해당 파일명 또는 경로가 포함된 패키지들을 검색 (레드햇 계열 : rpm -qf 와 동일)

 

sudo dpkg -i <.deb 파일>

: 해당 파일 설치 또는 최신 버전으로 업그레이드

 

sudo dpkg -r <패키지명>

: 해당 패키지 삭제 (삭제시 설정파일들은 남겨둡니다.)

 

sudo dpkg -P <패키지명>

: 해당 패키지와 해당 패키지의 설정파일을 모두 삭제 (레드햇 계열 : rpm -e 와 동일)

 

sudo dpkg -x <.deb 파일> <디렉토리>

: 파일에 포함되어있는 파일들을 지정된 디렉토리에 압축 해제 (※ 이 명령을 실행할 경우, 해당 디렉토리를 초기화 시켜버리므로 주의해야 합니다!!!!!!!!)

 

 

참고 사이트

http://www.songtory.com/post/001003/1/245

 

http://snowdeer.github.io/linux/2018/02/03/ubuntu-16p04-manage-packages/

 

출처 : https://miiingo.tistory.com/183

'Works > Ubuntu' 카테고리의 다른 글

[명령어] apt remove vs purge 차이  (0) 2022.08.29

 

운영체제 : Ubuntu 18.04

DESCRIPTION

apt-get is the command-line tool for handling packages, and may be considered the user's "back-end" to other tools using the APT library. Several "front-end" interfaces exist, such as aptitude(8)synaptic(8) and wajig(1).

 

Unless the -h, or --help option is given, one of the commands below must be present.

remove

remove is identical to install except that packages are removed instead of installed. Note that removing a package leaves its configuration files on the system. If a plus sign is appended to the package name (with no intervening space), the identified package will be installed instead of removed.

purge

purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).

 

OPTIONS

--purge

Use purge instead of remove for anything that would be removed. An asterisk ("*") will be displayed next to packages which are scheduled to be purged. remove --purge is equivalent to the purge command. Configuration Item: APT::Get::Purge.
 
--auto-remove--autoremove
If the command is either install or remove, then this option acts like running the autoremove command, removing unused dependency packages. Configuration Item: APT::Get::AutomaticRemove.
 

apt 패키지 매니저에서 패키지 삭제 명령어 정리

 

패키지 삭제가 제대로 되지 않아 새롭게 설치하는 패키지에 문제가 생겨 명령어와 옵션에 대해 정리 해보도록 하겠습니다.

 

$ apt remove <패키지명>

패키지를 삭제한다. 하지만 설정파일은 남겨둔다.

$ apt purge <패키지명>

패키지를 삭제한다. 설정파일도 함께 삭제한다.

 

옵션

$ apt [any command] --purge <패키지명>

remove 대신 --purge 명령을 수행한다. remove --purge 는 purge 명령어와 같다,

$ apt remove --auto-remove <패키지명>

사용하지않는 관련된 패키지를 모두 삭제한다.


위는 공식 명령어 가이드와 간략한 해석입니다.

차이는 설정파일을 삭제하느냐 남겨 두느냐의 차이입니다.

 

하지만 purge명령어를 쓰더라도 모든 설정파일을 삭제하는 것은 아닙니다.

user'home 파일은 삭제하지 않습니다.

 

예를들면, /home 폴더 하위에 설정파일을 가지고 있는 어느 어플리케이션 (예를 들면, 크롬 , 파이어폭스 등등..)을 삭제할 때는 /home 디렉터리 내부의 설정파일들은 그대로 남아 있습니다.

 

 

처음에 remove와 remove --auto-remove <패키지명>를 이용해서 패키지를 삭제했는데, 새롭게 설치하는 패키지가 삭제한 패키지와 중첩이 되어 제대로 설치가 되지 않은 문제가 있었습니다.

 

VMware-Tools를 설치하는데 vm-open-tools가 기본적으로 Ubuntu18.04에 설치되어 있어서 먼저 vm-open-tools를 삭제하고 설치를 진행했습니다.

 

remove, --auto-remove 를 사용해 패키지를 지우고

VMware-Tools를 설치하려고하니 이미 open-vm-tools가 설치되어 있어 설치가 정상적으로 되지 않을 수 있다. --purge 옵션을 이용해서 삭제하라는 가이드가 있었습니다.

 

# apt purge open-vm-tools를 이용해 삭제하고 VMware-Tools를 삭제하니 정상적으로 설치, 동작하는 것을 확인하였습니다.

출처: https://gintrie.tistory.com/23 [gintire:티스토리]

'Works > Ubuntu' 카테고리의 다른 글

[Ubuntu] dpkg 명령어 사용법  (0) 2022.08.29