티스토리 뷰

Redhat 계열 Linux 들은 RPM Package를 기반으로한 Yum을 통해 패키지 관리를 수행한다.

 

Yum 통해 특정 패키지를 업데이트후 특별한 사유로 인해(Aplication Level의 의존성 문제등) 원복 및 기존버전으로 Downgrade 가 필요할 경우 아래와 같이 수행 가능하다.

 

 

가. Yum Downgrade


1. yum check-update를 통한 업데이트 패키지 정보확인 (예시 : perl)

 

[root@s-node01 ~]#
[root@s-node01 ~]# yum check-update | grep perl
perl.x86_64                            4:5.8.8-43.el5_11                updates
perl-DBD-Pg.x86_64                     1.49-4.el5_8                     base   
perl-XML-SAX.noarch                    0.14-13.el5                      base   
[root@s-node01 ~]#
[root@s-node01 ~]#

 

 

2. yum 을 통한 해당 패키지 업데이트

 

[root@s-node01 ~]#
[root@s-node01 ~]# yum -y update perl
Loaded plugins: downloadonly, fastestmirror, priorities, security
Loading mirror speeds from cached hostfile
 * base: data.nicehosting.co.kr
 * extras: data.nicehosting.co.kr
 * rpmforge: ftp.riken.jp
 * updates: data.nicehosting.co.kr
Skipping security plugin, no data
Setting up Update Process
Resolving Dependencies
Skipping security plugin, no data
--> Running transaction check
---> Package perl.x86_64 4:5.8.8-43.el5_11 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

... 중략

Install       0 Package(s)
Upgrade       1 Package(s)

Total download size: 12 M
Downloading Packages:
perl-5.8.8-43.el5_11.x86_64.rpm             |  12 MB     00:10    
Running rpm_check_debug                   
Running Transaction Test                  
Finished Transaction Test                 
Transaction Test Succeeded                
Running Transaction                       
  Repackaging    : perl                                        0/2
  Updating       : perl                                        1/2
  Cleanup        : perl                                        2/2

Updated:
  perl.x86_64 4:5.8.8-43.el5_11                                                                                                                                                                                                                                              

Complete!
[root@s-node01 ~]#

 

 

3. yum 으로 설치된 패키지에 대한 Downgrade 필요시 아래와 같이 수행

 

[root@s-node01 ~]#
[root@s-node01 ~]# yum -y downgrade perl
Loaded plugins: downloadonly, fastestmirror, priorities, security
Setting up Downgrade Process
Loading mirror speeds from cached hostfile
 * base: data.nicehosting.co.kr
 * extras: data.nicehosting.co.kr
 * rpmforge: ftp.riken.jp
 * updates: data.nicehosting.co.kr
No Match for available package: 4:perl-5.8.8-41.el5.i386
Resolving Dependencies
--> Running transaction check
---> Package perl.x86_64 4:5.8.8-42.el5 set to be updated
---> Package perl.x86_64 4:5.8.8-43.el5_11 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

... 중략

Remove        0 Package(s)
Reinstall     0 Package(s)
Downgrade     1 Package(s)

Total download size: 12 M
Downloading Packages:
perl-5.8.8-42.el5.x86_64.rpm               |  12 MB     00:10    
Running rpm_check_debug                   
Running Transaction Test                  
Finished Transaction Test                 
Transaction Test Succeeded                
Running Transaction                       
  Repackaging    : perl                                       0/2
  Installing     : perl                                       1/2
  Cleanup        : perl                                       2/2

Removed:
  perl.x86_64 4:5.8.8-43.el5_11                                                                                                                                                                                                                                              

Installed:
  perl.x86_64 4:5.8.8-42.el5                                                                                                                                                                                                                                                 

Complete!
[root@s-node01 ~]#
[root@s-node01 ~]#

 

 

 

나. Yum 을 통해 RPM Package 를 Download후 수작업을 통한 RPM Backup 및 Rollback

 

1. yum downloadonly plug-in 설치 및 plug-in 확인

 

[root@s-node01 ~]#
[root@s-node01 ~]# yum --help | grep downloadonly
[root@s-node01 ~]#
[root@s-node01 ~]# yum list | grep yum-downloadonly
This system is not registered with ULN.
ULN support will be disabled.
yum-downloadonly.noarch                       1.1.16-21.0.1.el5       el5_latest
[root@s-node01 ~]#
[root@s-node01 ~]#

[root@s-node01 ~]#
[root@s-node01 ~]# yum -y install yum-downloadonly.noarch
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum-downloadonly.noarch 0:1.1.16-21.0.1.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

 

... 중략

 

Install       1 Package(s)
Upgrade       0 Package(s)

Total size: 13 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : yum-downloadonly                                 1/1

Installed:
  yum-downloadonly.noarch 0:1.1.16

Complete!
[root@s-node01 ~]#
[root@s-node01 ~]#

[root@s-node01 ~]#
[root@s-node01 ~]# yum --help | grep download
Loaded plugins: downloadonly, rhnplugin, security
  --downloadonly        don't update, just download
  --downloaddir=DLDIR   specifies an alternate directory to store packages
[root@s-node01 ~]#
[root@s-node01 ~]#

 

 

2. Yum Repository에서 RPM Package Download (예시 : glibc )

 

[root@s-node01 ~]#
[root@s-node01 ~]# yum list | grep glibc
This system is not registered with ULN.
ULN support will be disabled.
compat-glibc.i386                             1:2.3.4-2.26            installed
compat-glibc.x86_64                           1:2.3.4-2.26            installed
compat-glibc-headers.x86_64                   1:2.3.4-2.26            installed
glibc.i686                                    2.5-81                  installed
glibc.x86_64                                  2.5-81                  installed
glibc-common.x86_64                           2.5-81                  installed
glibc-devel.i386                              2.5-81                  installed
glibc-devel.x86_64                            2.5-81                  installed
glibc-headers.x86_64                          2.5-81                  installed
glibc.i686                                    2.5-123.0.1.el5_11.1    el5_latest
glibc.x86_64                                  2.5-123.0.1.el5_11.1    el5_latest
glibc-common.x86_64                           2.5-123.0.1.el5_11.1    el5_latest
glibc-devel.i386                              2.5-123.0.1.el5_11.1    el5_latest
glibc-devel.x86_64                            2.5-123.0.1.el5_11.1    el5_latest
glibc-headers.x86_64                          2.5-123.0.1.el5_11.1    el5_latest
glibc-utils.x86_64                            2.5-123.0.1.el5_11.1    el5_latest
[root@s-node01 ~]#
[root@s-node01 ~]#
[root@s-node01 ~]# yum -y update glibc --downloadonly --downloaddir=/var/tmp
Loaded plugins: downloadonly, rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
Skipping security plugin, no data
Setting up Update Process
Resolving Dependencies
Skipping security plugin, no data
--> Running transaction check
--> Processing Dependency: glibc = 2.5-81 for package: glibc-devel
--> Processing Dependency: glibc = 2.5-81 for package: glibc-headers
--> Processing Dependency: glibc = 2.5-81 for package: glibc-devel
--> Processing Dependency: glibc = 2.5-81 for package: nscd
---> Package glibc.i686 0:2.5-123.0.1.el5_11.1 set to be updated

 

... 중략

 

exiting because --downloadonly specified
[root@s-node01 ~]#

 

 

3. 임의 영역으로 Download 한 RPM Package 의 설치 및 기존 Package Backup

 

[root@s-node01 ~]#
[root@s-node01 ~]# cd /var/tmp/
[root@s-node01 tmp]#
[root@s-node01 tmp]# ls -l
total 32776
-rw-r--r-- 1 root root  5647080 Jan 28 03:36 glibc-2.5-123.0.1.el5_11.1.i686.rpm
-rw-r--r-- 1 root root  5007817 Jan 28 03:36 glibc-2.5-123.0.1.el5_11.1.x86_64.rpm
-rw-r--r-- 1 root root 17291271 Jan 28 03:36 glibc-common-2.5-123.0.1.el5_11.1.x86_64.rpm
-rw-r--r-- 1 root root  2164300 Jan 28 03:36 glibc-devel-2.5-123.0.1.el5_11.1.i386.rpm
-rw-r--r-- 1 root root  2547507 Jan 28 03:36 glibc-devel-2.5-123.0.1.el5_11.1.x86_64.rpm
-rw-r--r-- 1 root root   616895 Jan 28 03:36 glibc-headers-2.5-123.0.1.el5_11.1.x86_64.rpm
-rw-r--r-- 1 root root   182696 Jan 28 03:36 nscd-2.5-123.0.1.el5_11.1.x86_64.rpm
[root@s-node01 tmp]#
[root@s-node01 tmp]#
[root@s-node01 tmp]#
[root@s-node01 tmp]# rpm -Uvh --repackage ./*
Preparing...                ########################################### [100%]
Repackaging...             
   1:glibc                  ########################################### [ 14%]
   2:glibc                  ########################################### [ 29%]
   3:glibc-common           ########################################### [ 43%]
   4:glibc-devel            ########################################### [ 57%]
   5:glibc-devel            ########################################### [ 71%]
   6:glibc-headers          ########################################### [ 86%]
   7:nscd                   ########################################### [100%]
Upgrading...               
   1:glibc-common           ########################################### [ 14%]
   2:glibc                  ########################################### [ 29%]
   3:nscd                   ########################################### [ 43%]
   4:glibc-headers          ########################################### [ 57%]
   5:glibc-devel            ########################################### [ 71%]
   6:glibc                  ########################################### [ 86%]
   7:glibc-devel            ########################################### [100%]
[root@s-node01 tmp]#
[root@s-node01 tmp]#

 

 

4. 설치된 RPM Package 확인 후 원복필요시 아래와 같이 수행

 

[root@s-node01 ~]#
[root@s-node01 ~]# cd /var/spool/repackage/
[root@s-node01 repackage]#
[root@s-node01 repackage]#
[root@s-node01 repackage]# ll
total 32752
-rw-r--r-- 1 root root  5645978 Feb  4 08:02 glibc-2.5-81.i686.rpm
-rw-r--r-- 1 root root  5006632 Feb  4 08:02 glibc-2.5-81.x86_64.rpm
-rw-r--r-- 1 root root 17310480 Feb  4 08:03 glibc-common-2.5-81.x86_64.rpm
-rw-r--r-- 1 root root  2148031 Feb  4 08:03 glibc-devel-2.5-81.i386.rpm
-rw-r--r-- 1 root root  2535423 Feb  4 08:03 glibc-devel-2.5-81.x86_64.rpm
-rw-r--r-- 1 root root   610244 Feb  4 08:03 glibc-headers-2.5-81.x86_64.rpm
-rw-r--r-- 1 root root   175384 Feb  4 08:03 nscd-2.5-81.x86_64.rpm
[root@s-node01 repackage]#
[root@s-node01 repackage]#
[root@s-node01 repackage]# rpm -Uvh --nomd5 --oldpackage ./*
Preparing...                ########################################### [100%]
   1:glibc-common           ########################################### [ 14%]
   2:glibc                  ########################################### [ 29%]
   3:nscd                   ########################################### [ 43%]
   4:glibc-headers          ########################################### [ 57%]
   5:glibc-devel            ########################################### [ 71%]
   6:glibc                  ########################################### [ 86%]
   7:glibc-devel            ########################################### [100%]
[root@s-node01 repackage]#

 

 

5. Rollback 된 Package 정보 확인

 

[root@s-node01 repackage]#
[root@s-node01 repackage]# rpm -qi glibc
Name        : glibc                        Relocations: (not relocatable)
Version     : 2.5                               Vendor: Oracle America
Release     : 81                            Build Date: Sat 25 Feb 2012 09:15:09 AM KST
Install Date: Wed 04 Feb 2015 08:04:58 AM KST      Build Host: ca-build10.us.oracle.com
Group       : System Environment/Libraries   Source RPM: glibc-2.5-81.src.rpm
Size        : 11683801                         License: LGPL
Signature   : DSA/SHA1, Sun 26 Feb 2012 09:58:39 AM KST, Key ID 66ced3de1e5e0159
Summary     : The GNU libc libraries.
Description :
The glibc package contains standard libraries which are used by
multiple programs on the system. In order to save disk space and
memory, as well as to make upgrading easier, common system code is
kept in one place and shared between programs. This particular package
contains the most important sets of shared libraries: the standard C
library and the standard math library. Without these two libraries, a
Linux system will not function.
[root@s-node01 repackage]#
[root@s-node01 ~]#

 

 

 

 

 

 

 

 

반응형
반응형
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday