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

📄 521-524.html

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

<HEAD>

<TITLE>Using Linux:Managing Applications</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=0789716232//-->

<!--TITLE=Using Linux//-->

<!--AUTHOR=William Ball//-->

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

<!--IMPRINT=Que//-->

<!--CHAPTER=30//-->

<!--PAGES=521-524//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="517-521.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="524-528.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<P><FONT SIZE="+1"><B><I>Installing the <I>vim rpm</I> package

</I></B></FONT></P>

<DL>

<DD><B>1.</B>&nbsp;&nbsp;<TT>rpm</TT> software packages generally follow a standard naming convention:

<!-- CODE SNIP //-->

<PRE>

name-version-release.arch.rpm

</PRE>

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

<BR><TT><I>name</I></TT> is the package&#146;s name, <TT><I>version</I></TT> is the package&#146;s version, <TT><I>release</I></TT> is the package&#146;s release level, <TT><I>arch</I></TT> is the hardware architecture the package is for, and <TT>rpm</TT> is the default extension. This naming scheme is quite handy because some of the essential information about a particular package can be determined from just looking at its name.

<DD><B>2.</B>&nbsp;&nbsp;For this example, <TT>vim</TT> package, <TT>vim</TT> version 4.5, release 2 is installed for a computer with the i386 architecture. To install this package, mount your Red Hat CD-ROM on <TT>/mnt/cdrom</TT> using the <TT>mount</TT> command, like this:

<!-- CODE SNIP //-->

<PRE>

<B># mount /mnt/cdrom</B>

</PRE>

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

<BR>The package you want to install is located in the following directory:

<!-- CODE SNIP //-->

<PRE>

/mnt/cdrom/RedHat/RPMS/vim-4.5-2.i386.rpm

</PRE>

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

<DD><B>3.</B>&nbsp;&nbsp;Use <TT>cd</TT> to change to the appropriate directory, then install <TT>vim</TT> by using the <TT>rpm</TT> command&#146;s <TT>i</TT>, <TT>v</TT>, and <TT>h</TT> options, followed by the name of <TT>vim</TT>&#146;s <TT>rpm</TT> file, like so:

<!-- CODE SNIP //-->

<PRE>

<B># rpm -ivh vim-4.5-2.i386.rpm</B>

</PRE>

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

<BR>As the package is installed, the output will look like the following:

<!-- CODE SNIP //-->

<PRE>

vim                         ################

</PRE>

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

<BR>When the install is finished, 50 hash marks are displayed.

</DL>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>SEE ALSO</B><BR>&#149; To learn more about other text editors for Linux besides <TT>vim</TT>, see page 49.<HR></FONT>

</BLOCKQUOTE>

