标签:yum rpm
RPM包管理器
rpm 安装包
二进制包(Binary)以及源代码包(Source)两种。二进制包可以直接安装在计算机中,而源代码包将会由RPM自动编译、安装。源代码包经常以src.rpm作为后缀名。
常用命令组合:
-ivh:安装显示安装进度--install--verbose--hash
-Uvh:升级软件包--Update;
-qpl:列出RPM软件包内的文件信息[Query Package list];
-qpi:列出RPM软件包的描述信息[Query Package install package(s)];
-qf:查找指定文件属于哪个RPM软件包[Query File];
-Va:校验所有的RPM软件包,查找丢失的文件[View Lost];
-e:删除包
举例:查询samba程序是否安装
[root@localhost ~]# rpm -q samba 未安装软件包 samba
按路径安装并显示进度,安装过程中包之间有依赖关系,需要将互相依赖的RPM包一同安装。
[root@localhost Packages]# find -name ‘samba*‘ ./samba-winbind-modules-4.1.12-21.el7_1.x86_64.rpm ./samba-4.1.12-21.el7_1.x86_64.rpm ./samba-client-4.1.12-21.el7_1.x86_64.rpm ./samba-common-4.1.12-21.el7_1.x86_64.rpm ./samba-libs-4.1.12-21.el7_1.x86_64.rpm ./samba-python-4.1.12-21.el7_1.x86_64.rpm ./samba-winbind-4.1.12-21.el7_1.x86_64.rpm [root@localhost Packages]# rpm -ivh /mnt/cdrom/Packages/samba-4.1.12-21.el7_1.x86_64.rpm
rpm -ivh --relocate /=指定目录 指定RPM安装目录
rpm -ql httpd [搜索RPM包]--list所有文件安装目录
rpm -e rpm包名 删除RPM包
yum应用
检查有哪些可更新的rpm包
[root@localhost Packages]# yum check-update 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile NetworkManager.x86_64 1:1.0.0-16.git20150121.b4ea599c.el7_1 NetworkManager-libnm.x86_64 1:1.0.0-16.git20150121.b4ea599c.el7_1 NetworkManager-team.x86_64 1:1.0.0-16.git20150121.b4ea599c.el7_1 NetworkManager-tui.x86_64 1:1.0.0-16.git20150121.b4ea599c.el7_1 abrt.x86_64 2.1.11-22.el7.centos.0.1 abrt-addon-ccpp.x86_64 2.1.11-22.el7.centos.0.1
安装httpd
[root@localhost Packages]# yum install httpd 已加载插件:fastestmirror, langpacks Loading mirror speeds from cached hostfile 正在解决依赖关系 --> 正在检查事务 ---> 软件包 httpd.x86_64.0.2.4.6-31.el7.centos.1 将被 安装 --> 解决依赖关系完成 依赖关系解决 =================================================================================================== Package 架构 版本 源 大小 =================================================================================================== 正在安装: httpd x86_64 2.4.6-31.el7.centos.1 updates 2.7 M 事务概要 =================================================================================================== 安装 1 软件包 总下载量:2.7 M 安装大小:9.4 M Is this ok [y/d/N]:
卸载httpd
[root@localhost Packages]# yum remove httpd 已加载插件:fastestmirror, langpacks 正在解决依赖关系 --> 正在检查事务 ---> 软件包 httpd.x86_64.0.2.4.6-31.el7.centos.1 将被 删除 --> 解决依赖关系完成 依赖关系解决 =================================================================================================== Package 架构 版本 源 大小 =================================================================================================== 正在删除: httpd x86_64 2.4.6-31.el7.centos.1 @updates 9.4 M 事务概要 =================================================================================================== 移除 1 软件包 安装大小:9.4 M 是否继续?[y/N]:
yum配置文件
[root@localhost Packages]# cat /etc/yum.conf [main] cachedir=/var/cache/yum/$basearch/$releasever //yum 缓存的目录,yum 在此存储下载的rpm 包和数据库,默认设置为/var/cache/yum keepcache=0 //安装完成后是否保留软件包,0为不保留(默认为0),1为保留 debuglevel=2 //Debug 信息输出等级,范围为0-10,缺省为2 logfile=/var/log/yum.log //yum 日志文件位置。用户可以到/var/log/yum.log 文件去查询过去所做的更新。 exactarch=1 //设置为1,表示yum只会安装和系统架构相匹配的包 obsoletes=1 gpgcheck=1 //gpg验证是否开启,1表示开启 plugins=1 //设置为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 # This is the default, if you make this bigger yum won‘t see if the metadata # is newer on the remote and so you‘ll "gain" the bandwidth of not having to # download the new metadata and "pay" for it by yum not having correct # information. # It is esp. important, to have correct metadata, for distributions like # Fedora which don‘t keep old packages around. If you don‘t like this checking # interupting your command line usage, it‘s much better to have something # manually check the metadata once an hour (yum-updatesd will do this). # metadata_expire=90m # PUT YOUR REPOS HERE OR IN separate files named file.repo # in /etc/yum.repos.d
1、进入存放源配置的文件夹
cd /etc/yum.repos.d
2、备份默认源
mv ./CentOS-Base.repo ./CentOS-Base.repo.bak
3、使用wget下载163的源 http://mirrors.163.com/.help/centos.html
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
4、把下载下来的文件CentOS-Base-163.repo设置为默认源
mv CentOS6-Base-163.repo CentOS-Base.repo
运行yum makecache生成缓存
yum makecache
1. 搭建本地光盘YUM源
创建光盘挂载目录,并将光盘挂载。
切换到YUM配置目录,将原来所有的文件进行打包备份,删除原文件
配置光盘源文件
验证
标签:yum rpm
原文地址:http://blackhuuu.blog.51cto.com/372322/1694687