Yum

From 탱이의 잡동사니
Revision as of 13:48, 25 August 2016 by Pchero (talk | contribs) (→‎reinstall)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

Linux command yum 사용법 정리.

Options

version

yum 의 버전정보를 표시한다. <source lang=bash> $ yum version </source>

help

도움말을 표시한다. <source lang=bash> $ yum help </source>

check

현재 설치된 패키지에 문제가 있는지 검사한다.

<source lang=bash> $ yum check [package] </source>

Example <source lang=bash> $ yum check $ yum check yum.noarch </source>

check-update

업데이트가 필요한지 검사한다. 인자값이 없을 시, 업데이트가 필요한 모든 패키지 목록을 출력한다.

<source lang=bash> $ yum check-update [package] </source>

Example <source lang=bash> $ yum check-update |head -n 10 Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile

alsa-lib.x86_64 1.1.0-4.el6 base-cached audit.x86_64 2.4.5-3.el6 base-cached ... </source>

clean

캐시된 정보를 삭제한다. all 옵션 추가시, 캐시된 모든 정보를 삭제한다. <source lang=bash> $ yum clean $ yum clean all </source>

deplist

패키지에 대한 의존성을 테스트한다. <source lang=bash> $ yum deplist [package] </source>

Example <source lang=bash> $ yum deplist curl </source>

distribution-synchronization/distro-sync

현재 설치되어 있는 패키지들의 정보를 등록된 저장소의 최신버전과 동기화한다. 패키지에 따라 업그레이드/다운그레이드가 이루어질 수 있다. <source lang=bash> $ yum distro-sync </source>

downgrade

설치된 패키지를 다운그레이드 한다. <source lang=bash> $ yum downgrade package1 [package2] </source>

install

패키지를 설치한다. <source lang=bash> $ yum install package1 [package2] [...] </source>

--downloadonly

패키지를 설치하지 않고 다운로드만 한다. 단, 별도의 플러그인 설치를 필요로 한다.

(RHEL5)
$ sudo yum install yum-downloadonly

(RHEL6)
$ sudo yum install yum-plugin-downloadonly

다음과 같이 사용하면 된다.

$ sudo yum install --downloadonly libevent

...
Dependencies Resolved

================================================================================
 Package             Arch        Version             Repository            Size
================================================================================
Updating:
 libevent            x86_64      2.0.22-7.el6        ...                  162 k
Updating for dependencies:
 libevent-devel      x86_64      2.0.22-7.el6        ...                   85 k

Transaction Summary
================================================================================
Upgrade       2 Package(s)

Total download size: 247 k
Is this ok [y/N]: 

다음의 사항에 주의해야 한다.

    Before using the plugin, check /etc/yum/pluginconf.d/downloadonly.conf to confirm that this plugin is "enabled=1"
    This is applicable for "yum install/yum update" and not for "yum groupinstall". Use "yum groupinfo" to identify packages within a specific group.
    If only the package name is specified, the latest available package is downloaded (such as sshd). 
    Otherwise, you can specify the full package name and version (such as httpd-2.2.3-22.el5).
    If you do not use the --downloaddir option, files are saved by default in /var/cache/yum/ in rhel-{arch}-channel/packages
    If desired, you can download multiple packages on the same command.
    You still need to re-download the repodata if the repodata expires before you re-use the cache. By default it takes two hours to expire.

reinstall

이미 설치된 패키지를 재설치 한다.

<source lang=bash> $ sudo yum reinstall <package name> </source>

Example

$ sudo yum reinstall curl
Loaded plugins: auto-update-debuginfo, downloadonly
Setting up Reinstall Process
Found 24 installed debuginfo package(s)
Enabling updates-cached-debuginfo: Fedora 12 - x86_64 - Updates Debuginfo (cached)
Reading repository metadata in from local files
Enabling fedora-cached-debuginfo: Fedora 12 - x86_64 - Debuginfo (cached)
Reading repository metadata in from local files
Resolving Dependencies
--> Running transaction check
---> Package curl.x86_64 0:7.29.0-4.fc12 set to be reinstalled
--> Finished Dependency Resolution

