说起来有点绕口,这个需求是这样的。

就是我yum装A包的时候,同时安装了A的依赖包a1,a2,a3。

当我们使用yum remove A卸载A包的是,a1,a2,a3包并不会一同被卸载掉。如果他们没有用了,即除了A并没有其他包依赖他们的话,他们也应该一同被卸载掉。

在arch里,我们有pacman -Rsun等复杂的命令搞定这件事(pacman这一套我确实也没用学的很明白,有时间还有再好好学一学。)

并且我们还有,pacman -Qdt。pacman -Qet 。pactree,等命令来清澈的管理所有包和他们直接的依赖树,以及谁是孤立的,谁是曾经被依赖如今可以删的。

所以,在CentOS里,yum该怎么做才能达到这些目的呢?我当前的要求很简单,就是remove的时候,把依赖一起带走就可以了。

分别 man yum 和man yum.conf 之后发现是可以的。

方法一:使用 yum autoremove

       autoremove

              With one or more arguments this command works like running the "remove" command with the clean_requirements_on_remove turned on. However you can also
specify no arguments, at which point it tries to remove any packages that weren't installed explicitly by the user and which aren't required by any‐
thing (so called leaf packages). Because autoremove does a lot of work to make it as easy as possible to use, there are also a few specific autoremove commands "autoremove-n",
"autoremove-na" and "autoremove-nevra". These only work on package names, and do not process wildcards etc.

方法二:在yum.conf中设置参数 clean_requirements_on_remove 然后使用 yum remove xxx

              clean_requirements_on_remove When removing packages (by removal, update or obsoletion) go through each package's dependencies. If any of them are  no
longer required by any other package then also mark them to be removed. Boolean (, , True, False, yes, no) Defaults to False

好吧,说的这么费劲其实答案就是 aoturemove

[root@dpdk ~]# rpm -qa |grep dpdk
dpdk-2.2.-.el7.x86_64
dpdk-devel-2.2.-.el7.x86_64
[root@dpdk ~]# yum autoremove dpdk-devel
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package dpdk-devel.x86_64 :2.2.-.el7 will be erased
--> Finished Dependency Resolution
--> Finding unneeded leftover dependencies
---> Marking dpdk to be removed - no longer needed by dpdk-devel
Found and removing unneeded dependencies
--> Running transaction check
---> Package dpdk.x86_64 :2.2.-.el7 will be erased
--> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Removing:
dpdk-devel x86_64 2.2.-.el7 @extras 1.4 M
Removing for dependencies:
dpdk x86_64 2.2.-.el7 @extras 2.7 M Transaction Summary
========================================================================================================================================================================
Remove Package (+ Dependent package) Installed size: 4.1 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : dpdk-devel-2.2.-.el7.x86_64 /
Erasing : dpdk-2.2.-.el7.x86_64 /
Verifying : dpdk-devel-2.2.-.el7.x86_64 /
Verifying : dpdk-2.2.-.el7.x86_64 / Removed:
dpdk-devel.x86_64 :2.2.-.el7 Dependency Removed:
dpdk.x86_64 :2.2.-.el7 Complete!
[root@dpdk ~]# rpm -qa |grep dpdk
[root@dpdk ~]#

最后,亲测可用,当当当当!:)

