CHECKING FOR AND UPDATING PACKAGES


Checking For Updates


아래의 명령어로 update 가 있는지 확인할수 있다. 


yum check-update

실질적으로 yum check-update 명령을 하게되면 나오는 아우풋 예제이다. 


~]# yum check-update
Loaded plugins: product-id, search-disabled-repos, subscription-manager
dracut.x86_64                         033-360.el7_2      rhel-7-server-rpms
dracut-config-rescue.x86_64           033-360.el7_2      rhel-7-server-rpms
kernel.x86_64                         3.10.0-327.el7     rhel-7-server-rpms
rpm.x86_64                            4.11.3-17.el7      rhel-7-server-rpms
rpm-libs.x86_64                       4.11.3-17.el7      rhel-7-server-rpms
rpm-python.x86_64                     4.11.3-17.el7      rhel-7-server-rpms
yum.noarch                            3.4.3-132.el7      rhel-7-server-rpms

위의 출력은 업데이트 가능한 목록을 보여준다. 그중에 dracut 가 보인다. dracut 를 예시로 설명을 해보도록 하겠다. 


dracut - Package name

x86_64 - Package 가 설치 가능한 CPU 아키텍처를 의미

033 - update 버전을 의미함

360.e17 - update package 의 release 를 의미

_2 - z-stream update 의 일부 빌드 버전을 의미

rhel-7-server-rpms - update package 가 있는 저장소의 정보



Updating Packages


하나의 package 를 update 함, root 로 진행해야함


yum update package_name

rpm 아리는 package 를 update 하는 예제


~]# yum update rpm
Loaded plugins: langpacks, product-id, subscription-manager
Updating Red Hat repositories.
INFO:rhsm-app.repolib:repos updated: 0
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package rpm.x86_64 0:4.11.1-3.el7 will be updated
--> Processing Dependency: rpm = 4.11.1-3.el7 for package: rpm-libs-4.11.1-3.el7.x86_64
--> Processing Dependency: rpm = 4.11.1-3.el7 for package: rpm-python-4.11.1-3.el7.x86_64
--> Processing Dependency: rpm = 4.11.1-3.el7 for package: rpm-build-4.11.1-3.el7.x86_64
---> Package rpm.x86_64 0:4.11.2-2.el7 will be an update
--> Running transaction check
...
--> Finished Dependency Resolution

Dependencies Resolved
=============================================================================
 Package                   Arch        Version         Repository       Size
=============================================================================
Updating:
 rpm                       x86_64      4.11.2-2.el7    rhel            1.1 M
Updating for dependencies:
 rpm-build                 x86_64      4.11.2-2.el7    rhel            139 k
 rpm-build-libs            x86_64      4.11.2-2.el7    rhel             98 k
 rpm-libs                  x86_64      4.11.2-2.el7    rhel            261 k
 rpm-python                x86_64      4.11.2-2.el7    rhel             74 k

Transaction Summary
=============================================================================
Upgrade  1 Package (+4 Dependent packages)

Total size: 1.7 M
Is this ok [y/d/N]:


아웃풋에 대한 설명을 해보자


Loaded plugins: langpacks, product-id, subscription-manager - yum plugin 이 설치되어 있고, 활성화 되어 있음을 명시

rpm.x86_64 - 새로운 rpm package 와 의존성이 겹치는 추가 package 를 다운로드 하고 설치할수 있음


yum은 업데이트 정보를 보여준다음에 업데이트 관련 확인 메시지를 표시해줌 yum 은 기본적으로 대화식으로 진행이 됨, yum 을통해 할 작업 내용을 이미 알고 있는경우 -y 옵셥을 이용해서 yes를 자동으로 입력할수 있음, -y 옵션이 편리 하기는 하지만 패키지 설치때 일어날수 있는 이슈를 파악하기 위해서는 step by step 으로 진행하는것을 추천함, d 옵션으로 다운로드를 하는경우 package 는 백그라운드로 다운로드를 하게된다. 


yum date or yum install command 를 사용하는경우 yum은 늘 새로운 kernel를 설치하려고 한다. 


group package 를 설치하는것에 대한 예시를 진행해보자, root 로 진행한다. 


yum group update group_name

group_name 에 그룹 패키지를 입력하면 된다. 

Group Package 에 대한 정보는 위 링크에 있다. Section 8.3, “Working with Package Groups”



Updating all packages and their dependencies


모든 package 를 업데이트 하는 명령어 이다. 


yum update


보안관련 업데이트가 있는 package 만 update 진행


yum update --security

최신 보안 업데이트가 포함된 버전으로 업데이트 진행


yum update-minimal --security

예를 들자면


kernel 3.10.0-1 package 가 시스템에 설치

kernel 3.10.0-2 package 는 보안업데이트 발표

kernel 3.10.0-3 package 는 버그 수정 업데이트로 출시


yum update-minimal --security 로 kernel-3.10.0-2 / yum update --security 업데이트로 kernel-3.10.0-3 업데이트 진행



