반응형

안녕하세요 가야태자 @talkit 입니다.

오늘은 데비안/우분투 리눅스의 설치 관리자인 apt에 대해서 알아 보겠습니다.

우선 리눅스의 설치 관리자는 제가 아는 것으로 ^^

rpm이라는 프로그램

yum이라는 프로그램

그리고, 지금 설명하려고 하는 apt라는 프로그램이 있습니다.

rpm은 레드햇 리눅스에서 만든 패키지 관리 프로그램 이구요.

yum이라는 프로그램은 역시 레드햇 리눅스에서 만든 프로그램인데, rpm 보다는 스스로 호환성/의존성 문제를 해결해 줍니다.

그리고 apt는 호환성/의존성 문제가 해결된 데비안/우분투 리눅스의 설치 관리자 입니다.

![[Pasted image 20230106232301.png]]

apt의 GUI 버전을 보여 드리겨고 했는데 ^^ 위와 같이 카달로그를 받는데 시간이 걸리네요

저거 끝나면 다시 캡쳐를 ^^

지금 제가 하고 있는 것은 CLI 입니다. Command LIne Interface ^^

apt 기본 사용법

 sudo apt 명령어 [패키지명|검색어]

위와 같습니다.

오늘 설명할 명령어는 아래와 같습니다.

update
upgrade
install
reinstall
remove
search
list
show

위 명령어들을 알아 보겠습니다.

대부분 우분투에 뭔가를 까실때 저 명령어들로 해결이 가능 합니다.

우선 update는 최신 버전의 패키지 서버들과 패키지의 버전 업데이트를 목록을 알려 줍니다.

update 명령어

sudo apt update

우분투에서 root를 활성화 시키지 않는 이상 sudo를 사용해야 합니다.

그래서 위와 같이 사용합니다.

한번 해보겠습니다.

![[Pasted image 20230106232754.png]]

아까 하고 있는 작업 끝나서 보입니다. ^^

위와 같이 GUI형태로 프로그램을 설치하고 관리 할 수 있습니다.

다시 putty로 돌아 와서.

sudo apt update 명령어를 내려 보십시오.

sudo apt update
[sudo] password for talkit:
Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
9 packages can be upgraded. Run 'apt list --upgradable' to see them.

위와 같이 나옵니다. 저기 시키는 대로 한번 쳐 보겠습니다.

list 명령어

sudo apt list --upgradable
firefox-locale-en/focal-updates,focal-security 108.0.1+build1-0ubuntu0.20.04.1 amd64 [upgradable from: 108.0+build2-0ubuntu0.20.04.1]
firefox/focal-updates,focal-security 108.0.1+build1-0ubuntu0.20.04.1 amd64 [upgradable from: 108.0+build2-0ubuntu0.20.04.1]
libcurl3-gnutls/focal-updates,focal-security 7.68.0-1ubuntu2.15 amd64 [upgradable from: 7.68.0-1ubuntu2.14]
linux-generic-hwe-20.04/focal-updates,focal-security 5.15.0.57.63~20.04.23 amd64 [upgradable from: 5.15.0.56.62~20.04.22]
linux-headers-generic-hwe-20.04/focal-updates,focal-security 5.15.0.57.63~20.04.23 amd64 [upgradable from: 5.15.0.56.62~20.04.22]
linux-image-generic-hwe-20.04/focal-updates,focal-security 5.15.0.57.63~20.04.23 amd64 [upgradable from: 5.15.0.56.62~20.04.22]
python3-update-manager/focal-updates,focal-updates 1:20.04.10.11 all [upgradable from: 1:20.04.10.10]
update-manager-core/focal-updates,focal-updates 1:20.04.10.11 all [upgradable from: 1:20.04.10.10]
update-manager/focal-updates,focal-updates 1:20.04.10.11 all [upgradable from: 1:20.04.10.10]

저는 위와 같이나옵니다.

몇가지가 update 되어 있네요.

list는 보시는 바와 같이 패키지 목록을 보여 줍니다.

이왕 list로 왔으니

그냥 list를 해보겠습니다.

sudo apt list | more

조만간 more 와 less에 관해서 작성 해야겠네요 ^^