Dependencies Resolved
...

remove/erase

설치된 패키지를 삭제한다. <source lang=bash> $ yum remove | erase package1 [package2] [...] </source>

update

설치되어 있는 전체/특정 패키지의 업그레이드를 진행한다. 아무런 패키지를 지정하지 않을 경우, 전체 업그레이드를 진행한다. <source lang=bash> $ yum update [package1] [package2] [...] </source>

search

패키지의 설명, 이름을 검색한다. <source lang=bash> $ yum search string1 [string2] [...] </source>

groupinfo

그룹 패키지의 정보를 표시한다. <source lang=bash> $ yum groupinfo group1 [...] </source>

groupinstall

지정된 그룹에 속한 모든 패키지를 설치한다. <source lang=bash> $ yum groupinstall group1 [group2] [...] </source>

grouplist

설치 가능한 패키지 그룹의 리스트를 표시한다. <source lang=bash> $ yum grouplist [hidden] [groupwildcard] [...] </source>

groupremove

그룹에 속한 모든 패키지를 삭제한다. <source lang=bash> $ yum groupremove group1 [group2] [...] </source>

history

yum 패키지에 대한 최초 설치, 업데이트 등의 내역을 나타낸다. <source lang=bash> $ yum history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|rollback|new|sync|stats]

$ yum history Loaded plugins: auto-update-debuginfo ID | Login user | Date and time | Action(s) | Altered


  107 |  <stk>                 | 2016-03-16 14:59 | Update         |    1   
  106 |  <stk>                 | 2016-03-16 14:48 | Update         |    1   
  105 |  <stk>                 | 2016-03-14 15:43 | Update         |    1 EE
  104 |  <stk>                 | 2016-03-11 14:01 | Install        |    1   
  103 |  <stk>                 | 2016-03-11 14:00 | Install        |    2   
  102 |  <stk>                 | 2016-03-11 13:59 | Install        |    1   
  101 |  <stk>                 | 2016-03-11 13:29 | Update         |    1   
  100 |  <stk>                 | 2016-03-10 15:00 | Update         |    1 EE
   99 |  <stk>                 | 2016-03-08 15:05 | Install        |    1   
   98 |  <stk>                 | 2016-03-04 15:20 | Update         |   11 EE
   97 | root <root>            | 2016-03-01 11:42 | Update         |    1 EE
   96 |  <stk>                 | 2016-02-22 11:40 | Install        |    1   
   95 |  <stk>                 | 2016-02-22 11:40 | Update         |    1   
   94 |  <stk>                 | 2016-02-19 15:52 | Downgrade      |    1   
   93 |  <stk>                 | 2016-02-19 15:52 | Downgrade      |    1   
   92 |  <stk>                 | 2016-02-19 15:52 | Erase          |    1   
   91 |  <stk>                 | 2016-02-19 15:38 | I, U           |    7   
   90 |  <stk>                 | 2016-02-19 13:58 | Update         |    2   
   89 |  <stk>                 | 2016-02-19 10:55 | Downgrade      |    1   
   88 |  <stk>                 | 2016-02-19 10:55 | Downgrade      |    1   

history list </source>

list

입력한 패키지와 관련된 yum 명령 내역만 출력한다. <source lang=bash> $ yum history list <package-regex>

$ yum history list lib* Loaded plugins: auto-update-debuginfo ID | Login user | Date and time | Action(s) | Altered


  103 |  <stk>                 | 2016-03-11 14:00 | Install        |    2   
  101 |  <stk>                 | 2016-03-11 13:29 | Update         |    1   
   96 |  <stk>                 | 2016-02-22 11:40 | Install        |    1   

... </source>

info

history-number 에 해당하는 명령의 상세 내역을 확인한다. <source lang=bash> $ yum history info <history-number>

