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

就是我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. 【poj2828】Buy Tickets 线段树 插队问题

    [poj2828]Buy Tickets Description Railway tickets were difficult to buy around the Lunar New Year in ...

  2. scp 使用

    [spark-hadoop@master ~]$ sudo scp /etc/profile spark-hadoop@slave1:/etc spark-hadoop@slave1's passwo ...

  3. android上传文件到服务器

    package com.spring.sky.image.upload.network; import java.io.DataOutputStream; import java.io.File; i ...

  4. Fragments碎片

    A Fragment represents a behavior or a portion of user interface in an Activity. 在一个Activity活动中,一个Fra ...

  5. LoadRunner之自定义HTTP请求

    LoadRunner之自定义HTTP请求 性能测试开发脚本时使用的都是同样的模式.对在性能测试规划时指定的典型业务逻辑场景进行录制,形成基本的脚本骨架. 录制脚本后需要对脚本进行编辑,以满足性能测试需 ...

  6. jquery优化01

    查找: children:     find(selector), children(selector): parent:       parent(), parents(selector), clo ...

  7. pda完美结合开销售单据haohantech-安卓打票扫描PDA智能POS 发展现状如何,会取代传统电脑 代替手工开单 么?

    现场开单时指业务员每天到终端客户的现场进行谈单和接单的动作流程,现场开单一般主要是集中在BCD类门店和一些批发零售小店 现场开单的优势:现场开单可以及时掌控终端客户情况,促进客情关系,提高产品的铺市率 ...

  8. DP ZOJ 3735 Josephina and RPG

    题目传送门 题意:告诉你C(m,3)个队伍相互之间的胜率,然后要你依次对战n个AI队伍,首先任选一种队伍,然后战胜一个AI后可以选择替换成AI的队伍,也可以不换,问你最后最大的胜率是多少. 分析:dp ...

  9. Ubuntu 安装Redis体验

      背景:由于之前一直没有试过Linux的环境,今天加了内存之后,虚拟机开了3G,速度大大提高,对照博客试一下安装Redis的过程.   体验: 下载源码,解压,编译 $ wget http://do ...

  10. CentOS6.4 配置Haproxy

    Haproxy下载地址:http://pan.baidu.com/share/link?shareid=1787182295&uk=1829018343 也可用wget http://hapr ...