Yum(Yellodog Update Modified)

chaeyoung·2022년 5월 16일
0

리눅스(CentOS)

목록 보기
11/13

Yum

  • rpm 패키지는 의존성에 따라 관련 패키지가 먼저 설치되지 않으면 설치할 수 없었다.
  • yum은 의존성 패키지가 없으면 같이 설치 함으로써 rpm 패키지의 단점을 해결했다.
  • repo repository 저장소 레포지토리

    upgrade: 구식 패키지는 지우면서 설치
    update: 프로그램 업데이트

dnf

  • yum의 업그레이드 버전
  • 아직 실무에서 잘 쓰지 않는다.

CentOS-Base.repo

  • /etc/yum.repos.d/에 존재
  • CentOS 버전 별 CentOS-Base.repo 파일의 기본 설정
  • 임의로 수정시 url에서 다운받아 다시 원상복구할 때 사용

명령어

  • yum list
    패키지 리스트 확인
[root@localhost ~]# yum list
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: ftp.riken.jp
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
...
  • yum list installed
    설치된 패키지 확인
[root@localhost ~]# yum list installed
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: ftp.riken.jp
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Installed Packages
GConf2.x86_64                                  3.2.6-8.el7                    @anaconda
GeoIP.x86_64                                   1.5.0-14.el7                   @anaconda
ModemManager.x86_64                            1.6.10-4.el7                   @anaconda
ModemManager-glib.x86_64                       1.6.10-4.el7                   @anaconda
...
  • yum list updated
    업데이트 가능한 목록 확인
[root@localhost ~]# yum list updated
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: ftp.riken.jp
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Error: No matching Packages to list
  • yum info 패키지
    패키지 정보 확인
[root@localhost ~]# yum info mc
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: ftp.riken.jp
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Available Packages
Name        : mc
Arch        : x86_64
Epoch       : 1
Version     : 4.8.7
Release     : 11.el7
Size        : 1.7 M
Repo        : base/7/x86_64
Summary     : User-friendly text console file manager and visual shell
URL         : http://www.midnight-commander.org/
License     : GPLv3+
Description : Midnight Commander is a visual shell much like a file manager, only
            : with many more features. It is a text mode application, but it also
            : includes mouse support. Midnight Commander's best features are its
            : ability to FTP, view tar and zip files, and to poke into RPMs for
            : specific files.
  • yum delist 패키지
    패키지 의존성 확인
[root@localhost ~]# yum deplist mc
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: ftp.riken.jp
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
package: mc.x86_64 1:4.8.7-11.el7
  dependency: /bin/sh
   provider: bash.x86_64 4.2.46-35.el7_9
  dependency: /usr/bin/perl
   provider: perl.x86_64 4:5.16.3-299.el7_9
  dependency: libc.so.6(GLIBC_2.15)(64bit)
   provider: glibc.x86_64 2.17-325.el7_9
  dependency: libglib-2.0.so.0()(64bit)
   provider: glib2.x86_64 2.56.1-9.el7_9
  dependency: libgmodule-2.0.so.0()(64bit)
   provider: glib2.x86_64 2.56.1-9.el7_9
  dependency: libgpm.so.2()(64bit)
   provider: gpm-libs.x86_64 1.20.7-6.el7
...

yum install [패키지명] (-y) (중요)

  • 새로운 패키지 설치
  • 의존성 패키지도 같이 설치
  • -y는 yes 생략
  • 제대로 설치 됐는지 message 꼼꼼히 확인!!!
[root@localhost ~]# yum install mc -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: ftp.riken.jp
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Resolving Dependencies
--> Running transaction check
---> Package mc.x86_64 1:4.8.7-11.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package        Arch               Version                      Repository        Size
=======================================================================================
Installing:
 mc             x86_64             1:4.8.7-11.el7               base             1.7 M

Transaction Summary
=======================================================================================
Install  1 Package

Total download size: 1.7 M
Installed size: 5.6 M
Downloading packages:
mc-4.8.7-11.el7.x86_64.rpm                                      | 1.7 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:mc-4.8.7-11.el7.x86_64                                            1/1 
  Verifying  : 1:mc-4.8.7-11.el7.x86_64                                            1/1 

Installed:
  mc.x86_64 1:4.8.7-11.el7                                                             

Complete!

yum remove [패키지] (-y) , yum erase [패키지] (-y)

삭제

[root@localhost ~]# yum install mc -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: ftp.riken.jp
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
Resolving Dependencies
--> Running transaction check
---> Package mc.x86_64 1:4.8.7-11.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package        Arch               Version                      Repository        Size
=======================================================================================
Installing:
 mc             x86_64             1:4.8.7-11.el7               base             1.7 M

Transaction Summary
=======================================================================================
Install  1 Package

Total download size: 1.7 M
Installed size: 5.6 M
Downloading packages:
mc-4.8.7-11.el7.x86_64.rpm                                      | 1.7 MB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:mc-4.8.7-11.el7.x86_64                                            1/1 
  Verifying  : 1:mc-4.8.7-11.el7.x86_64                                            1/1 