$ yum history info 10 Loaded plugins: auto-update-debuginfo Transaction ID : 10 Begin time  : Mon Nov 16 15:18:31 2015 Begin rpmdb  : 361:061e446b5581553ea6e8ce90e3a5856a394fecca End time  : (0 seconds) End rpmdb  : 362:e0b84597f8c98008043535c2ab4af412379cae43 User  : <stk> Return-Code  : Success Command Line  : install libuuid-devel Transaction performed with:

   Installed     rpm-4.7.2-2.fc12.x86_64
   Installed     yum-3.2.28-5.fc12.noarch

Packages Altered:

   Install libuuid-devel-2.16.2-9.fc12.x86_64

history info </source>

summary

마지막으로 수행한 작업 내용을 보여준다. <source lang=bash> $ yum history summary

$ yum history summary Loaded plugins: auto-update-debuginfo Login user | Time | Action(s) | Altered


<stk>                     | Last week           | Update           |        3
<stk>                     | Last 2 weeks        | I, U             |        7
<stk>                     | Last 3 months       | D, E, I, U       |       82

root <root> | Last 3 months | I, U | 14

<stk>                     | Last 6 months       | D, E, I, R, U    |      153

root <root> | Last 6 months | Install | 171 System <unset> | Over a year ago | Install | 159 history summary </source>

repeat

함께 입력한 history-number 에 해당하는 작업을 재수행한다. <source lang=bash> $ yum history repeat <history-number> </source>

undo

함께 입력한 history-number 에 해당하는 작업을 되돌린다. <source lang=bash> $ yum history unto <history-number>

$ yum history undo 108 Loaded plugins: auto-update-debuginfo Found 20 installed debuginfo package(s) Enabling updates-cached-debuginfo: Fedora 12 - x86_64 - Updates Debuginfo (cached) Reading repository metadata in from local files Enabling fedora-cached-debuginfo: Fedora 12 - x86_64 - Debuginfo (cached) Reading repository metadata in from local files Undoing transaction 108, from Fri Mar 18 16:08:32 2016

   Install lynx-2.8.6-25.fc12.x86_64

Resolving Dependencies --> Running transaction check ---> Package lynx.x86_64 0:2.8.6-25.fc12 set to be erased --> Finished Dependency Resolution ... </source>

redo

repeat 와 거의 비슷하다. 함께 입력한 history-numbrer 에 해당하는 작업을 다시 반복한다. <source lang=bash> $ yum history redo <history-number> </source>

new

현재 history 항목에 저장된 내용들을 모두 삭제한다.

info

현재 캐시되어 있는 패키지에 대한 정보를 보여준다. <source lang=bash> $ yum info [...] </source>

list

캐시에 등록된 패키지 목록을 보여준다. <source lang=bash> $ yum list [...] $ yum list updates $ yum list all $ yum list installed </source>

updates 업데이트가 가능한 모든 패키지 리스트를 보여준다.

list all 설치가 가능한 모든 패키지 리스트를 보여준다.

installed 현재 시스템에 설치된 패키지 리스트를 보여준다.

repolist

설정되어 있는 저장소 정보를 표시한다. <source lang=bash> $ yum repolist [all|enabled|disabled] </source>

Sub options

--enablerepo

활성화하고자 하는 저장소를 지정한다.

$ sudo yum search --enablerepo test-repository asterisk

yum-utils

repoquery

repoquery 는 YUM repository 에 있는 패키지에 rpm 명령어와 비슷한 명령을 수행하는 프로그램이다.

-l, --list

YUM repository 에 있는 패키지/그룹에 있는 파일들의 목록을 확인한다.

$ repoquery --list curl-7.29.0-4.fc12.x86_64
/usr/bin/curl
/usr/share/doc/curl-7.29.0
/usr/share/doc/curl-7.29.0/BUGS
...

Download source

SRPM 패키지 다운로드 <source lang=bash> $ yum install yum-utils $ yumdownloader --source mypkg </source>