Preserving Configuration File Changes


RHEL 시스템을 사용하게되면 필연적으로 여러가지 설정 파일을 수정하게 된다. 이러한 수정파일은 RPM 을 update 하는경우 변경이 된다. 하지만 RPM 에 대한 무결성을 보장하기위한 메커니즘을 가지고 있다. Package 를 update 할때에 설정 파일의 변경사항을 관리하는 방법에 대한 자세한 내용은 위 링크에서 참조를 하면 된다. Section A.2.1, “Installing and Upgrading Packages”



Upgrading the System Off-line with ISO and Yum


인터넷이 안되는 시스템에 yum update 를 해야하는 경우 설치 ISO 파일을 가지고 할수 있다. 



ISO 이미지를 mount 할 디렉토리를 생성


mkdir mount_dir


ISO 이미지를 mount할 디렉토리에 mount 


mount -o loop iso_name  mount_dir


media.repo 파일을 /etc/yum.repos.d/ 에 복사, .repo 확장자가 필수


cp mount_dir/media.repo /etc/yum.repos.d/new.repo


new.repo 파일에 아래의 baseurl 정보를 입력


baseurl = file : /// mount_dir


yum update 를 진행


yum update


update 가 성공적으로 마무리 되었으면 ISO 이미지를 umount 진행


umount mount_dir

마운트했던 디렉토리의 삭제


rmdir mount_dir


iso 이미지용 .repo 파일을 삭제 


rm /etc/yum.repos.d/new.repo


EX. RHEL 7.0 -> RHEL 7.1 로 업그레이드


인터넷이 되지 않는 공간에서 업그레이드를 해야하는경우 아래와 같은 Flow 로 진행을 하게됨


~] # mount -o loop rhel-server-7.1-x86_64-dvd.iso /media/rhel7/
~] # cp /media/rhel7/media.repo /etc/yum.repos.d/rhel7.repo
baseurl = file : /// media / rhel7 /
~] # yum update
~] # umount /media/rhel7/
~] # rmdir /media/rhel7/
~] # rm /etc/yum.repos.d/rhel7.repo


WORKING WITH PACKAGES


Searching Packages


아래의 명령을 통해서 RPM Package 을 검색할수 있다. 


yum search term

특정 문자열과 매칭이 되는 Package 를 검색하는것에 대한 예시이다. 


vim, gvim, emacs 에 대해서 검색


~]$ yum search vim gvim emacs
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
============================= N/S matched: vim ==============================
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-common.x86_64 : The common files needed by any version of the VIM editor
[output truncated]

============================ N/S matched: emacs =============================
emacs.x86_64 : GNU Emacs text editor
emacs-auctex.noarch : Enhanced TeX modes for Emacs
[output truncated]

  Name and summary matches mostly, use "search all" for everything.
Warning: No matches found for: gvim


yum search 는 명확한 Package 이름은 모르지만 어떻게 사용되는지 알때에 사용하면 편하다. 



Listing Package


모든 정보를 확인하려면 아래의 명령을 사용하면 된다. 


yum list all

설치된 Package 를 확인하려면 아래와 같은 형식으로 명령을 진행하면 된다. 


yum list glob_expression

ABRT-related packages 를 확인하는 예제이다. 

abrt 관련 에드온과 플러그인이 있는 package 는 abrt-addon, abrt-plugin 으로 시작이 된다. 

* 를 사용할때에 \(백슬러시)를 통해 사용된다는것에 주목


~]$ yum list abrt-addon\* abrt-plugin\*
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Installed Packages
abrt-addon-ccpp.x86_64                   2.1.11-35.el7             @rhel-7-server-rpms
abrt-addon-kerneloops.x86_64             2.1.11-35.el7             @rhel-7-server-rpms
abrt-addon-pstoreoops.x86_64             2.1.11-35.el7             @rhel-7-server-rpms
abrt-addon-python.x86_64                 2.1.11-35.el7             @rhel-7-server-rpms
abrt-addon-vmcore.x86_64                 2.1.11-35.el7             @rhel-7-server-rpms
abrt-addon-xorg.x86_64                   2.1.11-35.el7             @rhel-7-server-rpms


시스템에 설치된 모든 package 를 나열하려면 installed 키워드를 사용하면 된다. 


yum list installed glob_expression


krb package 가 설치되어 있는지에 대한 확인 예시이다. 


~]$ yum list installed "krb?-*"
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Installed Packages
krb5-libs.x86_64                  1.13.2-10.el7                   @rhel-7-server-rpms


모든 저장소에서 설치할수 있는 모든 package 를 나열하는경우 아래와 같은 명령을 하면된다. 


yum list available glob_expression

gstreamer 와 plugin 이 포함된 이름을 가진 모든 Package 를 나열하는 예시 이다. 


