📄 rpm 的介绍和应用 fedora 中文用户.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<!-- saved from url=(0042)http://fedora.linuxsir.org/main/?q=node/50 -->
<HTML lang=zh-hans xml:lang="zh-hans"
xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>RPM 的介绍和应用 | Fedora 中文用户</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<STYLE type=text/css media=all>@import url( misc/drupal.css );
</STYLE>
<LINK media=screen href="RPM 的介绍和应用 Fedora 中文用户.files/menuExpandable3.css"
type=text/css rel=stylesheet>
<SCRIPT src="RPM 的介绍和应用 Fedora 中文用户.files/menuExpandable3.js"
type=text/javascript></SCRIPT>
<LINK href="RPM 的介绍和应用 Fedora 中文用户.files/common.css" type=text/css
rel=stylesheet>
<STYLE type=text/css media=all>@import url( themes/chameleon/marvin/style.css );
</STYLE>
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<DIV id=header><A title=Home href="http://fedora.linuxsir.org/main/"><IMG
alt=Home src="RPM 的介绍和应用 Fedora 中文用户.files/logo.jpg"></A></DIV>
<DIV class=navlinks>
<DIV class=primary><A href="http://www.linuxsir.org/main"><FONT
color=white>LinuxSir.Org 首页</FONT></A> | <A
href="http://fedora.linuxsir.org/main/?q"><FONT color=white>本站首页</FONT></A> | <A
href="http://fedora.linuxsir.org/main/?q=aggregator/categories/3"><FONT
color=white>新闻</FONT></A> | <A
href="http://fedora.linuxsir.org/main/?q=taxonomy/term/1/9/"><FONT
color=white>文档</FONT></A> | <A
href="http://fedora.linuxsir.org/main/?q=taxonomy/term/16/9/"><FONT
color=white>资源</FONT></A> | <A
href="http://fedora.linuxsir.org/main/?q=search"><FONT color=white>搜索</FONT></A>
| <A href="http://www.linuxsir.org/bbs/forumdisplay.php?f=40"
target=_blank><FONT color=white>论坛</FONT></A> | <A
href="http://fedora.linuxsir.org/main/?q=taxonomy/term/14/9"><FONT
color=white>贡献者</FONT></A> | <A
href="http://fedora.linuxsir.org/main/?q=node/3"><FONT color=white>关于</FONT></A>
| <A href="http://fedora.linuxsir.org/main/?q=user"><FONT
color=white>注册/登录</FONT></A></DIV></DIV>
<TABLE id=content>
<TBODY>
<TR>
<TD id=sidebar-left>
<DIV class="block block-block" id=block-block-1>
<H2 class=title>入门必读</H2>
<DIV class=content>
<UL>
<LI><A href="http://fedora.linuxsir.org/main/?q=node/7">什么是Fedora</A>
<LI><A href="http://fedora.linuxsir.org/main/?q=node/42">Fedora
4.0安装手册</A>
<LI><A href="http://fedora.linuxsir.org/main/?q=node/6">Fedora 下载及说明</A>
<LI><A href="http://fedora.linuxsir.org/main/?q=node/63">软件包管理</A>
<LI><A href="http://fedora.linuxsir.org/main/?q=node/91">用户管理</A>
<LI><A href="http://fedora.linuxsir.org/main/?q=node/89">硬件管理</A>
<LI><A href="http://fedora.linuxsir.org/main/?q=node/88">内核管理</A>
</LI></UL>
<SCRIPT src="RPM 的介绍和应用 Fedora 中文用户.files/urchin.js"
type=text/javascript></SCRIPT>
<BR>
<SCRIPT
type=text/javascript>_uacct = "UA-55567-5";urchinTracker();</SCRIPT>
<BR></DIV></DIV>
<DIV class="block block-block" id=block-block-3>
<H2 class=title>重要资讯</H2>
<DIV class=content>
<UL>
<LI><A
href="http://fedora.linuxsir.org/main/?q=taxonomy/term/3/9/">本站公告</A>
<LI><A
href="http://fedora.linuxsir.org/main/?q=taxonomy/term/4/9/">新闻事件</A>
<LI><A href="http://www.linuxsir.org/bbs" target=_blank>本站论坛</A>
<LI><A href="http://fedora.linuxsir.org/main/?q=taxonomy/term/14/9/">贡 献
者</A> </LI></UL></DIV></DIV>
<DIV class="block block-user" id=block-user-1>
<H2 class=title>站点导航</H2>
<DIV class=content>
<DIV class=menu>
<UL>
<LI class=leaf><A title=注册/登录
href="http://fedora.linuxsir.org/main/?q=user">注册/登录</A>
<LI class=collapsed><A
href="http://fedora.linuxsir.org/main/?q=aggregator">新闻聚合</A>
</LI></UL></DIV></DIV></DIV>
<DIV class="block block-aggregator" id=block-aggregator-feed-2>
<H2 class=title>LinuxSir.Org</H2>
<DIV class=content>
<DIV class=item-list>
<UL>
<LI><A href="http://www.linuxsir.org/main/?q=node/227">上海 Linux工作机会</A>
<LI><A
href="http://www.linuxsir.org/main/?q=node/226">改变网络接口的速度和协商方式的工具miitool
和ethtool (v0.1b)</A>
<LI><A href="http://www.linuxsir.org/main/?q=node/224">Linux
网络接口配置文件及相关工具 (v0.1b)</A>
<LI><A href="http://www.linuxsir.org/main/?q=node/223">普通 56K猫拔号上网工具
wvdial 介绍</A>
<LI><A
href="http://www.linuxsir.org/main/?q=node/222">Linux操作系统主机名(hostname)简说(v0.1b)</A>
</LI></UL></DIV>
<DIV class=more-link><A title=查看此feed的最新消息
href="http://fedora.linuxsir.org/main/?q=aggregator/sources/2">更多</A></DIV></DIV></DIV>
<DIV class="block block-user" id=block-user-2>
<H2 class=title>最新注册</H2>
<DIV class=content>
<DIV class=item-list>
<UL>
<LI>sebastianstt
<LI>fzh76
<LI>diaalphisto
<LI>xzlian
<LI>layeyeung</LI></UL></DIV></DIV></DIV>
<DIV class="block block-user" id=block-user-3>
<H2 class=title>当前在线</H2>
<DIV class=content>0 users 和 4 游客 在线</DIV></DIV></TD>
<TD id=main>
<DIV class=breadcrumb><A
href="http://fedora.linuxsir.org/main/?q=">首页</A></DIV>
<H2>RPM 的介绍和应用</H2><!-- begin content -->
<DIV class=node>
<DIV class=content>
<P><B>作者:</B>北南南北<BR><B>来自:</B>LinuxSir.Org<BR><B>提要:</B>RPM 是 Red Hat
Package Manager 的缩写,原意是Red Hat 软件包管理;本文介绍RPM,并结合实例来解说RPM手工安装、查询等应用;</P>
<P><B><BR>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<BR>正文:<BR>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<BR></B></P>
<P>RPM 是 Red Hat Package Manager 的缩写,本意是Red Hat 软件包管理,顾名思义是Red Hat
贡献出来的软件包管理;在Fedora
、Redhat、Mandriva、SuSE、YellowDog等主流发行版本,以及在这些版本基础上二次开发出来的发行版采用;</P>
<P>RPM包里面都包含什么?里面包含可执行的二进制程序,这个程序和Windows的软件包中的.exe文件类似是可执行的;RPM包中还包括程序运行时所需要的文件,这也和Windows的软件包类似,Windows的程序的运行,除了.exe文件以外,也有其它的文件;</P>
<P>一个RPM
包中的应用程序,有时除了自身所带的附加文件保证其正常以外,还需要其它特定版本文件,这就是软件包的依赖关系;依赖关系并不是Linux特有的,Windows操作系统中也是同样存在的;比如我们在Windows系统中运行3D游戏,在安装的时候,他可能会提示,要安装Direct
9 ;Linux和Windows原理是差不多的;</P>
<P>软件安装流程图:</P>
<P><IMG
src="RPM 的介绍和应用 Fedora 中文用户.files/packageinstalllinuxsir.org0000.jpg"></P>
<P><B><BR>本文使用范围:<BR></B><BR>1、本文是对RPM管理的软件的说明,对通过file.tar.gz
或file.tar.bz2源码包用 make ;make install
安装的软件无效;<BR>2、安装软件时,最好用各自发行版所提供的系统软件包管理工具,对于Fedora/Redhat 您可以参考如下文章;</P>
<P>1)Fedora 系统管理软件包工具 system-config-packages,方便的添加和移除系统安装盘提供的软件包,详情请看<A
href="http://fedora.linuxsir.org/main/?q=node/48"> 《Fedora
软件包管理器system-config-packages》</A></P>
<P>2)Redhat 系统管理软件包工具,新一点的系统应该是 redhat-config-packages ,用法和<A
href="http://fedora.linuxsir.org/main/?q=node/48"> 《Fedora
软件包管理器system-config-packages》</A> 一样;</P>
<P>3)apt + synaptic 软件包在线安装、移除、升级工具; 用法:<A
href="http://fedora.linuxsir.org/main/?q=node/31">《用apt+synaptic
在线安装或升级Fedora core 4.0 软件包》</A><BR>4)yum 软件包在线安装、升级、移除工具;用法:<A
href="http://fedora.linuxsir.org/main/?q=node/31">《Fedora/Redhat
在线安装更新软件包,yum 篇》</A></P>
<P>5)所有的yum和apt 教程 <A
href="http://fedora.linuxsir.org/main/?q=taxonomy/term/19/9">《apt and
yum》</A></P>
<P>目前 apt和yum 已经极为成熟了,建议我们安装软件时,采用 apt或者yum ;如果安装系统盘提供的软件包,可以用
system-config-packages 或redhat-config-packages ;</P>
<P><B><BR>一、RPM包管理的用途;<BR></B></P>
<P>1、可以安装、删除、升级和管理软件;当然也支持在线安装和升级软件;<BR>2、通过RPM包管理能知道软件包包含哪些文件,也能知道系统中的某个文件属于哪个软件包;<BR>3、可以在查询系统中的软件包是否安装以及其版本;<BR>4、作为开发者可以把自己的程序打包为RPM
包发布;<BR>5、软件包签名GPG和MD5的导入、验证和签名发布<BR>6、依赖性的检查,查看是否有软件包由于不兼容而扰乱了系统;</P>
<P><B><BR>二、RPM
的使用权限;<BR></B><BR>RPM软件的安装、删除、更新只有root权限才能使用;对于查询功能任何用户都可以操作;如果普通用户拥有安装目录的权限,也可以进行安装;</P>
<P><B><BR>三、rpm 的一点简单用法;<BR></B><BR>我们除了软件包管理器以外,还能通过rpm
命令来安装;是不是所有的软件包都能通过rpm 命令来安装呢?不是的,文件以.rpm 后缀结尾的才行;有时我们在一些网站上找到file.rpm
,都要用 rpm 来安装;<BR><FONT color=blue><B><BR>一)初始化rpm
数据库;<BR></B></FONT><BR>通过rpm 命令查询一个rpm 包是否安装了,也是要通过rpm
数据库来完成的;所以我们要经常用下面的两个命令来初始化rpm 数据库;<BR>
<DIV class=codeblock><CODE>[root@localhost beinan]# rpm
--initdb<BR>[root@localhost beinan]# rpm --rebuilddb
注:这个要花好长时间;</CODE></DIV>
<P></P>
<P>注:这两个参数是极为有用,有时rpm 系统出了问题,不能安装和查询,大多是这里出了问题;<BR><FONT
color=blue><B><BR>二)RPM软件包管理的查询功能:<BR></B></FONT><BR>命令格式<BR>
<DIV class=codeblock><CODE> rpm {-q|--query} [select-options]
[query-options]</CODE></DIV>
<P></P>
<P>RPM的查询功能是极为强大,是极为重要的功能之一;举几个常用的例子,更为详细的具体的,请参考#man rpm<BR><FONT
color=blue><BR>1、对系统中已安装软件的查询;<BR></FONT></P>
<P>1)查询系统已安装的软件;</P>
<P>
<DIV class=codeblock><CODE>语法:rpm -q 软件名</CODE></DIV>
<P></P>
<P>举例:</P>
<P>
<DIV class=codeblock><CODE>[root@localhost beinan]# rpm -q
gaim<BR>gaim-1.3.0-1.fc4</CODE></DIV>
<P></P>
<P>-q就是 --query ,中文意思是“问”,此命令表示的是,是不是系统安装了gaim ;如果已安装会有信息输出;如果没有安装,会输出gaim
没有安装的信息;</P>
<P>查看系统中所有已经安装的包,要加 -a 参数 ;<BR>
<DIV class=codeblock><CODE>[root@localhost RPMS]# rpm
-qa</CODE></DIV><BR>如果分页查看,再加一个管道 |和more命令;<BR>
<DIV class=codeblock><CODE>[root@localhost RPMS]# rpm -qa
|more</CODE></DIV>
<P></P>
<P>在所有已经安装的软件包中查找某个软件,比如说 gaim ;可以用 grep 抽取出来;</P>
<P>
<DIV class=codeblock><CODE>[root@localhost RPMS]# rpm -qa |grep
gaim</CODE></DIV>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -