确定在RedHat Linux机器上安装的非OS软件包的列表 [英] Determine list of non-OS packages installed on a RedHat Linux machine

查看:84
本文介绍了确定在RedHat Linux机器上安装的非OS软件包的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的任务是确定安装在多台Red Hat Enterprise Linux(RHEL)机器上的新(非操作系统)软件.谁能建议一种有效的方法来做到这一点?我这样做的方式是手动比较已安装软件的列表和相关操作系统的Red Hat FTP站点上的列表:

I have been tasked with identifying new (non-operating system) software installed on several Red Hat Enterprise Linux (RHEL) machines. Can anyone suggest an efficient way to do this? The way I was doing it is manually comparing the list of installed software with the list on Red Hat's FTP site for the relevant operating system:

ftp://ftp.redhat. com/pub/redhat/linux/enterprise/6Server/en/os/SRPMS/

此方法遇到的问题是繁琐/耗时,仅列出了源软件包(例如,我无法确定avahi-glib是否作为avahi软件包的一部分安装了).如果有人可以提出一种更有效的方法来识别RHEL计算机上的操作系统所没有的软件,将不胜感激!

The problems I am encountering with this method is it is tedious / timeconsuming, and just the source packages are listed (e.g. I can't tell if avahi-glib is installed as part of the avahi package). If anyone can suggest a more efficient way to identify the software that doesn't come with the operating system on a RHEL machine, it would be greatly appreciated!

到目前为止,我想出了一个更有效的方法(尽管我还没有弄清楚最后一部分,也许还有更有效的方法).如果有人可以在此方法的最后一步帮助我,或者可以分享更好的方法,将不胜感激!

Here is what I have come up with so far as a more efficient method (though I still haven't figured out the last part, and there may be more efficient methods). If anyone can help me with the last step of this method, or can share a better method, it would be greatly appreciated!

  1. 将Red Hat的FTP站点中的软件包列表复制到文本文件(OSPackages.txt)中.

  1. Copy the list of packages from Red Hat's FTP site into a text file (OSPackages.txt).

要解决仅列出源RPM的问题,还请从 http://vault.centos.org 到一个文本文件,并将此数据与OSPackages.txt合并.

To fix the problem of just source RPMs being listed, also copy the list of files from the relevant corresponding version in http://vault.centos.org into a text file, and merge this data with OSPackages.txt.

执行rpm -qa> list1,yum -y已安装的list> list2,ls/usr/bin> list3,ls/usr/share> list4,ls/usr/lib> list5.

Do a rpm -qa > list1, yum -y list installed > list2, ls /usr/bin > list3, ls /usr/share > list4, ls /usr/lib > list5.

使用cat将所有listX文件合并到InstalledPackages.txt中.

Use cat to merge all the listX files together into InstalledPackages.txt.

使用sort排序唯一条目,例如:sort -u -k 1 InstalledPackages.txt> SortedInstalledPackages.txt

Use sort to sort out the unique entries, perhaps like: sort -u -k 1 InstalledPackages.txt > SortedInstalledPackages.txt

使用正则表达式(-I regexp)在SortedInstalledPackages.txt和OSPackages.txt之间进行区分,以标识软件包名称(并消除版本号).我还需要做一个单向差异",例如忽略OSPackages.txt中没有出现在已安装的软件包文件中的其他OS软件包.

Do a diff between SortedInstalledPackages.txt and OSPackages.txt using a regular expression (-I regexp) to identify the package names (and eliminate the version numbers). I would need to also do a "one way diff", e.g. ignore the extra OS packages in OSPackages.txt that do not appear in the installed packages file.

注意:我问了以下问题以帮助我完成这一部分,并认为我现在已经很接近解决方案了: 如何在Linux中进行单向差异? /a>

Note: I asked the following question to help me with this part, and believe I am now fairly close to a solution: How do I do a one way diff in Linux?

如果diff(或其他命令)可以执行最后一步,则应生成OS上没有的软件包列表.这是我坚持的一步,将不胜感激.我将使用什么命令来执行第6步?

If diff (or another command) can perform the last step, it should produce a list of packages that don't come on the OS. This is the step I am stuck on and would appreciate further help. What command would I use to perform step 6?

推荐答案

rpm -qa --last | less

这将列出最近安装的rpm以及安装日期.

This will list recently installed rpms with the installed date.

这篇关于确定在RedHat Linux机器上安装的非OS软件包的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