每天学五分钟 Liunx 0010 | 软件篇: RPM 和 YUM
1. RPM
2. RPM 命令
[root@test packages]# rpm -q[a|i|l|c|R|f]
# a: 列出所有已经安装的软件
# i: 列出软件的详细信息
# l: 列出软件所有的文件与目录所在的完整文件名
# c: 列出软件的设置文件
# R:列出软件有关的依赖软件所包含的文件
# f: 列出该文件属于哪个软件 [root@test packages]# rpm -qa | grep xterm
[root@test packages]# rpm -ivh xterm-295-3.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:xterm-295-3.el7 ################################# [100%]
[root@test packages]# rpm -V[a|f]
# V: 后接软件名称,如果有文件改动则列出
# a: 列出系统所有可能被改动过的文件
# f: 后接文件,列出该文件是否被改动过
[root@test packages]# rpm -ql xterm
...
/usr/share/doc/xterm-295/THANKS
... [root@test packages]# echo "thanks for you, xterm" >> /usr/share/doc/xterm-295/THANKS
[root@test packages]# rpm -V xterm
S.5....T d /usr/share/doc/xterm-295/THANKS
[root@test packages]# cd /etc/pki/rpm-gpg/
[root@test rpm-gpg]# ls
RPM-GPG-KEY-redhat-beta RPM-GPG-KEY-redhat-legacy-former RPM-GPG-KEY-redhat-legacy-release RPM-GPG-KEY-redhat-legacy-rhx RPM-GPG-KEY-redhat-release
[root@test rpm-gpg]# ll RPM-GPG-KEY-redhat-beta
-rw-r--r--. 1 root root 3375 Sep 27 2016 RPM-GPG-KEY-redhat-beta
[root@test rpm-gpg]# cat RPM-GPG-KEY-redhat-beta
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.2.6 (GNU/Linux) mQINBEmkAzABEAC2/c7bP1lHQ3XScxbIk0LQWe1YOiibQBRLwf8Si5PktgtuPibT
kKpZjw8p4D+fM7jD1WUzUE0X7tXg2l/eUlMM4dw6XJAQ1AmEOtlwSg7rrMtTvM0A
BEtI7Km6fC6sU6RtBMdcqD1cH/6dbsfh8muznVA7UlX+PRBHVzdWzj6y8h84dBjo
gzcbYu9Hezqgj/lLzicqsSZPz9UdXiRTRAIhp8V30BD8uRaaa0KDDnD6IzJv3D9P
xQWbFM4Z12GN9LyeZqmD7bpKzZmXG/3drvfXVisXaXp3M07t3NlBa3Dt8NFIKZ0D
FRXBz5bvzxRVmdH6DtkDWXDPOt+Wdm1rZrCOrySFpBZQRpHw12eo1M1lirANIov7
**********************************************************************
-----END PGP PUBLIC KEY BLOCK-----
[root@test rpm-gpg]#
[root@test rpm-gpg]# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta # 导入公钥到 RPM
[root@test packages]# rpm -e
# e: erase [root@test packages]# rpm -qa | grep xterm
xterm-295-3.el7.x86_64
[root@test packages]# rpm -e xterm
[root@test packages]# rpm -qa | grep xterm
[root@test packages]#
3. YUM
4. YUM 工作原理
5. YUM 命令
|
Individual packages
|
list
|
List package names from repositories
yum list available
List all available packages
yum list installed
List all installed packages
yum list all
List installed and available packages
yum list kernel
List installed and available packages
|
|
info
|
Dispaly information about a package
yum info vsftpd
List info about vsftpd package
|
|
|
deplist
|
Display dependencies for a package
yum deplist nfs-utils
List dependencies and packages providing them
|
|
|
provides
|
Find packages that provide the queried file
yum provides "*bin/top"
Show package that contains top command
yum provides "*/README.top"
Show package containing README.top file
|
|
|
search
|
Search package names and descriptions for a term
yum search samba
Find packages with samba in name or description
|
|
|
updateinfo
|
Get information about available package updates
yum updateinfo security
Get into on available security updates
|
|
|
Grups of packages
|
grouplist
|
List names of installed and available package groups
|
|
groupinfo
|
Display description and contents of a package group
yum groupinfo "Web Server"
See packages in Web Server group
|
|
|
check-update
|
Query repositories for available package updates
|
|
|
groupinstall
|
install all packages in the selected group
yum groupinstall "Web Server"
Install Web Server packages
|
|
|
YUM repositories
|
repolist
|
Display enabled software repositories
|
|
repoinfo
|
Display information about enabled yum repositories
yum repoinfo rhel-7-server-RPMs
see info on rhel-7-server-rpms repo
|
|
|
makecache
|
Download yum repository data to cache
|
|
|
Install/Remove/Update packages with YUM
|
install
|
Install a package from a repo to system
yum install vsftpd
install the vsftpd package
|
|
update
|
update one or all packages on system
yum update
update all packages with available updates
yum update httpd
update the httpd package(if available)
|
|
|
update-to
|
update package to a particular version
|
|
|
upgrade
|
update packages taking obsoletes into account
|
|
|
localinstall
|
install a package from a local file,http,or ftp
yum localinstall abc.i386.rpm
install abc package from local directory
yum localinstall http://myrepo/abc.i386.rpm
install abc from FTP site
|
|
|
downgrade
|
Downgrade a package to an earlier version
yum downgrade abc
Downgrade the abc package to an earlier version
|
|
|
reinstall
|
reinstall the current version of a package
yum reinstall util-liunx
reinstall util-liunx
|
|
|
swap
|
remove one package and install another
yum swap ftp lftp
remove ftp package and install lftp
|
|
|
erase
|
Erase a package
yum remove vsftpd
remove the vsftpd package and dependencies
|
|
|
remove
|
same with erase
|
|
|
Troubleshooting
|
check
|
Check the local RPM database for problems
|
|
history
|
View and use yum transactions
yum history list
List all yum install,update and erase actions
yum history info 3
show details of yum transaction 3
|
|
|
clean
|
clear out cached package data
yum clean packages
Delete packages saved in cache
yum clean all
Clean out all packages and meta data from cache
|
|
|
YUM related command(install yum-utils)
|
reposync
|
Synchronize yum repositories to a local directory
reposync -r rhel-atomic-host-beta-rpms
Get packages from repo
|
|
options for YUM commands
|
-y
|
Assume yes if prompted
|
|
-v
|
produce extra debugging output
|
|
|
--downloadonly
|
Download to /var/cache/yum/arch/prod/repo/packages/,but dot't install
yum install --downlaodonly vsftpd
Download vsftpd package to cache
|
6. YUM 实践
[root@test ~]# yum repolist all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id repo name status
osp7_server Red Hat Enterprise Linux Open Stack 7 Packages enabled: 954
osp_optools_server Red Hat Enterprise Linux Open Stack Tools Packages disabled
osp_tools_server Red Hat Enterprise Linux Open Stack Tools Packages disabled
rhel-common Red Hat Enterprise Linux 7.3 X86_64 Server Extra Packages enabled: 228
rhel-extras Red Hat Enterprise Linux 7.3 X86_64 Server Extra Packages enabled: 465
rhel-optional Red Hat Enterprise Linux 7.3 X86_64 Server Extra Packages disabled
rhel-server Red Hat Enterprise Linux 7.3 X86_64 Server Packages enabled: 14,275
repolist: 15,922 [root@test ~]# yum list installed | grep xterm
[root@test ~]# yum list available | grep xterm
xterm.x86_64 295-3.el7 rhel-server [root@test ~]# yum clean all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: osp7_server rhel-common rhel-extras rhel-server
Cleaning up everything [root@test ~]# yum install xterm
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Bad id for repo: <repo_file_name>, byte = < 0
osp7_server | 2.9 kB 00:00:00
rhel-common | 2.9 kB 00:00:00
rhel-extras | 2.9 kB 00:00:00
rhel-server | 2.9 kB 00:00:00
(1/4): rhel-common/primary_db | 102 kB 00:00:01
(2/4): rhel-extras/primary_db | 184 kB 00:00:01
(3/4): osp7_server/primary_db | 427 kB 00:00:02
(4/4): rhel-server/primary_db | 27 MB 00:00:37
Resolving Dependencies
--> Running transaction check
---> Package xterm.x86_64 0:295-3.el7 will be installed
--> Processing Dependency: libXt.so.6()(64bit) for package: xterm-295-3.el7.x86_64
--> Processing Dependency: libXmu.so.6()(64bit) for package: xterm-295-3.el7.x86_64
--> Processing Dependency: libXaw.so.7()(64bit) for package: xterm-295-3.el7.x86_64
--> Running transaction check
---> Package libXaw.x86_64 0:1.0.12-5.el7 will be installed
---> Package libXmu.x86_64 0:1.1.2-2.el7 will be installed
---> Package libXt.x86_64 0:1.1.4-6.1.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Installing:
xterm x86_64 295-3.el7 rhel-server 455 k
Installing for dependencies:
libXaw x86_64 1.0.12-5.el7 rhel-server 190 k
libXmu x86_64 1.1.2-2.el7 rhel-server 71 k
libXt x86_64 1.1.4-6.1.el7 rhel-server 173 k Transaction Summary
==============================================================================================================================================================
Install 1 Package (+3 Dependent packages) Total download size: 889 k
Installed size: 2.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): libXaw-1.0.12-5.el7.x86_64.rpm | 190 kB 00:00:01
(2/4): libXt-1.1.4-6.1.el7.x86_64.rpm | 173 kB 00:00:00
(3/4): libXmu-1.1.2-2.el7.x86_64.rpm | 71 kB 00:00:01
(4/4): xterm-295-3.el7.x86_64.rpm | 455 kB 00:00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 329 kB/s | 889 kB 00:00:02
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libXt-1.1.4-6.1.el7.x86_64 1/4
Installing : libXmu-1.1.2-2.el7.x86_64 2/4
Installing : libXaw-1.0.12-5.el7.x86_64 3/4
Installing : xterm-295-3.el7.x86_64 4/4
Verifying : libXaw-1.0.12-5.el7.x86_64 1/4
Verifying : libXmu-1.1.2-2.el7.x86_64 2/4
Verifying : libXt-1.1.4-6.1.el7.x86_64 3/4
Verifying : xterm-295-3.el7.x86_64 4/4 Installed:
xterm.x86_64 0:295-3.el7 Dependency Installed:
libXaw.x86_64 0:1.0.12-5.el7 libXmu.x86_64 0:1.1.2-2.el7 libXt.x86_64 0:1.1.4-6.1.el7 Complete!
[root@test ~]# yum remove xterm
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Bad id for repo: <repo_file_name>, byte = < 0
Resolving Dependencies
--> Running transaction check
---> Package xterm.x86_64 0:295-3.el7 will be erased
--> Finished Dependency Resolution Dependencies Resolved ==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Removing:
xterm x86_64 295-3.el7 @rhel-server 1.2 M Transaction Summary
==============================================================================================================================================================
Remove 1 Package Installed size: 1.2 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : xterm-295-3.el7.x86_64 1/1
Verifying : xterm-295-3.el7.x86_64 1/1 Removed:
xterm.x86_64 0:295-3.el7 Complete! [root@test ~]# yum install -y xterm
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package xterm.x86_64 0:295-3.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ==============================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================
Installing:
xterm x86_64 295-3.el7 rhel-server 455 k Transaction Summary
==============================================================================================================================================================
Install 1 Package Total download size: 455 k
Installed size: 1.2 M
Downloading packages:
xterm-295-3.el7.x86_64.rpm | 455 kB 00:00:01
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : xterm-295-3.el7.x86_64 1/1
Verifying : xterm-295-3.el7.x86_64 1/1 Installed:
xterm.x86_64 0:295-3.el7 Complete!
7. YUM 配置
[root@test yum.repos.d]# ll /etc/yum.repos.d/
total 12
-rw-r--r--. 1 root root 1563 Mar 30 2019 lianhuasheng.repo
-rw-r--r--. 1 root root 358 Mar 30 2019 redhat.repo
## RHEL ###
[rhel-server]
name=Red Hat Enterprise Linux 7.3 X86_64 Server Packages
# mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
baseurl=http://10.57.0.1:80/rhel-7/rhel-x86_64-server-7
http://10.57.217.11:80/rhel-7/rhel-x86_64-server-7
gpgcheck=0
enabled=1
failovermethod=priority [rhel-extras]
name=Red Hat Enterprise Linux 7.3 X86_64 Server Extra Packages
# mirrorlist = http://apt.sw.be/redhat/$releasever/en/mirrors-rpmforge
baseurl=http://10.57.0.1:80/rhel-7/rhel-x86_64-server-extras-7/
gpgcheck=1
enabled=1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY
exclude=cfengine nx-libs nxproxy nxagent libNX* libXcomp* perl-App-Daemon
...
[root@test yum.repos.d]$ cat /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=1
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
pkgpolicy=newest
proxy=http://10.0.0.1:8080/
8. 配置国内 YUM 源
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
# [base]
name=CentOS-$releasever - Base - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/addons/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5 #contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.ustc.edu.cn
baseurl=http://mirrors.ustc.edu.cn/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirrors.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5
每天学五分钟 Liunx 0010 | 软件篇: RPM 和 YUM的更多相关文章
- CentOS学习笔记—软件管理程序RPM、YUM
软件管理程序 Linux的软件安装分为源代码编译安装和打包安装.RPM是一种打包安装方式,是由 Red Hat 这家公司开发出来的,后来实在很好用,因此很多 distributions 就使用这个机制 ...
- Linux软件管理(rpm、yum、tar)
RPM软件包安装 YUM安装 源代码安装 TAR包管理:实现对文件的备份和压缩 rpm包管理 rpm命令是RPM软件包的管理工具. -a:查询所有套件:-b<完成阶段><套件档> ...
- 软件安装 RPM SRPM YUM
RPM介绍 RPM是已经编译好的软件安装库.编译是有相应环境相适应的,包括系统,版本等相关信息都要跟编译版本一致才行,否则肯定会出现安装不成功的情况,强制安装的话,也会出现各种各样的问题. 在这种情况 ...
- linux 基础入门(8) 软件安装 rpm、yum与源码安装详解
8.软件 RPM包安装 8.1rpm安装 rpm[选项]软件包名称 主选项 -i 安装 -e卸载 -U升级 -q查找 辅助选项 -ⅴ显示过程 -h --hash 查询 -a-all查询所有安装的包 - ...
- 鸟哥的linux私房菜学习记录之软件安装RPM,SRPM,YUM
- 如何从40亿整数中找到不存在的一个 webservice Asp.Net Core 轻松学-10分钟使用EFCore连接MSSQL数据库 WPF实战案例-打印 RabbitMQ与.net core(五) topic类型 与 headers类型 的Exchange
如何从40亿整数中找到不存在的一个 前言 给定一个最多包含40亿个随机排列的32位的顺序整数的顺序文件,找出一个不在文件中的32位整数.(在文件中至少确实一个这样的数-为什么?).在具有足够内存的情况 ...
- 零元学Expression Blend 4 - Chapter 42 五分钟快速完成扇形变圆形动画
原文:零元学Expression Blend 4 - Chapter 42 五分钟快速完成扇形变圆形动画 零元学Expression Blend 4 - Chapter 42 五分钟快速完成扇形变圆形 ...
- 五分钟学Java:如何才能学好Java Web里这么多的技术
原创声明 本文作者:黄小斜 转载请务必在文章开头注明出处和作者. 系列文章介绍 本文是<五分钟学Java>系列文章的一篇 本系列文章主要围绕Java程序员必须掌握的核心技能,结合我个人三年 ...
- [分享] 史上最简单的封装教程,五分钟学会封装系统(以封装Windows 7为例)
[分享] 史上最简单的封装教程,五分钟学会封装系统(以封装Windows 7为例) 踏雁寻花 发表于 2015-8-23 23:31:28 https://www.itsk.com/thread-35 ...
- 《sed的流艺术之一》-linux命令五分钟系列之二十一
本原创文章属于<Linux大棚>博客,博客地址为http://roclinux.cn.文章作者为rocrocket. 为了防止某些网站的恶性转载,特在每篇文章前加入此信息,还望读者体谅. ...
随机推荐
- Python 潮流周刊第 31 期(摘要)
本周刊由 Python猫 出品,精心筛选国内外的 250+ 信息源,为你挑选最值得分享的文章.教程.开源项目.软件工具.播客和视频.热门话题等内容.愿景:帮助所有读者精进 Python 技术,并增长职 ...
- 组合式api的使用方式
方式一:通过setup选项 <script> export default { setup(){ // 提供数据 // 提供函数 // 提供计算属性等等..... } } </scr ...
- 中企网安信息科技:基于数据化大屏的BI数据分析管理系统概述
由华企网安总公司北京中企网安信息科技有限责任公司开发的<基于数据化大屏的BI数据分析管理系统>,获得国家版权局颁发的计算机软件著作权登记证书. 基于数据化大屏的BI数据分析管理系统利用大数 ...
- pytest框架学习-标签@pytest.mark.
标签 自定义标签(区分大小写) 可以标记测试用例,对测试用例进行分组,有利于对测试用例进行筛选. 比如:给用例打标为API,代表接口自动化的用例,打标方法为@pytest.mark.API,打标后,需 ...
- Unity无法显示animator面板,如何解决?
步骤: 点击动画的主体: 右侧Inspector面板找到Animator,双击Controller中的对象: 左上角即可显示animator面板. 总结: 不行就双击!!!!!!!!!!!!!!!!! ...
- Windows Server 2019/2016 配置自动更新和更换大陆更新服务器
文章原地址: 运行 > gpedit.msc -> 计算机配置 -> 管理模板 -> Windows 组件 -> Windows 更新 下面中右侧三个选项是本篇教程中会介 ...
- 年底了,网站被挂马了,关于IIS被陌生DLL劫持(新人发帖,写的不好的地方,请多多担待)
一上班被分到两个需要杀毒的站点,情况是SEO被劫持 出现一些博彩信息,但是打开确实正常内容,使用站长工具的网站被黑检测功能,发现网站的HEAD前面加载一对加密的东西 一开始我使用D盾扫描网站,删除了一 ...
- 如何从零开始实现TDOA技术的 UWB 精确定位系统(3)
这是一个系列文章<如何从零开始实现TDOA技术的 UWB 精确定位系统>第3部分. 重要提示(劝退说明): Q:做这个定位系统需要基础么?A:文章不是写给小白看的,需要有电子技术和软件 ...
- [Acwing 164. 可达性统计] 题解报告
事实上,这道题并不需要拓扑排序.(当然,拓扑排序还是更快) 题目分析 首先,题目中说了,这是一个有向无环图,所以,我们可以考虑 \(\texttt{DP}\) / 记搜 / 拓扑排序 来解决这道题. ...
- 2023-11-15:用go语言,如果一个正方形矩阵上下对称并且左右对称,对称的意思是互为镜像, 那么称这个正方形矩阵叫做神奇矩阵, 比如 : 1 5 5 1 6 3 3 6 6 3 3 6 1 5
2023-11-15:用go语言,如果一个正方形矩阵上下对称并且左右对称,对称的意思是互为镜像, 那么称这个正方形矩阵叫做神奇矩阵, 比如 : 1 5 5 1 6 3 3 6 6 3 3 6 1 5 ...