Installed:
  mc.x86_64 1:4.8.7-11.el7                                                             

Complete!
[root@localhost ~]# yum erase mc -y
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
--> Running transaction check
---> Package mc.x86_64 1:4.8.7-11.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================
 Package        Arch               Version                     Repository         Size
=======================================================================================
Removing:
 mc             x86_64             1:4.8.7-11.el7              @base             5.6 M

Transaction Summary
=======================================================================================
Remove  1 Package

Installed size: 5.6 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : 1:mc-4.8.7-11.el7.x86_64                                            1/1 
  Verifying  : 1:mc-4.8.7-11.el7.x86_64                                            1/1 

Removed:
  mc.x86_64 1:4.8.7-11.el7                                                             

Complete!
[root@localhost ~]# rpm -q mc
package mc is not installed
  • yum update [패키지]
    모든 패키지 업데이트 ==> 시간이 오래 걸림, 추천 x

  • yum 그룹 패키지 설치

    • 필요없는 파일까지 설치되기 때문에 선호되지 않음

      1 그룹 패키지 리스트 확인
      $ yum groups list
      2 Security Tools 패키지 정보 확인
      $ yum groups info 'Security Tools'
      3 Security Tools 패키지 설치
      $ yum groups install 'Security Tools' (-y)
      4 Security Tools 패키지 삭제
      $ yum groups remove 'Security Tools' (-y)

패키지 설치 로그 명령어

  • cat /var/log/yum.log
[root@localhost ~]# cat /var/log/yum.log
May 14 14:05:16 Updated: 1:grub2-common-2.02-0.87.el7.centos.7.noarch
May 14 14:05:16 Updated: centos-release-7-9.2009.1.el7.centos.x86_64
May 14 14:05:16 Updated: 1:control-center-filesystem-3.28.1-8.el7_9.x86_64
May 14 14:05:16 Updated: 32:bind-license-9.11.4-26.P2.el7_9.9.noarch
May 14 14:05:17 Updated: 1:grub2-pc-modules-2.02-0.87.el7.centos.7.noarch
May 14 14:05:18 Updated: kbd-misc-1.15.5-16.el7_9.noarch
May 14 14:05:18 Updated: mesa-filesystem-18.3.4-12.el7_9.x86_64
May 14 14:05:18 Updated: firewalld-filesystem-0.6.3-13.el7_9.noarch
May 14 14:05:18 Updated: libX11-common-1.6.7-4.el7_9.noarch
May 14 14:05:18 Updated: 2:vim-filesystem-7.4.629-8.el7_9.x86_64
...
  • yum history
[root@localhost ~]# yum history
Loaded plugins: fastestmirror, langpacks
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    12 | root <root>              | 2022-05-16 22:08 | Erase          |    1   
    11 | root <root>              | 2022-05-16 22:06 | Install        |    1   
    10 | root <root>              | 2022-05-16 17:40 | Erase          |    1   
     9 | root <root>              | 2022-05-16 17:39 | Install        |    1   
     8 | root <root>              | 2022-05-16 17:35 | Erase          |    1   
     7 | root <root>              | 2022-05-16 17:33 | Install        |    1   
     6 | root <root>              | 2022-05-15 09:21 | Install        |    1   
     5 | root <root>              | 2022-05-15 09:20 | Install        |    1   
     4 | root <root>              | 2022-05-14 14:13 | Install        |    1   
     3 | root <root>              | 2022-05-14 14:12 | Install        |   51   
     2 | root <root>              | 2022-05-14 14:05 | I, U           |  281 EE
     1 | System <unset>           | 2022-05-14 13:37 | Install        | 1348   
history list
  • yum history info [id]
    id 에 대한 자세한 정보 출력
[root@localhost ~]# yum history 12
Loaded plugins: fastestmirror, langpacks
Invalid history sub-command, use: list, info, summary, repeat, redo, undo, new, rollback, addon, addon-info, stats, statistics, sync, synchronizepkg, pkgs, pkg-list, pkgs-list, package, package-list, packages, packages-list, pkg-info, pkgs-info, package-info, packages-info.
  • yum history rollback [id]
    해당 id로 yum rollback (해당 번호로 복구)

  • yum clean all
    기존 yum 캐시 초기화

  • yum repolist
    설정된 리포지토리 리스트 출력

[root@localhost ~]# yum repolist
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirror.kakao.com
 * epel: ftp.riken.jp
 * extras: mirror.kakao.com
 * updates: mirror.kakao.com
repo id                  repo name                                               status
base/7/x86_64            CentOS-7 - Base                                         10,072
epel/x86_64              Extra Packages for Enterprise Linux 7 - x86_64          13,756
extras/7/x86_64          CentOS-7 - Extras                                          509
updates/7/x86_64         CentOS-7 - Updates                                       3,773
repolist: 28,110
profile
안녕하세요! 풀스택 개발자가 되고싶은 윤채영입니다. 제 블로그에 방문해주셔서 감사합니다!~~

0개의 댓글