sudo apt list | more

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Listing...
0ad-data-common/focal,focal 0.0.23.1-1 all
0ad-data/focal,focal 0.0.23.1-1 all
0ad/focal 0.0.23.1-4ubuntu3 amd64
0install-core/focal 2.15.1-1 amd64
0install/focal 2.15.1-1 amd64
0xffff/focal 0.8-1 amd64
2048-qt/focal 0.1.6-2build1 amd64
2ping/focal,focal 4.3-1 all
2to3/focal,focal 3.8.2-0ubuntu2 all
2vcard/focal,focal 0.6-2 all
3270-common/focal 3.6ga4-3build1 amd64
389-ds-base-dev/focal 1.4.3.6-2 amd64
389-ds-base-libs/focal 1.4.3.6-2 amd64
389-ds-base/focal 1.4.3.6-2 amd64
389-ds/focal,focal 1.4.3.6-2 all
3dchess/focal 0.8.1-20 amd64
3depict/focal 0.0.22-1.2build1 amd64
3dldf-doc/focal,focal 2.0.3+ndfsg-4 all
4g8/focal 1.0-3.2 amd64
4pane/focal 6.0-1build1 amd64
4store/focal 1.1.6+20151109-2build2 amd64
4ti2-doc/focal,focal 1.6.9+ds-2build1 all
4ti2/focal 1.6.9+ds-2build1 amd64
64tass/focal 1.54.1900-1 amd64
6tunnel/focal 1:0.13-1 amd64
7kaa-data/focal,focal 2.15.2+dfsg-2build1 all
7kaa/focal 2.15.2+dfsg-2build1 amd64
9base/focal 1:6-7build1 amd64
9menu/focal 1.9-2 amd64
9mount/focal 1.3+hg20170412-1 amd64
9wm/focal 1.4.1-1 amd64
a11y-profile-manager-doc/focal,focal 0.1.11-0ubuntu4 all
a11y-profile-manager-indicator/focal 0.1.11-0ubuntu4 amd64
a11y-profile-manager/focal 0.1.11-0ubuntu4 amd64
a2jmidid/focal 9-2 amd64
a2ps/focal 1:4.14-5 amd64
a56/focal 1.3+dfsg-9 amd64
a7xpg-data/focal-updates,focal-updates 0.11.dfsg1-10build3.1 all
a7xpg/focal-updates 0.11.dfsg1-10build3.1 amd64
aa3d/focal 1.0-8build1 amd64
aac-enc/focal 0.1.6-1 amd64
aajm/focal 0.4-10build1 amd64
aaphoto/focal 0.45-1 amd64
aapt/focal 1:8.1.0+r23-3build2 amd64
abacas/focal,focal 1.3.1-6 all
abcde/focal,focal 2.9.3-1 all
abci/focal 0.0~git20170124.0.f94ae5e-2 amd64
abcm2ps/focal 8.14.6-0.1 amd64
abcmidi/focal 20200122-1 amd64
abe-data/focal,focal 1.1+dfsg-3 all
abe/focal 1.1+dfsg-3 amd64
abgate/focal 1.1.9-2build1 amd64
abi-compliance-checker/focal,focal 2.3-0.2ubuntu1 all
abi-dumper/focal,focal 1.1-1 all
abi-monitor/focal,focal 1.12-2ubuntu1 all
abi-tracker/focal,focal 1.11-1 all
abicheck/focal,focal 1.2-5ubuntu1 all
abigail-doc/focal,focal 1.6-1build1 all
abigail-tools/focal 1.6-1build1 amd64
abisip-find/focal 1.3.0-2 amd64
abiword-common/focal,focal 3.0.2-10 all

위와 같이 설치 되어 있는 캐시되 있는? 설치되고, 설치할 수 있는 모든 패키지들을 보여 주고 있습니다.

sudo apt list --installed

위 명령어를 내리면, 설치 되어 있는 패키지만 찾을 수 있습니다.

지난 번에 제가 설치한 mc 패키지를 한번 찾아 보겠습니다.

sudo apt list --installed | grep mc

위와 같이 하시면 됩니다.

sudo apt list --installed | grep mc

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

fonts-smc-anjalioldlipi/focal,focal,now 7.1.2-1 all [installed,automatic]
fonts-smc-chilanka/focal,focal,now 1.400-1 all [installed,automatic]
fonts-smc-dyuthi/focal,focal,now 3.0.2-1 all [installed,automatic]
fonts-smc-gayathri/focal,focal,now 1.100-1 all [installed,automatic]
fonts-smc-karumbi/focal,focal,now 1.1.2-1 all [installed,automatic]
fonts-smc-keraleeyam/focal,focal,now 3.0.2-1 all [installed,automatic]
fonts-smc-manjari/focal,focal,now 1.710-1 all [installed,automatic]
fonts-smc-meera/focal,focal,now 7.0.3-1 all [installed,automatic]
fonts-smc-rachana/focal,focal,now 7.0.2-1 all [installed,automatic]
fonts-smc-raghumalayalamsans/focal,focal,now 2.2.1-1 all [installed,automatic]
fonts-smc-suruma/focal,focal,now 3.2.3-1 all [installed,automatic]
fonts-smc-uroob/focal,focal,now 2.0.2-1 all [installed,automatic]
fonts-smc/focal,focal,now 1:7.1 all [installed,automatic]
libxdmcp6/focal,now 1:1.1.3-0ubuntu1 amd64 [installed,automatic]
libxvmc1/focal,now 2:1.0.12-2 amd64 [installed,automatic]
mc-data/focal,focal,now 3:4.8.24-2ubuntu1 all [installed,automatic]
mc/focal,now 3:4.8.24-2ubuntu1 amd64 [installed]
pcmciautils/focal,now 018-11 amd64 [installed,automatic]

결과는 위와 같이 나오구요. 실제로 밑에서 두번째 줄에 있는 아이가 mc 입니다 ^^

그럼 다시 돌아가서

upgrade 명령어

