안녕하세요, 닷홈입니다! 오늘은 Ubuntu의 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] 이어서, 설치명령어를 알아보기전에 apt와 apt-get의 차이점을 짚어보자면 아래와 같습니다.
ubuntu@dothome:~$ apt-get install abc ubuntu@dothome:~$ apt install abc abc라는 패키지를 설치한다고 가정한다면 위와 같이 둘 다 사용가능한 점 참고하시면 될 것 같네요! 반대로 삭제할때 사용되는 명령어 또한 두가지가 있습니다. 바로 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 <> Original-Maintainer: Craig Small <> 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명령어들은 아래를 참고해주세요!
이상으로, Ubuntu에서 쓰이는 apt 명령어를 알아보았습니다. 필요에따라 apt-get 등의 명령어들도 사용가능하다는 점 기억해두시면 좋을것같네요! 감사합니다.
|