[daily][CentOS][yum] 删除包的同时一同清理掉安装时一起装进来的依赖包的更多相关文章

  1. CentOS yum安装软件时保留安装包及依赖包或者自动下载安装包及相关依赖包

    CentOS上安装某个软件一般都有很多相关的依赖包,当然,这也与我们安装时software selection步骤中选择的版本有关系,我们服务器在安装CentOS时一般选择Basic Web Serv ...

  2. idea调试框架时如何能够进入maven依赖包的源码

    最近用idea使用spring security做登录与权限控制,在调试过程中碰到问题,经常需要断点追踪源码,深入查看其中问题.但是maven中引用的包,进入后都是.class文件,非源码.导致查看时 ...

  3. 手把手安装Laravel框架(permissions扩展包)实现RBAC权限---以及一些安装时的ERROR

    a.依赖管理工具,框架,环境 1.composer 2.laravel(我的是5.5) 3.PHP(我的7.2),MySql(我的5.7) b,安装 1.首先需要安装一个干净的 Laravel 项目, ...

  4. redhad借用CentOs yum 安装

    RedHat linux 默认是安装了yum软件的,但是由于激活认证的原因让redhat无法直接进行yum安装一些软件,如果我们需要在redhat下直接yum安装软件,我们只用把yum的源修改成Cen ...

  5. keeplived离线安装openssl-devel依赖包

    转载自素文宅博客:https://blog.yoodb.com/yoodb/article/detail/1434 由于公司业务并发比较高需要高可用使用LVS keeplived.在linux系统ce ...

  6. 记 Maven 本地仓库埋坑之依赖包为何不能用

    记一次 Maven 本地仓库埋坑之 Verifying Availability 背景 某 Java 后端项目使用 maven 构建,因为某些原因,某些依赖库下载不了,直接找其它人索要了他电脑上的 m ...

  7. go依赖包管理工具vendor基础

    go依赖包管理工具vendor基础 vendor是go的依赖包管理工具,主要用于管理项目中使用到的一些依赖. 它将项目依赖的包,特指外部包,复制到当前工程下的vendor目录下,这样go build的 ...

  8. Maven将依赖包、jar/war包及配置文件输出到指定目录

    使用Maven插件将依赖包 jar包 war包及配置文件输出到指定目录 写在前面 ​ 最近遇到一个朋友遇到一个项目需要将 maven 的依赖包和配置文件分开打包然后用脚本执行程序.这样的好处在于可以随 ...

  9. Python一键安装全部依赖包

    requirements.txt用来记录项目所有的依赖包和版本号,只需要一个简单的pip命令就能完成. pip freeze >requirements.txt 然后就可以用 pip insta ...

随机推荐

  1. Mosquitto关于Connection lost的问题。

    文章发自:http://www.cnblogs.com/hark0623/p/4175048.html  转发请注明 如果当你的客户端订阅(sub)mqtt时,发现出现Connection lost ...

  2. Java的锁优化

    高效并发是从JDK 1.5到JDK 1.6的一个重要改进,HotSpot虚拟机开发团队在这个版本上花费了大量的精力去实现各种锁优化技术,如适应性自旋(Adaptive Spinning).锁消除(Lo ...

  3. PHP 读取逐条数据库记录,以及提交下拉菜单选项

    <?php $db_host=localhost; //MYSQL服务器名$db_user=root; //MYSQL用户名$db_pass="******"; //MYSQ ...

  4. html5 header和group

    <html> <head> <meta charset="UTF-8" /> <meta name="generator&quo ...

  5. POJ1850 Code(组合+康托展开)

    题目问一个合法字符串的字典序是第几个,合法的字符串是指里面的字符严格递增. 先判断合不合法,然后用类似康托展开的过程去求.大概过程就是用组合数算出某长度某前缀有几个,累加起来. 真难一遍写对.. #i ...

  6. HDU4081 Qin Shi Huang's National Road System(次小生成树)

    枚举作为magic road的边,然后求出A/B. A/B得在大概O(1)的时间复杂度求出,关键是B,B是包含magic road的最小生成树. 这么求得: 先在原图求MST,边总和记为s,顺便求出M ...

  7. python 代码片段12

    #coding=utf-8 d={'title':'python web development','year':2008} print d.setdefault('pub','addision we ...

  8. BZOJ2773 : ispiti

    首先询问i相当于询问a[j]>=a[i],b[j]>=b[i]的j 如果b[j]==b[i],那么a[j]>a[i],这种情况先用set处理掉 如果b[j]>b[i],那么a[ ...

  9. [Java] StringBuffer类

    http://www.cnblogs.com/springcsc/archive/2009/12/03/1616330.html 注: StringBuffer类和String一样,也用来代表字符串, ...

  10. 【BZOJ】3809: Gty的二逼妹子序列

    http://www.lydsy.com/JudgeOnline/problem.php?id=3809 题意:n个元素(1<=n<=100000)每个元素有一权值<=n.q个询问, ...