⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 0017-0020.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
字号:




<HTML>

<HEAD>

<TITLE>Maximum RPM (RPM):Using RPM to Install Packages:EarthWeb Inc.-</TITLE>

<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
        var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>

 -->




<!-- ISBN=0672311054 //-->

<!-- TITLE=Maximum RPM (RPM)//-->

<!-- AUTHOR=Edward Bailey//-->

<!-- PUBLISHER=Macmillan Computer Publishing//-->

<!-- IMPRINT=Sams//-->

<!-- CHAPTER=02 //-->

<!-- PAGES=0017-0036 //-->

<!-- UNASSIGNED1 //-->

<!-- UNASSIGNED2 //-->









<P><CENTER>

<a href="../ch01/0013-0016.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0021-0023.html">Next</A>

</CENTER></P>



<A NAME="PAGENUM-17"><P>Page 17</P></A>







<H3><A NAME="ch02_ 1">

Chapter 2

</A></H3>



<H2>



Using RPM to <BR>

Install Packages



</H2>



<A NAME="PAGENUM-18"><P>Page 18</P></A>





<P>Table 2.1. Install-mode command syntax and options.

</P>



<TABLE>



<TR><TD>

rpm -i (or --install)

</TD><TD>

Options

</TD><TD>

file1.rpm...fileN.rp

</TD><TD>

</TD></TR><TR><TD>

Parameters

</TD><TD>

</TD><TD>

</TD><TD>

file1.rpm...fileN.rpm

</TD></TR><TR><TD>

</TD><TD>

One or more RPM package files (URLs are usable)

</TD><TD>

</TD><TD>

<B>

Install-Specific Options

</B>

</TD></TR><TR><TD>

</TD><TD>

Section

</TD><TD>

-h (or --hash)

</TD><TD>

</TD></TR><TR><TD>

