반응형
yum 이란 repository 를 통해 rpm 을 배포하고 의존성 관리를 하므로 손쉽게 패키지를 관리할수 있다.
1. yum 명령어로 rpm 추출
# yum install --downloadonly --downloaddir=/yumlocal python
의존성이 있는 경우 같이 설치된다는 장점이 있다.
[root@localhost yumlocal]# yum install --downloadonly --downloaddir=/yumlocal python
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirror.kakao.com
* extras: mirror.kakao.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package python.x86_64 0:2.7.5-89.el7 will be updated
---> Package python.x86_64 0:2.7.5-90.el7 will be an update
--> Processing Dependency: python-libs(x86-64) = 2.7.5-90.el7 for package: python-2.7.5-90.el7.x86_64
--> Running transaction check
---> Package python-libs.x86_64 0:2.7.5-89.el7 will be updated
---> Package python-libs.x86_64 0:2.7.5-90.el7 will be an update
updates/7/x86_64/filelists_db | 7.0 MB 00:00:01
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================
Package Arch Version Repository Size
==========================================================================================================
Updating:
python x86_64 2.7.5-90.el7 updates 96 k
Updating for dependencies:
python-libs x86_64 2.7.5-90.el7 updates 5.6 M
Transaction Summary
==========================================================================================================
Upgrade 1 Package (+1 Dependent package)
Total download size: 5.7 M
Background downloading packages, then exiting:
exiting because "Download Only" specified
2. # yum localinstall *.rpm
받은 rpm 파일 설치
[root@localhost yumlocal]# yum localinstall *.rpm
Loaded plugins: fastestmirror, langpacks
Examining python-2.7.5-90.el7.x86_64.rpm: python-2.7.5-90.el7.x86_64
Marking python-2.7.5-90.el7.x86_64.rpm as an update to python-2.7.5-89.el7.x86_64
Examining python-libs-2.7.5-90.el7.x86_64.rpm: python-libs-2.7.5-90.el7.x86_64
Marking python-libs-2.7.5-90.el7.x86_64.rpm as an update to python-libs-2.7.5-89.el7.x86_64
Resolving Dependencies
--> Running transaction check
---> Package python.x86_64 0:2.7.5-89.el7 will be updated
---> Package python.x86_64 0:2.7.5-90.el7 will be an update
---> Package python-libs.x86_64 0:2.7.5-89.el7 will be updated
---> Package python-libs.x86_64 0:2.7.5-90.el7 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================
Package Arch Version Repository Size
==========================================================================================================
Updating:
python x86_64 2.7.5-90.el7 /python-2.7.5-90.el7.x86_64 79 k
python-libs x86_64 2.7.5-90.el7 /python-libs-2.7.5-90.el7.x86_64 24 M
Transaction Summary
==========================================================================================================
Upgrade 2 Packages
Total size: 24 M
Is this ok [y/d/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Updating : python-libs-2.7.5-90.el7.x86_64 1/4
Updating : python-2.7.5-90.el7.x86_64 2/4
Cleanup : python-2.7.5-89.el7.x86_64 3/4
Cleanup : python-libs-2.7.5-89.el7.x86_64 4/4
Verifying : python-2.7.5-90.el7.x86_64 1/4
Verifying : python-libs-2.7.5-90.el7.x86_64 2/4
Verifying : python-2.7.5-89.el7.x86_64 3/4
Verifying : python-libs-2.7.5-89.el7.x86_64 4/4
Updated:
python.x86_64 0:2.7.5-90.el7 python-libs.x86_64 0:2.7.5-90.el7
Complete!
3. # yum history
yum 으로 설치하거나 삭제했던 목록을 확인
[root@localhost yumlocal]# yum history
Loaded plugins: fastestmirror, langpacks
ID | Login user | Date and time | Action(s) | Altered
-------------------------------------------------------------------------------
2 | root <root> | 2021-12-07 13:30 | Update | 2 <
1 | System <unset> | 2021-12-02 08:52 | Install | 1487 >
history list
4. # yum history undo 2
뒤에 있는 숫자는 ID값
yum 목록에 있는 순서 실행취소 (삭제, 재설치)
[root@localhost yumlocal]# yum history undo 2
Loaded plugins: fastestmirror, langpacks
Undoing transaction 2, from Tue Dec 7 13:30:40 2021
Updated python-2.7.5-89.el7.x86_64 @anaconda
Update 2.7.5-90.el7.x86_64 @/python-2.7.5-90.el7.x86_64
Updated python-libs-2.7.5-89.el7.x86_64 @anaconda
Update 2.7.5-90.el7.x86_64 @/python-libs-2.7.5-90.el7.x86_64
Loading mirror speeds from cached hostfile
* base: mirror.kakao.com
* extras: mirror.kakao.com
* updates: mirror.navercorp.com
Resolving Dependencies
--> Running transaction check
---> Package python.x86_64 0:2.7.5-89.el7 will be a downgrade
---> Package python.x86_64 0:2.7.5-90.el7 will be erased
---> Package python-libs.x86_64 0:2.7.5-89.el7 will be a downgrade
---> Package python-libs.x86_64 0:2.7.5-90.el7 will be erased
base/7/x86_64/filelists_db | 7.2 MB 00:00:00
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================================
Package Arch Version Repository Size
==========================================================================================================
Downgrading:
python x86_64 2.7.5-89.el7 base 96 k
python-libs x86_64 2.7.5-89.el7 base 5.6 M
Transaction Summary
==========================================================================================================
Downgrade 2 Packages
Total download size: 5.7 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/base/packages/python-2.7.5-89.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for python-2.7.5-89.el7.x86_64.rpm is not installed
(1/2): python-2.7.5-89.el7.x86_64.rpm | 96 kB 00:00:00
(2/2): python-libs-2.7.5-89.el7.x86_64.rpm | 5.6 MB 00:00:00
----------------------------------------------------------------------------------------------------------
Total 9.2 MB/s | 5.7 MB 00:00:00
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
Userid : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
Package : centos-release-7-9.2009.0.el7.centos.x86_64 (@anaconda)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-libs-2.7.5-89.el7.x86_64 1/4
Installing : python-2.7.5-89.el7.x86_64 2/4
Cleanup : python-2.7.5-90.el7.x86_64 3/4
Cleanup : python-libs-2.7.5-90.el7.x86_64 4/4
Verifying : python-2.7.5-89.el7.x86_64 1/4
Verifying : python-libs-2.7.5-89.el7.x86_64 2/4
Verifying : python-2.7.5-90.el7.x86_64 3/4
Verifying : python-libs-2.7.5-90.el7.x86_64 4/4
Removed:
python.x86_64 0:2.7.5-90.el7 python-libs.x86_64 0:2.7.5-90.el7
Installed:
python.x86_64 0:2.7.5-89.el7 python-libs.x86_64 0:2.7.5-89.el7
Complete!
기존 rpm 명령어보다 패키지 관리가 쉽다.
반응형