통합 검색

통합 검색

[Ubuntu 18.04] apt 명령어 정리
  • 작성자 관리자
  • 조회수 31
2024-06-28 18:48:50



안녕하세요, 닷홈입니다!

오늘은 Ubuntuapt 명령어를 통하여 패키지 설치, 삭제, 업그레이드하는 명령어를 알아보겠습니다.



작업 환경 : Ubuntu 18.04


[  apt 명령어  ]


Ubuntu에서 패키지를 관리하는 명령어 중 가장 널리 쓰이는 명령어는 바로 apt 입니다.

우선 update는 설치 가능한 패키지 리스트를 최신화하는 명령어 입니다. CentOS와 비슷합니다. ( CentOS의 경우 : ​yum update )


ubuntu@dothome:~$ apt update
Hit:1 http://kr.archive.ubuntu.com/ubuntu bionic InRelease
Get:2 http://kr.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]
Get:3 http://kr.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]
Get:4 http://kr.archive.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]
Fetched 252 kB in 3s (74.3 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
71 packages can be upgraded. Run 'apt list --upgradable' to see them.


그리고 실제 패키지 업그레이드는 upgrade명령어를 사용합니다.

맨 밑의 계속할거냐는 질문에 y를 입력하고 Enter를하면 업그레이드가 시작됩니다.


ubuntu@dothome:~$ apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
.............................................................
.............................................................
70 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 15.7 MB/83.2 MB of archives.
After this operation, 355 MB of additional disk space will be used.
Do you want to continue? [Y/n]


이어서, 설치명령어를 알아보기전에 aptapt-get의 차이점을 짚어보자면 아래와 같습니다.


aptapt-get의 차이점은 거의 없으나, apt-get더 많은 옵션을 제공합니다.

기존에 써오던 명령어는 apt-get이며, apt는 2016년부터 쓰이기 시작했습니다.


ubuntu@dothome:~$ apt-get install abc

ubuntu@dothome:~$ apt install abc



abc라는 패키지를 설치한다고 가정한다면 위와 같이 둘 다 사용가능한 점 참고하시면 될 것 같네요!


반대로 삭제할때 사용되는 명령어 또한 두가지가 있습니다. 바로 removepurge인데요, 이 둘의 차이점은



remove는 설정파일을 빼고 패키지 삭제, purge는 설정파일까지 모두 삭제할때 사용합니다.


ubuntu@dothome:~$ apt remove abc

ubuntu@dothome:~$ apt purge abc


설정파일은 남겨두어야 할 때, 혹은 모두 삭제하고 새로 설치해야 할 때 각각 알맞게 사용할 수 있다는 장점이 있을 수 있겠습니다!


또한, 패키기의 정보를 출력하여 보기 위해서는 search​ 를 함께 사용합니다. (실제로는 존재하지않는 adc 라는 패키지를 예로 들었습니다.)

ubuntu@dothome:~$ apt search abc
Sorting... Done
Full Text Search... Done
abc/bionic-updates,now 23.1-1ubuntu0.1 amd64 [installed]
utilities that use the proc file system


위와같이, 아래에 버전 정보설치여부, 패키지에 관한 간단한 설명을 알아보기 쉽게 출력하여 볼 수 있습니다.


이에 더하여, 특정 패키지에 대한 상세한 정보를 출력시켜 보고싶다면 show 명령어와 함께 사용할 수 있습니다.


ubuntu@dothome:~$ apt show abc
Package: abc
Version: 23.1-1ubuntu0.1
Priority: standard
Section: admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Craig Small <csmall@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 266 kB
Depends: libc6 (>= 2.14), libselinux1 (>= 1.32), libtinfo5 (>= 6)
Replaces: procps (<< 1:1.2)
Homepage: http://abc.sf.net/
Task: standard
Supported: 5y
Download-Size: 52.5 kB
APT-Manual-Installed: yes
APT-Sources: http://kr.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
Description: utilities that use the proc file system
This package contains miscellaneous utilities that use the proc FS:
.
- fuser: identifies processes that are using files or sockets.
- killall: kills processes by name (e.g. "killall -HUP named").
- peekfd: shows the data traveling over a file descriptor.
- pstree: shows currently running processes as a tree.
- prtstat: print the contents of /proc/<pid>/stat
N: There is 1 additional record. Please use the '-a' switch to see it


그 밖에 쓰이는 apt명령어들은 아래를 참고해주세요!



apt 명령기존 apt-get 명령설명
apt install 패키지명
apt-get install 패키지명패키지 설치
apt remove패키지명apt-get remove패키지명
패키지 삭제
apt purge패키지명
apt-get purge패키지명
패키지 & 설정파일 모두 삭제
apt update
apt-get update
설치 가능 패키지 리스트 최신화
apt upgrade
apt-get upgrade
패키지 업그레이드
apt full-upgrade
apt-get dist-upgrade
의존성 패키지 업그레이드
apt autoremove패키지명
apt-get autoremove패키지명
사용하지 않는 패키지 제거
apt search패키지명
apt-cache search 패키지명
패키지 검색
apt show패키지명
apt-cache show 패키지명
패키지 상세 정보 출력

apt list

(--installed) : 설치된 패키지 리스트

(--upgradeable) : 업그레이드 대기중 패키지

(--all-versions) : 모든 버전

....설치된 패키지 리스트 출력


이상으로, Ubuntu에서 쓰이는 apt 명령어를 알아보았습니다.


필요에따라 apt-get 등의 명령어들도 사용가능하다는 점 기억해두시면 좋을것같네요!


감사합니다.



    닷홈 홈페이지 :

    무료홈페이지 | 무료 호스팅 | 닷홈
    닷홈은 도메인, 무료 호스팅, 무료홈페...


     닷홈 무료호스팅 신청하기 :

    국내 1위 무료호스팅 | 닷홈
    국내 1위 무료호스팅, 국내 최고의...


    기능제한 없는 진짜 무료 홈페이지 신청

    닷홈 | 호스팅은 닷홈
    www.dothome.co.kr



    댓글 0

    답글 보기
    • 답글
    답글 쓰기