~]$ yum list available gstreamer\*plugin\*
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Available Packages
gstreamer-plugins-bad-free.i686             0.10.23-20.el7         rhel-7-server-rpms
gstreamer-plugins-base.i686                 0.10.36-10.el7         rhel-7-server-rpms
gstreamer-plugins-good.i686                 0.10.31-11.el7         rhel-7-server-rpms
gstreamer1-plugins-bad-free.i686            1.4.5-3.el7            rhel-7-server-rpms
gstreamer1-plugins-base.i686                1.4.5-2.el7            rhel-7-server-rpms
gstreamer1-plugins-base-devel.i686          1.4.5-2.el7            rhel-7-server-rpms
gstreamer1-plugins-base-devel.x86_64        1.4.5-2.el7            rhel-7-server-rpms
gstreamer1-plugins-good.i686                1.4.5-2.el7            rhel-7-server-rpms


LISTING REPOSITORIES


시스템의 저장소의 정보를 확인하는 명령어 이다. 


yum repolist

기본적인 정보 이외에 좀더 자세한 정보를 확인하려면 "-v" 옵션을 추가해주면 된다. "repoinfo" 도 동일한 출력을 준다. 


yum repolist -v
yum repoinfo


사용가능한 저장소와 사용이 불가한 저장소의 정보를 모두 출력하고 싶은경우 "all" 옵션을 통해 확인이 가능하다. 


yum repolist all


Displaying Package Information


Package 에 대한 정보를 확인하려면 info 옵션을 사용하면 된단. 


yum info package_name

"abrt package" 에 대한 정보를 확인하는 예시이다. 


~]$ yum info abrt
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Installed Packages
Name        : abrt
Arch        : x86_64
Version     : 2.1.11
Release     : 35.el7
Size        : 2.3 M
Repo        : installed
From repo   : rhel-7-server-rpms
Summary     : Automatic bug detection and reporting tool
URL         : https://fedorahosted.org/abrt/
License     : GPLv2+
Description : abrt is a tool to help users to detect defects in applications and
            : to create a bug report with all information needed by maintainer to fix
            : it. It uses plugin system to extend its functionality.


USING YUMDB


"yumdb" 명령을 이용해서 Package 에 대한 유용한 정보를 얻을수 있다. 


yumdb info package_name

yumdb 로 yum package 에 대한 정보를 확인하는 예시이다. 


~]$ yumdb info yum
Loaded plugins: langpacks, product-id
yum-3.4.3-132.el7.noarch
     changed_by = 1000
     checksum_data = a9d0510e2ff0d04d04476c693c0313a11379053928efd29561f9a837b3d9eb02
     checksum_type = sha256
     command_line = upgrade
     from_repo = rhel-7-server-rpms
     from_repo_revision = 1449144806
     from_repo_timestamp = 1449144805
     installed_by = 4294967295
     origin_url = https://cdn.redhat.com/content/dist/rhel/server/7/7Server/x86_64/os/Packages/yum-3.4.3-132.el7.noarch.rpm
     reason = user
     releasever = 7Server
     var_uuid = 147a7d49-b60a-429f-8d8f-3edb6ce6f4a1


Installing Packages


원하는 Package 및 의존성이 문제되는 부분을 한번에 설치하려면 "install" 옵션을 이용하면 된다. 


yum install package_name

Package 이름을 인수로 여러게를 동시에 설치 할수도 있다. 


yum install package_name package_name

저장소에서 가능하다면 .arch 를 지정해서 특정 아키텍처를 선택해서 설치할수 있다. 


yum install package_name.arch

multilib 시스템에 Package 를 설치하는 예시이다. 


sqlite package 에 i686 아키텍처를 설치


~]# yum install sqlite.i686

glob 표션식을 이용해서 유사한 Package 를 설치할수 있다. 


yum install glob_expression


audacious plugins 를 설치하는 예시이다. 


~]# yum install audacious-plugins-\*

Package 를 알수 없지만 사용하는 명령어를 알고 있을때에도 설치가 가능하다.


yum install /usr/sbin/named

yum 은 문법이 자유롭기에 패키지를 확인하는데 어느정도의 시간이 소요된다. 특정 옵션으로 문법의 범위를 줄여 패키지 확인하는 시간을 줄일수 있다. 


yum install-n name
yum install-na name.architecture
yum install-nevra name-epoch:version-release.architecture

"-n" 은 패키지의 정확한 이름으로 확인됨, -na 는 이름뒤에 아키텍처가 있다는것을 의미함, -vevra 는 정확한 패키지정보 형식으로 입력을 해야함


사용하는 명령어 "named" 는 알지만 설치된 경로가 확실치 않은경우 provides 옵션을 가지고 확인할수 있다. 


~]# yum provides "*bin/named"
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
32:bind-9.9.4-14.el7.x86_64 : The Berkeley Internet Name Domain (BIND) DNS
                            : (Domain Name System) server
Repo        : rhel-7-server-rpms
Matched from:
Filename    : /usr/sbin/named

설치에 대한 예시


~]# yum install httpd
Loaded plugins: langpacks, product-id, subscription-manager
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-12.el7 will be updated
---> Package httpd.x86_64 0:2.4.6-13.el7 will be an update
--> Processing Dependency: 2.4.6-13.el7 for package: httpd-2.4.6-13.el7.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-12.el7 will be updated
---> Package httpd-tools.x86_64 0:2.4.6-13.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved
================================================================================
 Package        Arch      Version                 Repository               Size
================================================================================
Updating:
 httpd          x86_64    2.4.6-13.el7            rhel-x86_64-server-7    1.2 M
Updating for dependencies:
 httpd-tools    x86_64    2.4.6-13.el7            rhel-x86_64-server-7     77 k

Transaction Summary
================================================================================
Upgrade  1 Package (+1 Dependent package)

Total size: 1.2 M
Is this ok [y/d/N]:
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : httpd-tools-2.4.6-13.el7.x86_64                             1/4 
  Updating   : httpd-2.4.6-13.el7.x86_64                                   2/4 
  Cleanup    : httpd-2.4.6-12.el7.x86_64                                   3/4 
  Cleanup    : httpd-tools-2.4.6-12.el7.x86_64                             4/4 
  Verifying  : httpd-2.4.6-13.el7.x86_64                                   1/4 
  Verifying  : httpd-tools-2.4.6-13.el7.x86_64                             2/4 
  Verifying  : httpd-tools-2.4.6-12.el7.x86_64                             3/4 
  Verifying  : httpd-2.4.6-12.el7.x86_64                                   4/4 

Updated:
  httpd.x86_64 0:2.4.6-13.el7

Dependency Updated:
  httpd-tools.x86_64 0:2.4.6-13.el7

Complete!

설치를 local 디렉토리에 하고싶은경우 아래의 명령을 통해 가능하다. 


yum localinstall path


Downloading Packages


...
Total size: 1.2 M
Is this ok [y/d/N]:    
...

위의 옵션을 선택하면 package 가 바로 설치되지 않고 다운로드 된다. 

yum localinstall 명령으로 오프라인으로 설치할수 있고, 다른 장비와 공유도 가능하다.                                                                                                                                                                                                                                                                                             

default /var/cache/yum/$basearch/$releasever/packages/


Removing Packages


Package 를 설치할수 있을 뿐 아니라 삭제도 가능하다, 의존성이 걸리는 Package 는 전부다 삭제가 된다.                                                               


yum remove package_name

totem 이라는 Package 를 삭제하는 예시 


~]# yum remove totem


WORKING WITH PACKAGE GROUPS


Listing Package Groups


"summary" 옵션은 설치된그룸, 사용 가능한 그룹, 사용가능한 환경 그룹, 설치된 언어그룹, 사용가능한 언어그룹을 보여준다. 


yum groups summary

yum groups 의 summary 를 보여주는 예시


~]$ yum groups summary 
Loaded plugins: langpacks, product-id, subscription-manager
Available Environment Groups: 12
Installed Groups: 10
Available Groups: 12

저장소의 모든 Package 를 나열하려면 list 를 추가하면 된다. 

yum group list glob_expression

특정 그룹에 포함된 패키지를 보고싶으면 아래와 같은 명령을 사용


yum group info glob_expression

LibreOffice package group 을 보고 싶은 경우의 예시


 ~]$ yum group info LibreOffice
Loaded plugins: langpacks, product-id, subscription-manager

Group: LibreOffice
 Group-Id: libreoffice
 Description: LibreOffice Productivity Suite
 Mandatory Packages:
  =libreoffice-calc
   libreoffice-draw
  -libreoffice-emailmerge
   libreoffice-graphicfilter
  =libreoffice-impress
  =libreoffice-math
  =libreoffice-writer
  +libreoffice-xsltfilter
 Optional Packages:
   libreoffice-base
   libreoffice-pyuno

위의 내용을 보게되면 Package 이름에 여러가지 기호값이 확인됨


"-" Package 가 설치되어 있지 않음, Package Group 으로 설치되지 않음

"+" Package 가 설치되어 있지 않음, yum upgrade or yum group upgrade 로 설치됨

"=" Package 가 설치되어 있음, Group 의 일부분으로 설치됨

" " Package 가 설치되어 있음, Package Group을 통해 설치가 된것이 아님, yum group remove 시에 삭제되지 않음


group_command 의 parameter 가 object 인 경우에 유효하며, 해당 설정은 Default 값이다. 

yum group mark 명령을 이용해서 위의 parameter 를 변경할수 있음



Installing a Package Group


Package Group 에는  이름 과 Group ID 가 있음 Group Package 의 Name 과 Group ID 를 나열하려면 아래의 명령어를 실행


yum group list ids 

KDE 데스크탑 환경 관련 그룹의 정보를 확인하는 예시


~]$ yum group list ids kde\*
Available environment groups:
   KDE Plasma Workspaces (kde-desktop-environment)
Done

일부 그룹은 저장소의 설정에 의해 보이지 않을수도 있다. 숨겨진 Group 을 확인하려면 "hidden" 옵션을 추가


~]$ yum group list hidden ids kde\*
Loaded plugins: product-id, subscription-manager
Available Groups:
   KDE (kde-desktop)
Done

group id 가 아닌 전체 group name 을 가지고 group install 을 수행할수 있음, root 권한으로 수행해야함


yum group install "group name"

group id 로 설치 가능


yum group install groupid

@ symbol 을 이용해서 group id 나 quoted group name 으로 정보를 전달해서 install 을 할수 있다.


yum install @group

yum install @^group


KDE Desktop group 을 4가지 방법으로 설치하는것에 대한 예시이다. 


~]# yum group install "KDE Desktop"
~]# yum group install kde-desktop
~]# yum install @"KDE Desktop"
~]# yum install @kde-desktop


Removing a Package Group 


Package 를 삭제하는것도 위의 4가지 방식이 전부 가능하다. 


yum group remove group_name
yum group remove groupid
yum remove @group

yum remove @^group


KDE Desktop group 을 4가지 방법으로 삭제하는것에 대한 예시 이다. 


~]# yum group remove "KDE Desktop"
~]# yum group remove kde-desktop
~]# yum remove @"KDE Desktop"
~]# yum remove @kde-desktop


WORKING WITH TRANSACTION HISTORY


yum history 를 통해서 yum transaction 정보를 추적할수 있다. 또한 특정 transaction 을 실행 취소하거나, 다시 실행할수가 있다.  

/var/lib/yum/history/ 디렉토리에 저장됨


Listing Transactions


최근 20개의 transaction 을 표시하려면 list 옵션을 추가하면 된다. 


yum history list

모든 transaction 을 표시하려면 all 키워드를 추가


yum history list all

한정된 범위의 transaction 만 표시하는경우 아래의 형식으로 진행


yum history list start_id..end_id

특정 Package 혹은 package 와 관련된 transaction 만 나열이 가능, glob 표현식을 이용


yum history list glob_expression

5개의 가장 오래된 transaction 을 나열하는 예시이다. 


~]# yum history list 1..5
Loaded plugins: langpacks, product-id, subscription-manager
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
     5 | User <user>              | 2013-07-29 15:33 | Install        |    1
     4 | User <user>              | 2013-07-21 15:10 | Install        |    1
     3 | User <user>              | 2013-07-16 15:27 | I, U           |   73
     2 | System <unset>           | 2013-07-16 15:19 | Update         |    1
     1 | System <unset>           | 2013-07-16 14:38 | Install        | 1106
history list

ID - transaction 을 식별하는 정수 값

Login user - transaction 을 시작하는데 사용된 user 이름

Date and time - transaction 이 발행된 날짜 와 시간

Action(s) - transaction 수행된 작업 목록

Altered - transaction 에 영향을 받은 Package 의 수


ActionAbbreviationDescription
DowngradeDAt least one package has been downgraded to an older version.
EraseEAt least one package has been removed.
InstallIAt least one new package has been installed.
ObsoletingOAt least one package has been marked as obsolete.
ReinstallRAt least one package has been reinstalled.
UpdateUAt least one package has been updated to a newer version.


SymbolDescription
<Before the transaction finished, the rpmdb database was changed outside yum.
>After the transaction finished, the rpmdb database was changed outside yum.
*The transaction failed to finish.
#The transaction finished successfully, but yum returned a non-zero exit code.
EThe transaction finished successfully, but an error or a warning was displayed.
PThe transaction finished successfully, but problems already existed in the rpmdbdatabase.
sThe transaction finished successfully, but the --skip-broken command-line option was used and certain packages were skipped.


rpmdb 와 yumdb 동기화 하기위해 sync 를 진행한다. 


yum history sync

history database 에 대한 통계 정보를 확인하기 위해서 "stats" 를 이용한다. 


"stats" 를 사용한 출력에 대한 예시이다. 


~]# yum history stats
Loaded plugins: langpacks, product-id, subscription-manager 
File        : //var/lib/yum/history/history-2012-08-15.sqlite
Size        : 2,766,848
Transactions: 41
Begin time  : Wed Aug 15 16:18:25 2012
End time    : Wed Feb 27 14:52:30 2013
Counts      :
  NEVRAC :  2,204
  NEVRA  :  2,204
  NA     :  1,759
  NEVR   :  2,204
  rpm DB :  2,204
  yum DB :  2,204
history stats

"summary" 를 통해서 이전 transaction 요약 정보를 확인할수 있다. 


yum history summary

transaction 범위를 지정해서 확인이 가능하다. 


yum history summary start_id..end_id

yum history list 와 마찬가지로 glob_expression 을 이용해서 질의가 가능하다. 


yum history summary glob_expression

Summary 를 이용해서 가장 마지막의 5개의 transaction 을 확인하는 예시이다. 


