📄 pkgmgt.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content= "application/xhtml+xml; charset=iso-8859-1" /> <title> 10.2. Package Management </title> <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /> <link rel="stylesheet" href="../stylesheets/lfs-print.css" type= "text/css" media="print" /> </head> <body id="lfs" class="CLFS-SVN-20060417-MIPS"> <div class="navheader"> <div class="headertitles"> <h4> Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS </h4> <h3> Chapter 10. Installing Basic System Software </h3> </div> <ul class="headerlinks"> <li class="prev"> <a accesskey="p" href="chapter.html" title= "Installing Basic System Software">Prev</a> <p> Installing Basic System Software </p> </li> <li class="next"> <a accesskey="n" href="testsuitesagain.html" title= "About Test Suites, Again">Next</a> <p> About Test Suites, Again </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 10. Installing Basic System Software">Up</a>. </li> <li class="home"> <a accesskey="h" href="../index.html" title= "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS"> Home</a> </li> </ul> </div> <div class="sect1" lang="en" xml:lang="en"> <div class="titlepage"> <h1 class="sect1"> 10.2. Package Management </h1> </div> <p> Package Management is an often requested addition to the LFS Book. A Package Manager allows tracking the installation of files making it easy to remove and upgrade packages. Before you begin to wonder, NO—this section will not talk about nor recommend any particular package manager. What it provides is a roundup of the more popular techniques and how they work. The perfect package manager for you may be among these techniques or may be a combination of two or more of these techniques. This section briefly mentions issues that may arise when upgrading packages. </p> <p> Some reasons why no specific package manager is recommended in LFS or BLFS include: </p> <div class="itemizedlist"> <ul> <li> <p> Dealing with package management takes the focus away from the goals of these books—teaching how a Linux system is built. </p> </li> <li> <p> There are multiple solutions for package management, each having its strengths and drawbacks. Including one that satisfies all audiences is difficult. </p> </li> </ul> </div> <p> There are some hints written on the topic of package management. Visit the <a href= "http://www.linuxfromscratch.org/hints/downloads/files/"><i>Hints subproject</i></a> and see if one of them fits your need. </p> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="sect2"> 10.2.1. Upgrade Issues </h2> </div> <p> A Package Manager makes it easy to upgrade to newer versions when they are released. Generally the instructions in the LFS and BLFS Book can be used to upgrade to the newer versions. Here are some points that you should be aware of when upgrading packages, especially on a running system. </p> <div class="itemizedlist"> <ul> <li> <p> If one of the toolchain packages (Glibc, GCC or Binutils) needs to be upgraded to a newer minor version, it is safer to rebuild LFS. Though, you <span class= "emphasis"><em>may</em></span> be able to get by rebuilding all the packages in their dependency order, we do not recommend it. For example, if glibc-2.2.x needs to be updated to glibc-2.3.x, it is safer to rebuild. For micro version updates, a simple reinstallation usually works, but is not guaranteed. For example, upgrading from glibc-2.3.4 to glibc-2.3.5 will not usually cause any problems. </p> </li> <li> <p> If a package containing a shared library is updated, and if the name of the library changes, then all the packages dynamically linked to the library need to be recompiled to link against the newer library. (Note that there is no correlation between the package version and the name of the library.) For example, consider a package foo-1.2.3 that installs a shared library with name <tt class= "filename">libfoo.so.1</tt>. Say you upgrade the package to a newer version foo-1.2.4 that installs a shared library with name <tt class="filename">libfoo.so.2</tt>. In this case, all packages that are dynamically linked to <tt class= "filename">libfoo.so.1</tt> need to be recompiled to link against <tt class="filename">libfoo.so.2</tt>. Note that you should not remove the previous libraries until the dependent packages are recompiled. </p> </li> <li> <p> If you are upgrading a running system, be on the lookout for packages that use <span><strong class= "command">cp</strong></span> instead of <span><strong class= "command">install</strong></span> to install files. The latter command is usually safer if the executable or library is already loaded in memory. </p> </li> </ul> </div> </div> <div class="sect2" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="sect2"> 10.2.2. Package Management Techniques </h2> </div> <p> The following are some common package management techniques. Before making a decision on a package manager, do some research on the various techniques, particularly the drawbacks of the particular scheme. </p> <div class="sect3" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h4 class="title"> <a id="id3660776" name="id3660776"></a>10.2.2.1. It is All in My Head! </h4> </div> </div> </div> <p> Yes, this is a package management technique. Some folks do not find the need for a package manager because they know the packages intimately and know what files are installed by each package. Some users also do not need any package management because they plan on rebuilding the entire system when a package is changed. </p> </div> <div class="sect3" lang="en" xml:lang="en"> <div class="titlepage"> <div> <div> <h4 class="title"> <a id="id3660772" name= "id3660772"></a>10.2.2.2. Install in Separate Directories </h4> </div> </div> </div> <p> This is a simplistic package management that does not need any extra package to manage the installations. Each package is installed in a separate directory. For example, package foo-1.1 is installed in <tt class="filename">/usr/pkg/foo-1.1</tt> and a symlink is made from <tt class="filename">/usr/pkg/foo</tt> to <tt class="filename">/usr/pkg/foo-1.1</tt>. When installing a new version foo-1.2, it is installed in <tt class= "filename">/usr/pkg/foo-1.2</tt> and the previous symlink is replaced by a symlink to the new version. </p> <p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -