Linux 下 rpm 操作

rpm包文件提取

rpm2cpio *.rpm | cpio -idv 

解包到当前目录,-d保留目录结构

rpm2cpio *.rpm | cpio -idv ./etc/inittab 

拷贝指定文件


 r
 rpm等的一些安装包是二进制包
 已经安装的rp包的搜索数据库在/var/lib/rpm
-vv 更详细的目录打印
-Uvh 升级,若无则安装 
-Fvh   升级,否则退出 
-e      卸载
**.10.x86.rpm      10是发布次数
-qa    所有包     
-i  相关说明信息       
-qc   列出安装包配置文件位置
-qd    列出安装包帮助文件
-ql    安装包生成的文件列表
-qip   未安装的包的信息
rpm -qf /lib/modules/2.6.32-754.27.1.el6.i686/weak-updates   查询文件属于哪个包,由哪个rpm安装包生成的
-qR   查询包的依赖性
--nodeps 			忽略依赖关系
--force				强制安装,可实现降级
--replacepkgs     重新安装,替换原有安装

--rebuilddb       重建数据库
--initdb        初始化数据库,没有则建立
-V     校验
SM5DLUGT        大小 权限 md5校验 代码是否改变 路径是否改变 属主 属组 修改时间
g 代表鬼文件   ghost 代表不应该出现的文件
[root@ton etc]# rpm -V kernel
..5....T.    /etc/ld.so.conf.d/kernel-2.6.32-71.el6.i686.conf

/etc/yum.repos.d/rhel-debuginfo.repo  网络源配置
[base]         容器名称,必须放在[]中
name        容器说明
mirrorlist   镜像站点,可注释
baseurl     镜像站点 
enabled      =1生效
gppcheck     =1指RPM的数字证书生效
gpgkey         数字证书的保存位置


yum list 列出所有可能软件包列表 
yum search *** 对应搜索
-y 自动确认
不推荐yum卸载 remove
yum grouplist 等价于安装系统是的软件安装界面选项
yum grouplist “***有空格用引号***”
yum groupremove 

自建本地源

mount /dev/sr0 /mnt/cdrom      #挂载本地yum文件源
#repo内容
[ios-test]
name=test cdrom
baseurl=file:///mnt/cdrom
gpgcheck=1
enable=1
gpgkey=file:etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-releas
源码安装  /usr/local/软件名
service 不能管理到

./configue --perfix=/usr/local/apache2\

脚本安装软件时 ^H^H 出现可用ctrl + backspace消除

yum -y update
升级所有包,改变软件设置和系统设置,系统版本内核都升级
yum -y upgrade
升级所有包,不改变软件设置和系统设置,系统版本升级,内核不改变

[tom@ton ~]$yum repolist					#显示repo列表及简要信息

在这里插入代码片

[tom@ton ~]$yum list						#列表
[tom@ton ~]$yum clean						#清理缓存
[tom@ton ~]$yum remove or erase 			#卸载
[tom@ton ~]$yum provides or whatprovides	#查看指定的文件或者命令是由哪个安装包生成的

[tom@ton ~]$yum repolist          
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: pubmirror1.math.uh.edu
repo id                        repo name                                               status
base                           CentOS-6 - Base                                         5,075
epel                           Extra Packages for Enterprise Linux 6 - i386            10,253
repolist: 15,328

[tom@ton ~]$yum provides "*resolv.conf" 
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: pubmirror1.math.uh.edu
rubygem-dnsruby-1.53-1.el6.noarch : Ruby DNS(SEC) implementation
Repo        : epel
Matched from:
Filename    : /usr/lib/ruby/gems/1.8/gems/dnsruby-1.53/test/resolv.conf
golang-tests-1.15.2-1.el6.noarch : Golang compiler tests for stdlib
Repo        : epel
Matched from:
Filename    : /usr/lib/golang/src/net/testdata/domain-resolv.conf
...

[tom@ton ~]$yum whatprovides "*/netstat"
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * epel: pubmirror1.math.uh.edu
net-tools-1.60-114.el6.i686 : Basic networking tools
Repo        : base
Matched from:
Filename    : /bin/netstat
...
[root@paly etc]#yum info bind-chroot							#查看安装包信息
Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile
base                                                                                                                           | 3.7 kB     00:00     
epel                                                                                                                           | 4.7 kB     00:00     
extras                                                                                                                         | 3.3 kB     00:00     
updates                                                                                                                        | 3.4 kB     00:00     
Installed Packages
Name        : bind-chroot
Arch        : i686
Epoch       : 32
Version     : 9.8.2
Release     : 0.68.rc1.el6_10.8
Size        : 0.0  
Repo        : installed
From repo   : updates
Summary     : A chroot runtime environment for the ISC BIND DNS server, named(8)
URL         : http://www.isc.org/products/BIND/
License     : ISC
Description : This package contains a tree of files which can be used as a
            : chroot(2) jail for the named(8) program from the BIND package.
            : Based on the code from Jan "Yenya" Kasprzak <kas@fi.muni.cz>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值