centos rpm to save locally and completely uninstall software packages using the yum

Rpm to save the installation of local

method one:

[root@ServerA ~]# vim /etc/yum.conf 
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
#修改keepcache=1即可在yum安装时保存rpm包
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/
bug_report_page.php?category=yum
distroverpkg=centos-release       

For centos7 it can by ls /var/cache/yum/x86_64/7/viewing all download records

Method 2 (recommended):

yum install -y 包名 -–downloadonly

Download the RPM package without installing

yum install -y 包名 -–downloadonly -–downloaddir=路径

Downloaded to the specified directory

yum reinstall -y 包名 -–downloadonly -–downloaddir=路径

Download the RPM package has been installed to the specified directory

yum uninstall packages including reliance

Applications: When we installed the package contains more dependent, want to completely uninstall the software package and dependence

  1. By yum history listlisted yum install / uninstall history Note ID number
[root@ServerB ~]# yum history list
Loaded plugins: fastestmirror, langpacks
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    30 | install -y samba*        | 2019-12-03 18:45 | I, U           |   47   
    29 | history undo 24          | 2019-12-03 17:39 | Install        |   13   
    28 | history undo 27          | 2019-12-03 17:38 | Erase          |    1   
    27 | install -y bind-utils –d | 2019-12-03 17:32 | Install        |    1   
    26 | remove -y bind-utils     | 2019-12-03 17:31 | Erase          |    5   
  1. Using yum history undo IDto uninstall dependent communication
[root@ServerB ~]# 
[root@ServerB ~]# yum history undo 30
Loaded plugins: fastestmirror, langpacks
Undoing transaction 30, from Tue Dec  3 18:45:26 2019
    Updated     dbus-1:1.6.12-13.el7.x86_64                     @anaconda
    Update           1:1.10.24-13.el7_6.x86_64                  @base
    Updated     dbus-libs-1:1.6.12-13.el7.x86_64                @anaconda
    Update                1:1.10.24-13.el7_6.x86_64             @base
    Updated     dbus-x11-1:1.6.12-13.el7.x86_64                 @anaconda
    Update               1:1.10.24-13.el7_6.x86_64              @base
    Updated     glusterfs-3.7.1-16.el7.x86_64                   @anaconda
    Update                3.12.2-47.2.el7.x86_64                @base
    Updated     glusterfs-api-3.7.1-16.el7.x86_64               @anaconda
    Update                    3.12.2-47.2.el7.x86_64            @base
    Updated     glusterfs-client-xlators-3.7.1-16.el7.x86_64    @anaconda
    Update                               3.12.2-47.2.el7.x86_64 @base
    Updated     glusterfs-fuse-3.7.1-16.el7.x86_64              @anaconda

    ...
    ...
    
---> Package pyldb.x86_64 0:1.4.2-1.el7 will be erased
---> Package python-tdb.x86_64 0:1.3.16-1.el7 will be erased
---> Package python-tevent.x86_64 0:0.9.37-1.el7 will be erased
---> Package samba.x86_64 0:4.9.1-6.el7 will be erased
---> Package samba-dc.x86_64 0:4.9.1-6.el7 will be erased
---> Package samba-dc-libs.x86_64 0:4.9.1-6.el7 will be erased
---> Package samba-devel.x86_64 0:4.9.1-6.el7 will be erased
---> Package samba-krb5-printing.x86_64 0:4.9.1-6.el7 will be erased
---> Package samba-pidl.noarch 0:4.9.1-6.el7 will be erased
---> Package samba-python.x86_64 0:4.9.1-6.el7 will be erased
---> Package samba-python-test.x86_64 0:4.9.1-6.el7 will be erased
---> Package samba-test.x86_64 0:4.9.1-6.el7 will be erased
    
    ...
    ...
 
 glusterfs-libs                   x86_64       3.7.1-16.el7               -              0.0  
 glusterfs-api                    x86_64       3.7.1-16.el7               -              0.0  
 samba-common                     noarch       4.2.3-10.el7               -              0.0  
 libwbclient                      x86_64       4.2.3-10.el7               -              0.0  
 samba-common-tools               x86_64       4.2.3-10.el7               -              0.0  
 samba-libs                       x86_64       4.2.3-10.el7               -              0.0  

Transaction Summary
===============================================================================================
Remove         22 Packages (+1 Dependent package)
Not available  25 Packages

Installed size: 33 M
Is this ok [y/N]: 

Type y to uninstall

Guess you like

Origin www.cnblogs.com/xbroad/p/11978772.html