~]# yum history summary 1..5
Loaded plugins: langpacks, product-id, subscription-manager
Login user                 | Time                | Action(s)        | Altered 
-------------------------------------------------------------------------------
Jaromir ... <jhradilek>    | Last day            | Install          |        1
Jaromir ... <jhradilek>    | Last week           | Install          |        1
Jaromir ... <jhradilek>    | Last 2 weeks        | I, U             |       73
System <unset>             | Last 2 weeks        | I, U             |     1107
history summary

summary 의 내용은 list 와 비슷한 형식으로 출력이 된다. 


특정 Package 의 transaction 을 확인하려면 아래의 명령어로 가능하다. 


yum history package-list glob_expression

subscription-manager package 의 transaction 을 확인하는 예시이다. 


~]# yum history package-list subscription-manager\*
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
ID     | Action(s)      | Package
-------------------------------------------------------------------------------
     2 | Updated        | subscription-manager-1.13.22-1.el7.x86_64          EE
     2 | Update         |                      1.15.9-15.el7.x86_64          EE
     2 | Obsoleted      | subscription-manager-firstboot-1.13.22-1.el7.x86_64 EE
     2 | Updated        | subscription-manager-gui-1.13.22-1.el7.x86_64      EE
     2 | Update         |                          1.15.9-15.el7.x86_64      EE
     2 | Obsoleting     | subscription-manager-initial-setup-addon-1.15.9-15.el7.x86_64 EE
     1 | Install        | subscription-manager-1.13.22-1.el7.x86_64
     1 | Install        | subscription-manager-firstboot-1.13.22-1.el7.x86_64
     1 | Install        | subscription-manager-gui-1.13.22-1.el7.x86_64
history package-list


Examining Transactions


단일 transaction 의 정보를 확인하려면 summary 뒤에 id 값을 붙여주면 된다. 


yum history summary id

transaction 에 대해 좀더 자세한 정보를 알고자 한다면 info 를 이용하자


yum history info id

id 값을 생략하게되면 가장 마지막 transaction 값을 사용하며, 둘 이상의 transaction 값을 확인하고자 할때에 범위 값으로 지정이 가능하다. 


yum history info start_id..end_id

2개의 transaction 에 대해 info 를 이용해서 정보를 확인하는 예시이다. 


~]# yum history info 4..5
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
Transaction ID : 4..5
Begin time     : Mon Dec  7 16:51:07 2015
Begin rpmdb    : 1252:d2b62b7b5768e855723954852fd7e55f641fbad9
End time       :            17:18:49 2015 (27 minutes)
End rpmdb      : 1253:cf8449dc4c53fc0cbc0a4c48e496a6c50f3d43c5
User           : Maxim Svistunov <msvistun>
Return-Code    : Success
Command Line   : install tigervnc-server.x86_64
Command Line   : reinstall tigervnc-server
Transaction performed with:
    Installed     rpm-4.11.3-17.el7.x86_64                  @rhel-7-server-rpms
    Installed     subscription-manager-1.15.9-15.el7.x86_64 @rhel-7-server-rpms
    Installed     yum-3.4.3-132.el7.noarch                  @rhel-7-server-rpms
Packages Altered:
    Reinstall tigervnc-server-1.3.1-3.el7.x86_64 @rhel-7-server-rpms
history info

transaction 진행될때에 구성옵션이 어떻게 되었는지에 대해서 확인하려면 "addon-info" 옵션을 이용하면 된다. 


yum history addon-info id

id 값을 입력하지 않으면 최신의 값을 추적하며, last 를 이용해서 최신의 값을 추적할수도 있다. 


4번째 history 에 대한 addon-info 를 사용하는 예시이다. 


~]# yum history addon-info 4
Loaded plugins: langpacks, product-id, subscription-manager
Transaction ID: 4
Available additional history information:
  config-main
  config-repos
  saved_tx

history addon-info

yum history addon-info id information



Reverting and Repeating Transactions


특정 transactions 을 되돌리려면 undo 를 이용해서 하면됨


yum history undo id

특정 transactions 을 반복하려면 "redo" 를 이용


yum history redo id

yum transactions 을 파일로 저장하고 저장한 파일을 가지고 다른 시스템에 그대로 작업을 진행할수 있다. 


yum -q history addon-info id saved_tx > file_name
yum load-transaction file_name


transaction 을 새로운 파일에 기록한다. (SQLite)

/var/lib/yum/history/ 디렉토리에 새로운 Database 파일이 작성되며, 이전 transaction 의 기록은 유지되지만 access 는 할수 없다. 


yum history new


CONFIGURING YUM AND REPOSITORIES


Setting [main] Options


/etc/yum.conf 설정중 [main] 설정에 대한 설명이다. 


[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=3

[comments abridged]

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d


assumeyes=value


yum 의 중요한 동작에 대해서 메시지를 표시할지 여부를 결정함


0(default) - 메시지를 표시

1 - 확인 메시지를 표시안함, yum -y 나 --assumeyes 옵션과 동일한 방식으로 동작함



cachedir=directory


cache file 및 database file 을 저장하는 경로를 설정

yum 의 default 값은 /var/cache/yum/$basearch/$releasever 이다. 



debuglevel=value


yum 을 실행하고나서 발생되는 메시지에 대한 Level 을 설정, Default 는 2 이며 0 값일경우 Debug 수준의 메시지를 확인할수 있다. 



exactarch=value


이미 설치된 package 를 업데이트 할때에 정확한 아키텍처를 감안하도록 설정하는 내용


0 - 정확한 아키텍처를 고려하지 않음

1(default) - 64bit 아키텍처를 업데이트할때에 32bit package 를 사용하지 않는다. 



exclude=package_name [more_package_names]


install, update 를 진행할때에 package 를 제외할수 있다. 여러 package 를 제외하는경우 공백으로 구분을 해주면 되며, 와일드카드 및 glob 표현식 사용도 가능하다. 



gpgcheck=value


gpg서명 검사를 수행해야 하는지에 대한 여부를 설정


0 - 모든 패키지 설치에 대해서 gpg 서명 검사를 비 활성화

1(default) - 모든 피키지 설치에 대해서 gqg 서명 검사를 활성화함, 모든 저장소에 대해서 검사를 하나 해당 옵션을 각각의 저장소에 설정할수도 있다. 각각의 저장소에 대해서 각각 설정이 가능하다.  저장소에 있는 설정값이 yum.conf 있는 설정보다 우선순위를 같는다. 



group_command=value


group package 설치하는것에 대한 설정을 지정

simple - package group 의 모든 구성을 설치, 이전에 설치된 package 만 upgrade 그 동안 추가된 group package 는 설치하지 않음

compat - 업그레이드 이후 추가된 package 도 설치진행

objects(default) - 이전에 설치된 그룹을 추척하고, 그룹의 일부로 설치된 package 와 별도로 설치된 package 를 구분함



group_package_types=package_type [more_package_types]


yum install 이 호출될때에 선택되는 package 유형을 선택할수 있음, default or mandatory 



history_record=value


transaction 에 대한 기록을 할지 말지에 대한 설정값

0 - transaction 에 대한 기록을 하지 않는단. 

1(default) - transaction 에 대한 기록을 지행



installonlypkgs=space separated list of packages


install 은 가능하지만 update가 되지 않는 package 에 대해서 기록할수 있다. 

설치 전용 package 목록은 yum.conf (5) man page 를 참조



installonly_limit=value


installonlypkgs 에 지정된 package 를 동시에 설치할수 있는 수를 설정, installonlypkgs 지시문의 기본값에는 여러가지 커널 패키지가 포함되어 있음으로 installonly_limit 값을 변경하면 커널 패키지에 영향을을 줌, Default 값은 3 이며 변경하는것을 권장하지 않음, 2이하로는 설정하지 않는게 좋음



keepcache=value


설치가 완료된 이후 yum 이 head 및 package 의 cache 를 유지하는지 여부를 설정

0(default) - 설치가 완료된 이후 header 및 package 의 cache 를 유지하지 않음

1 - 설치 완료 후 cache 를 보존



logfile=file_name


로그 파일 위치를 설정하는 내용, Default 로는 /var/log/yum.log 에 기록이 됨



max_connenctions=number


최대 동시 연결수를 설정, Default 는 5 



multilib_policy=value


설치시 여러 아키텍처를 사용할수 있는경우 설치 동작에 대한 부분을 설정한다. 

best - 이 시스템에 가장 적합한 아키텍처를 설치함, 예를 들어 amd64 시스템에서는 best 설정을 하게되면 모든 package 를 64bit 로 설치

all - 모든 package 에 설치 가능한 모든 아키텍처를 설치함, amd64 시스템에서 all 인경우 i686 amd64 버전의 모든 package 를 사용할수 있는경우 전부 설치를함



obsoletes=value


0 — Disable yum's obsoletes processing logic when performing updates.

1 (default) — Enable yum's obsoletes processing logic when performing updates.



plugins=value


yum plugin 을 활성화 및 비 활성화 하는 옵션이다. 


0 - 모든 yum plugin 을 비활성화

yum plugin 은 yum service 를 구성하는데 있어서 큰 역활을 한다. 예를 들면 product-id, subscription-manager plugin 은 인증서 기반의 cdn 을 지원한다. 

1(default) - 모든 yum plugin 을 활성화 한다. 



reposdir=directory


directory 는 repo 파일이 있는 절대경로를 의미함, reposdir 이 설정되어 있지 않은경우 /etc/yum.repos.d/ 를 default 로 사용한다. 



retries=value


yum 이 오류를 반환하기까지 파일 검색을 시도하는 횟수, 0 을 설정하는경우 오류를 반환하지 않고 무한대로 재시도를 한다. Default 는 10이다. 





Setting [repository] Options


저장소의 최소 설정


[repository]
name=repository_name
baseurl=repository_url

name=repository_name

저장소의 이름을 지칭


baseurl=repository_url

repodata 가 있는 URL을 의미함

HTTP 사용가능 http://path/to/repo

FTP 사용가능 ftp://path/to/repo

local 사용가능하면 file://path/to/local/repo


http 에 인증이 필요한경우 사용자 및 암호를 넣어서 적을수 있다. 

http://user:password@www.example.com/repo/.


HTTP URL 을 사용하는 예시


baseurl=http://path/to/repo/releases/$releasever/server/$basearch/os/
enabled=value


yum 이 특정 저장소를 사용하거나 사용하지 않는것에 대한 설정

0 - 이 저장소를 package source 로 사용하지 않는다. 

1 - 이 저장소를 package source  로 사용한다. 


--enablerepo=repo_name 과 --disablerepo=repo_name 옵션으로 키고 끄고를 할수 있다. 


async=value


저장소 package 의 병령 다운로드에 대한것을 제어

auto(default) - 가능한경우 병렬 다운로드를 진행하며 plugin 을 통해서 오류가 나면 disable 처리를 한다. 

on - 병렬 다운로드 가능

off - 병렬다운로드 사용하지 않음


더 많은 저장소 옵션이 있지만 yum.conf [main] 형태와 기능이 동일하다. 


/etc/yum.repos.d/redhat.repo file 의 예시이다. 


#
# Red Hat Repositories
# Managed by (rhsm) subscription-manager
#

[red-hat-enterprise-linux-scalable-file-system-for-rhel-6-entitlement-rpms]
name = Red Hat Enterprise Linux Scalable File System (for RHEL 6 Entitlement) (RPMs)
baseurl = https://cdn.redhat.com/content/dist/rhel/entitlement-6/releases/$releasever/$basearch/scalablefilesystem/os
enabled = 1
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/key.pem
sslclientcert = /etc/pki/entitlement/11300387955690106.pem

[red-hat-enterprise-linux-scalable-file-system-for-rhel-6-entitlement-source-rpms]
name = Red Hat Enterprise Linux Scalable File System (for RHEL 6 Entitlement) (Source RPMs)
baseurl = https://cdn.redhat.com/content/dist/rhel/entitlement-6/releases/$releasever/$basearch/scalablefilesystem/source/SRPMS
enabled = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/key.pem
sslclientcert = /etc/pki/entitlement/11300387955690106.pem

[red-hat-enterprise-linux-scalable-file-system-for-rhel-6-entitlement-debug-rpms]
name = Red Hat Enterprise Linux Scalable File System (for RHEL 6 Entitlement) (Debug RPMs)
baseurl = https://cdn.redhat.com/content/dist/rhel/entitlement-6/releases/$releasever/$basearch/scalablefilesystem/debug
enabled = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
sslverify = 1
sslcacert = /etc/rhsm/ca/redhat-uep.pem
sslclientkey = /etc/pki/entitlement/key.pem
sslclientcert = /etc/pki/entitlement/11300387955690106.pem


Using Yum Variables


yum 내부에서 사용되는 변수에 대한 내용


$releasever

리눅스 릴리즈 버전을 변수로 사용이 가능하다. redhat-release 파일을 참조한다. 


$arch

CPU 아키텍처를 호출해서 사용할수 있다. Python 의 os.name() 의 값을 참조한다. i586, i686, x86_64 가 유효하다. 


$basearch

base 아키텍처를 사용할수 있다. 예를 들자면 i686, i586 은 i386을 base 로 사용할수 있으며, AMD64, Intel64 는 x86_64 를 base 로 가질수 있다. 


$YUM0-9

동일한 이름을 가진 shell 환경 변수 값으로 대체됨


사용자가 정의하는 변수는 /etc/yum/vars/ 에 파일로 생성을 하면 된다. 

~]# echo "Red Hat Enterprise Linux 7" > /etc/yum/vars/osname

name=$osname $releasever



Viewing the Current Configuration


[main] 의 값을 확인하는 내용이다. 


yum-config-manager
yum-config-manager section
yum-config-manager glob_expression

main section 을 확인하는 예시


~]$ yum-config-manager main \*
Loaded plugins: langpacks, product-id, subscription-manager
================================== main ===================================
[main]
alwaysprompt = True
assumeyes = False
bandwith = 0
bugtracker_url = https://bugzilla.redhat.com/enter_bug.cgi?product=Red%20Hat%20Enterprise%20Linux%206&component=yum
cache = 0
[output truncated]










'Linux > Redhat 7 system administrator's guide' 카테고리의 다른 글

5. GAINING PRIVILEGES  (0) 2017.07.14
4. ACCESS CONTROL LISTS  (0) 2017.07.11
3. MANAGING USERS AND GROUPS  (0) 2017.07.05
2. CONFIGURING THE DATE AND TIME  (0) 2017.03.16
1. system locale and keyboard configuration  (0) 2017.03.16

+ Recent posts