<P>In this example, I used the pound character (<TT>#</TT>) to indicate the root prompt because only root can properly install packages for an entire system. If you try to install this package as a user other than root, an error similar to the following will be generated:</P>

<!-- CODE SNIP //-->

<PRE>

failed to open //var/lib/rpm/packages.rpm

error: cannot open //var/lib/rpm/packages.rpm

</PRE>

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

<P>Occasionally, the files that one package installs conflict with the files of a previously installed package. If you had <TT>vim</TT> version 4.2 installed, the following message would have been generated:</P>

<!-- CODE SNIP //-->

<PRE>

/bin/vim conflicts with file from vim-4.2-8/usr/share/vim/vim_tips.txt

conflicts with file from vim-4.2-8

error: vim-4.5-2.i386.rpm cannot be installed

</PRE>

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

<P>If you wanted to install these files anyway, the <TT>--replacefiles</TT> option can be added to the command.</P>

<P>Another type of conflict that is sometimes encountered is a <I>dependency conflict</I>. This happens when a package that is being installed requires certain other packages to function correctly. For example, perhaps you try to install the following package:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -ivh dosemu-0.66.2-1.i386.rpm</B>

</PRE>

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

<P>You get the following dependency errors:

</P>

<!-- CODE SNIP //-->

<PRE>

failed dependencies:

kernel &gt;= 2.0.28 is needed by dosemu-0.66.2-1

dosemu = 0.64.1 is needed by xdosemu-0.64.1-1

</PRE>

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

<P>This indicates two things. You must upgrade your kernel to 2.0.28, and if you install a newer version of <TT>dosemu</TT>, you must also install a newer version of <TT>xdosemu</TT>. Although it is usually not a good idea to ignore dependency problems, using the <TT>--nodeps</TT> option causes <TT>rpm</TT> to ignore these errors and install the package.</P>

<H4 ALIGN="LEFT"><A NAME="Heading5"></A><FONT COLOR="#000077">Upgrading Packages</FONT></H4>

<P><TT>rpm</TT>&#146;s <I>upgrade mode</I> provides an easy way to upgrade existing software packages to newer versions. Upgrade mode is similar to install mode:</P>

<!-- CODE SNIP //-->

<PRE>

rpm -U [options] [packages]

</PRE>

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

<P><TT><I>options</I></TT> can be any of the install options or any of the general options.</P>

<P>Here is an example of how to upgrade packages. Suppose that on your system you are currently running <TT>emacs</TT> version 19.31, but you want to upgrade to the newer <TT>emacs</TT> version 19.34. To upgrade, use the following command:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -Uvh emacs-19.34-4.i386.rpm</B>

</PRE>

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

<P>The upgrade mode is really a combination of two operations, uninstall and install. First, <TT>rpm</TT> uninstalls any older versions of the requested package, and then installs the newer version. If an older version of the package does not exist, <TT>rpm</TT> simply installs the requested package.</P>

<P>An additional advantage of upgrade over a manual install and uninstall is that upgrade automatically saves configuration files. For these reasons, some people prefer to use upgrade rather than install for all package installations.</P>

<H4 ALIGN="LEFT"><A NAME="Heading6"></A><FONT COLOR="#000077">Uninstalling Packages</FONT></H4>

<P>The uninstall mode of <TT>rpm</TT> provides for a clean method of removing files belonging to a software package from many locations.</P>

<BLOCKQUOTE>

<P><FONT SIZE="-1"><HR><B>SEE ALSO</B><BR>&#149; To learn about other ways to delete files, see page 42.<HR></FONT>

</BLOCKQUOTE>

<P>Many packages install files in <TT>/etc</TT>, <TT>/usr</TT>, and <TT>/lib</TT>, so removing a package can be confusing, but with <TT>rpm</TT> an entire package can be removed as follows:</P>

<!-- CODE SNIP //-->

<PRE>

rpm -e [options] [package]

</PRE>

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

<P><TT><I>options</I></TT> is one of the options listed later in this section, and <TT><I>package</I></TT> is the name of the package to be removed. For example, if you want to remove the package for <TT>dosemu</TT>, the command is as follows:</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -e dosemu</B>

</PRE>

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

<P>The name specified here for the package is just the name of the package, not the name of the file that was used to install the package. Perhaps you ask for the following:

</P>

<!-- CODE SNIP //-->

<PRE>

<B># rpm -e dosemu-0.64.1-1.i386.rpm</B>

</PRE>

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

<P>The following error would have been generated:

</P>

<!-- CODE SNIP //-->

<PRE>

package dosemu-0.64.1-1.i386.rpm is not installed

</PRE>

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

<P>Another common error encountered while trying to uninstall packages is a <I>dependency error</I>. This occurs when a package that is being uninstalled has files required by another package. For example, when you try to remove <TT>dosemu</TT> from your system, you get the following error:</P>

<!-- CODE SNIP //-->

<PRE>

removing these packages would break dependencies:

dosemu = 0.64.1 is needed by xdosemu-0.64.1-1

</PRE>

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

<P><BR></P>

<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="517-521.html">Previous</A></TD>

<TD><A HREF="../ewtoc.html">Table of Contents</A></TD>

<TD><A HREF="524-528.html">Next</A></TD>

</TR>

</TABLE>

</CENTER>





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

<!-- begin footer information -->





</body></html>

⌨️ 快捷键说明

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