업그레이드 가능한 목록을 알아 봤으니 upgrade를 해보겠습니다.

 sudo apt upgrade

명령어는 위와 같습니다.

위 명령어를 내리면 알아서 인터넷에서 받아와서 업그레이드를 진행 합니다. ^^

꺼꾸로 이긴 한데 ^^

upgrade 까지 배웠으니

install 명령어

install을 알아 보겠습니다.

sudo apt install 원하는패키지명

위와 같이 설치 합니다.

음 제가 설치 해둔 리눅스는 컴파일러가 없습니다.

그래서 gcc를 한번 설치 해보겠습니다.

sudo apt install gcc

설치 하기 전에 gcc 엔터를 쳤습니다.

gcc

Command 'gcc' not found, but can be installed with:

sudo apt install gcc

설치 후에 gcc 엔터를 쳤습니다.

gcc
gcc: fatal error: no input files
compilation terminated.

앞에는 프로그램이 없으니 설치 하라고 하고 뒤에는 C파일이 없다고 C파일하나를 내놓으라고 합니다. ^^

설치가 잘 되었씁니다.

remove 명령어

설치가 있으면 삭제가 있습니다. ^^

remove 는 아래와 같습니다.

sudo apt remove gcc

위와 같이 하시면 됩니다.

sudo apt remove gcc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
  gcc
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 51.2 kB disk space will be freed.
Do you want to continue? [Y/n] y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "ko_KR.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 166383 files and directories currently installed.)
Removing gcc (4:9.3.0-1ubuntu2) ...
Processing triggers for man-db (2.9.1-1) ...

실행을 해보면 잘 지워 집니다.

gcc
-bash: /usr/bin/gcc: No such file or directory

다시 아까 처럼 gcc를 쳐봤는데 그렇게 친절 하지는 않네요 ^^

여튼 삭제가 되었습니다.

reinstall 명령어

sudo apt reinstall 패키지명

gcc를 reinstall 해보겠습니다.

sudo apt reinstall gcc

reinstall은 설치할지를 안묻고 바로 설치 해버리네요 ^^

isntall만 사용하셔도 될 것 같습니다.

search 명령어

search 명령어는 설치할 패키지가 있는지 알려 줍니다.

요즘 관심 가지고 있는 obsidian 이 있는지 찾아 보도록 하겠습니다.

apt search obsidian
apt search obsidian*
Sorting... Done
Full Text Search... Done
minetest-mod-nether/focal,focal 2-4 all
  Minetest mod - Nether portals and materials

obsidian-icon-theme/focal,focal 3.5-1 all
  Intuitive Faenza-like icon theme

결과는 위와 같이 나왔습니다.

음 실제 프로그램은 없는 건가요?

일단 한번 리눅스에 옵시디안 설치하는 방법도 글을 한번 써봐야 겠습니다.

show 명령어

이제 마지막으로 show에 대해서 이야기 해보겠습니다.

sudo apt show 패키지명

위와 같이 사용할 수 있습니다.

mc를 한번 show로 보겠습니다.

sudo apt show mc
[sudo] password for talkit:
Package: mc
Version: 3:4.8.24-2ubuntu1
Priority: optional
Section: universe/utils
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Dmitry Smirnov <onlyjob@debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1501 kB
Provides: mcedit
Depends: libc6 (>= 2.15), libext2fs2 (>= 1.37), libglib2.0-0 (>= 2.59.2), libgpm2 (>= 1.20.7), libslang2 (>= 2.2.4), libssh2-1 (>= 1.2.8), mc-data (= 3:4.8.24-2ubuntu1)
Recommends: mime-support, perl, unzip
Suggests: arj, bzip2, catdvi | texlive-binaries, dbview, djvulibre-bin, epub-utils, file, genisoimage, gv, imagemagick, libaspell-dev, links | w3m | lynx, odt2txt, poppler-utils, python, python-boto, python-tz, xpdf | pdf-viewer, zip
Homepage: https://www.midnight-commander.org
Download-Size: 477 kB
APT-Manual-Installed: yes
APT-Sources: http://us.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
Description: Midnight Commander - a powerful file manager
 GNU Midnight Commander is a text-mode full-screen file manager. It
 uses a two panel interface and a subshell for command execution. It
 includes an internal editor with syntax highlighting and an internal
 viewer with support for binary files. Also included is Virtual
 Filesystem (VFS), that allows files on remote systems (e.g. FTP, SSH
 servers) and files inside archives to be manipulated like real files.

정말 멋진 툴이네요 ^^

여기까지가 apt의 기본 사용법입니다.

제가 매일 그냥 사용하고 있고 저도 솔직히 REDHAT계열에서 넘어와서 apt 보다는 yum 이 익숙한데 ^^

저도 좀 정리가 되는 느낌입니다.

ubuntu는 보안상 sudo를 사용하고 있습니다.

REDHAT 계열의 시스템들도 sudo를 사용하는 것이 좋습니다.

저 방법을 언젠가는 적어 보겠습니다.

감사합니다.

#linux #ubuntu #install

반응형

+ Recent posts