Print hash marks (#) during install

</TD><TD>

2.3.2

</TD><TD>

--test

</TD><TD>

</TD></TR><TR><TD>

Perform install tests only

</TD><TD>

2.4.2

</TD><TD>

--percent

</TD><TD>

</TD></TR><TR><TD>

Print percentages during install

</TD><TD>

2.4.11

</TD><TD>

--excludedocs

</TD><TD>

</TD></TR><TR><TD>

Do not install documentation

</TD><TD>

2.4.7

</TD><TD>

--includedocs

</TD><TD>

</TD></TR><TR><TD>

Install documentation

</TD><TD>

2.4.8

</TD><TD>

--replacepkgs

</TD><TD>

</TD></TR><TR><TD>

Replace a package with a new copy of itself

</TD><TD>

2.4.3

</TD><TD>

--replacefiles

</TD><TD>

</TD></TR><TR><TD>

Replace files owned by another package

</TD><TD>

2.4.4

</TD><TD>

--force

</TD><TD>

</TD></TR><TR><TD>

Ignore package and file conflicts

</TD><TD>

2.4.6

</TD><TD>

--noscripts

</TD><TD>

</TD></TR><TR><TD>

Do not execute pre- and postinstall scripts

</TD><TD>

2.4.10

</TD><TD>

--prefix &lt;path&gt;

</TD><TD>

</TD></TR><TR><TD>

Relocate package to

&lt;path&gt; if possible

</TD><TD>

2.4.9

</TD><TD>

--ignorearch

</TD><TD>

</TD></TR><TR><TD>

Do not verify package architecture

</TD><TD>

2.4.17

</TD><TD>

--ignoreos

</TD><TD>

</TD></TR><TR><TD>

Do not verify package operating system

</TD><TD>

2.4.18

</TD><TD>

--nodeps

</TD><TD>

</TD></TR><TR><TD>

Do not check dependencies

</TD><TD>

2.4.5

</TD><TD>

--ftpproxy &lt;host&gt;

</TD><TD>

</TD></TR><TR><TD>

Use &lt;host&gt; as the FTP proxy

</TD><TD>

2.4.16

</TD><TD>

--ftpport &lt;port&gt;

</TD><TD>

</TD></TR><TR><TD>

Use &lt;port&gt; as the FTP port

</TD><TD>

2.4.15

</TD><TD>

</TD><TD>

<B>General Options

</B>

</TD></TR><TR><TD>

</TD><TD>

Section

</TD><TD>

-v

</TD><TD>

</TD></TR><TR><TD>

Display additional information

</TD><TD>

2.3.1

</TD><TD>

-vv

</TD><TD>

</TD></TR><TR><TD>

Display debugging information

</TD><TD>

2.4.1

</TD><TD>

--root &lt;path&gt;

</TD><TD>

</TD></TR><TR><TD>

Set alternate root to

&lt;path&gt;

</TD><TD>

2.4.13

</TD><TD>

--rcfile &lt;rcfile&gt;

</TD><TD>

</TD></TR><TR><TD>

Set alternate rpmrc file to

&lt;rcfile&gt;

</TD><TD>

2.4.12

</TD><TD>

--dbpath &lt;path&gt;

</TD><TD>

</TD></TR><TR><TD>

Use &lt;path&gt; to find the RPM database

</TD><TD>

2.4.14

</TD></TR></TABLE>



<H3><A NAME="ch02_ 2">

2.1. rpm -i&#151;What Does It Do?

</A></H3>



<P>Of the many things RPM can do, probably the one that users think of first, is the installation of software. As mentioned earlier, installing new software is a complex, error-prone job.

RPM turns that process into a single command.

</P>



<A NAME="PAGENUM-19"><P>Page 19</P></A>





<P>rpm -i (--install is equivalent) installs software that's been packaged into an RPM

package file. It does this through the following process:

</P>



<UL>

<LI>          Performs dependency checks. Some packages will not operate properly unless

some other package is installed, too. RPM makes sure the package being installed will have its dependency requirements met. It also ensures that the package's installation

will not cause dependency problems for other already-installed packages.

<LI>          Checks for conflicts. RPM performs a number of checks during this phase.

These checks look for things such as attempts to install an already-installed package,

attempts to install an older package over a newer version, or the possibility that a file might

be overwritten.

<LI>          Performs any tasks required before the install. There are cases where one or

more commands must be given prior to the actual installation of a package. RPM

performs these commands exactly as directed by the package builder, thus eliminating

a common source of problems during installations.

<LI>          Decides what to do with config files. One of the features that really sets RPM

apart from other package managers is the way it handles configuration files. Since these

files are normally changed to customize the behavior of installed software, simply

overwriting a config file would tend to make people angry&#151;all their customizations would

be gone! Instead, RPM analyzes the situation and attempts to do &quot;the right thing&quot;

with config files, even if they weren't originally installed by RPM!

</UL>

<BR>

<P>



<CENTER>

<TABLE BGCOLOR="#FFFF99">

<TR><TD><B>

NOTE

</B></TD></TR>

<TR><TD>

<BLOCKQUOTE>

To learn exactly what &quot;the right thing&quot; means, turn to section 4.1.1 in Chapter 4, &quot;Using RPM to Upgrade Packages,&quot; for more details.

</BLOCKQUOTE></TD></TR>

</TABLE></CENTER>

</P>

<UL>

<LI>          Unpacks files from the package and puts them in the proper place. This is the

step most people think of when they think about installing software. Each package

file contains a list of files that are to be installed, as well as their destination on

your system. In addition, many other file attributes, such as permissions and

ownerships, are set correctly by RPM.

<LI>          Performs any tasks required after the install. Very often a new package requires

that one or more commands be executed after the new files are in place. An example of

this is running ldconfig to make new shared libraries accessible.

<LI>          Keeps track of what has been done. Every time RPM installs a package on

your system, it uses its database to keep track of the files it installed. The database

contains a wealth of information necessary for RPM to do its job. For example, RPM uses the database when it checks for possible conflicts during an install.

</UL>



<A NAME="PAGENUM-20"><P>Page 20</P></A>





<H3><A NAME="ch02_ 3">

2.2. Performing an Install

</A></H3>



<P>Let's have RPM install a package. The only thing necessary is to give the command rpm -i, followed by the name of the package file:

</P>



<!-- CODE SNIP //-->

<PRE>

# rpm -i eject-1.2-2.i386.rpm

#

</PRE>

<!-- END CODE SNIP //-->



<P>At this point, all the steps outlined previously have been performed. The package is now

installed. Note that the filename need not adhere to RPM's file-naming convention:

</P>

<!-- CODE SNIP //-->

<PRE>

# mv eject-1.2-2.i386.rpm baz.txt

# rpm -i baz.txt

#

</PRE>

<!-- END CODE SNIP //-->



<P>In this case, we changed the name of the package file

eject-1.2-2.i386.rpm to baz.txt and then proceeded to install the package. The result is identical to the previous install; that is,

the eject-1.2-2 package successfully installed. The name of the package file, although

normally incorporating the package label, is not used by RPM during the installation process. RPM

uses the contents of the package file, which means that even if the file were placed on a DOS

floppy and the name truncated, the installation would still proceed normally.

</P>



<H4><A NAME="ch02_ 4">

2.2.1. URLs: Another Way to Specify Package Files

</A></H4>



<P>If you've surfed the World Wide Web, you've no doubt noticed the way Web pages are identified. Here's an example:

</P>



<!-- CODE //-->

<PRE>

<a href="http://www.redhat.com/support/docs/rpm/rpm-howto/rpm-howto.html">

http://www.redhat.com/support/docs/rpm/RPM-HOWTO/RPM-HOWTO.html</A>

</PRE>

<!-- END CODE //-->



<P>This is called a uniform resource locator, or

URL. RPM can also use URLs, although they look a little bit different. Here's one:

</P>



<!-- CODE SNIP //-->

<PRE>ftp://ftp.redhat.com/pub/redhat/code/rpm/rpm-2.3-1.i386.rpm

</PRE>

<!-- END CODE SNIP //-->



<P>ftp: signifies that this URL is a File Transfer Protocol URL. As the name implies, this type

of URL is used to move files around. The section containing

ftp.redhat.com specifies the hostname, or the name of the system where the package file resides.

</P>



<P>The remainder of the URL

(/pub/redhat/code/rpm/rpm-2.3-1.i386.rpm) specifies the path

to the package file, followed by the package file itself.

</P>



<P>RPM's use of URLs gives you the ability to install a package located on the other side of the world, with a single command:

</P>



<!-- CODE SNIP //-->

<PRE>

# rpm -i ftp://ftp.gnomovision.com/pub/rpms/foobar-1.0-1.i386.rpm

#

</PRE>

<!-- END CODE SNIP //-->



<P>This command would use anonymous FTP to obtain the

foobar version 1.0 package file and install it on your system. Of course, anonymous FTP (no username and password required)

is

</P>



<P><CENTER>

<a href="../ch01/0013-0016.html">Previous</A> | <a href="../ewtoc.html">Table of Contents</A> | <a href="0021-0023.html">Next</A>

</CENTER></P>











</td>
</tr>
</table>

<!-- begin footer information -->







</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -