个人工具
登录
查看“UbuntuHelp:PinningHowto”的源代码 - Ubuntu中文
UbuntuHelp
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“UbuntuHelp:PinningHowto”的源代码
来自Ubuntu中文
←
UbuntuHelp:PinningHowto
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{From|https://help.ubuntu.com/community/PinningHowto}} {{Languages|UbuntuHelp:PinningHowto}} This wiki page will discuss some advanced things you can do to packages to accomplish specific goals. The first thing described is Pinning, this is useful if you want only some things from a newer version of Ubuntu. There is also package holding, which allows you to not update the package. == Introduction to Pinning == Pinning is a process that allows you to remain on a stable release of Ubuntu (or any other debian system) while grabbing packages from a more recent version. Note however that the processes described below will only work if things like libc6 versions match, so you should probably not do this on an Ubuntu system. I strongly recommend you look at [[UbuntuHelp:UbuntuBackports|UbuntuBackports]] before doing this. === Pinning Methods === There are 3 main files you must edit for pinning to even function. It is important to start out by setting your default release to avoid accidentally upgrading all packages, by editing /etc/apt/apt.conf [in intrepid that is /etc/apt/apt.conf.d/01ubuntu, "intrepid" rather than "hardy"] as follows: <pre><nowiki> APT::Default-Release "hardy"; </nowiki></pre> The second file is: /etc/apt/sources.list An example configuration is as follows: <pre><nowiki> # official ubuntu sites deb http://archive.ubuntu.com/ubuntu hardy main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse </nowiki></pre> In this example, we're pulling from hardy and intrepid (the current development version of Ubuntu). The next file involved is: /etc/apt/preferences The 'preferences' file is where the actual pinning takes place. To pin a package, set its Pin-Priority to higher number. Here's an example: <pre><nowiki> Package: firefox-3.0 Pin: release a=hardy Pin-Priority: -10 Package: firefox-3.0 Pin: release a=intrepid Pin-Priority: 900 </nowiki></pre> In this example, we're giving a higher priority to Firefox from intrepid because we want rc1 instead of beta5. This of course can be done with any package, or even all packages - although in the above example, you likely want to change hardy and intrepid Pin-Priority values around so that hardy is default. For further information please read: man apt_preferences ==== Debugging Package Priorities ==== To print out the priorities of each source, run `apt-cache policy`. For priorities for packages, run `apt-cache policy packagename[s]`. === Recommended alternative to pinning === In Ubuntu, most times, the libc6 version is updated from version to version - it is not the purpose of this page to describe what libc6 is, but needless to say it breaks the above example. A better method for grabbing things from a development version while not committing your entire machine to that version is as follows: Add the following line to /etc/apt/sources.list <pre><nowiki> deb-src http://archive.ubuntu.com/ubuntu intrepid main restricted universe multiverse </nowiki></pre> Then you'll need to update your repos: <pre><nowiki> sudo apt-get update </nowiki></pre> Now we need to install some packages so we can build the desired software in intrepid: <pre><nowiki> sudo apt-get build-dep firefox-3.0 </nowiki></pre> Now we can do the following to get the package built from intrepid on our hardy machine: <pre><nowiki> sudo apt-get -b source -t intrepid firefox-3.0 </nowiki></pre> It will output lots of info on the screen, when it's done (could take a while), you will have rc1 instead of beta5! == Introduction to Holding Packages == Holding a package basically means you're telling the package manager to keep the current version no matter what. This is useful if more recent version of a currently working program breaks after an update. The following will describe the process of actually holding the package, there are several options to accomplish this: === Synaptic === {|border="1" cellspacing="0" | https://help.ubuntu.com/community/PinningHowto?action=AttachFile&do=get&target=lockver.png |} First way to hold a package is in Synaptic: *Open Synaptic: System -> Administration -> Synaptic Package Manager *Click Search and type the package's name in the Search box *Highlight the version you want to pin '''Make sure that you select the correct version''' *Once the correct package is selected, Click Package -> Lock Version *Close Synaptic <<BR>> === Apt/Dpkg === Second way is to hold it with Apt/Dpkg: *Open a terminal *sudo -s and hit enter *Enter your password for sudo <pre><nowiki> echo libxfont1 hold | dpkg --set-selections </nowiki></pre> '''Replace libxfont1 with the package you want to pin''' *Now run sudo apt-get update and then sudo apt-get upgrade == Removing a Hold == To remove a package from hold, you can run "sudo apt-get install libxfont1" (replacing libxfont1 with the package you wish to remove). To see what the next version of the package is, use `apt-cache policy packagename` (see ''Debugging Package Priorities'' above). === Synaptic === To remove the pin in Synaptic: *Open Synaptic *Search for the correct package *Click on package to highlight it *Once the correct package is selected, Click Package -> Lock Version to remove the checkmark *Close Synaptic === Apt/Dpkg === To remove pin from Apt/Dpkg: *Open a terminal *sudo -s and hit enter *Enter your password for sudo *<pre><nowiki> echo libxfont1 install | dpkg --set-selections </nowiki></pre> '''Replace libxfont1 with the package you want to pin''' *Now run sudo apt-get update and then sudo apt-get upgrade '''NOTE''' At the time of the making this Wiki there is not a known way to Pin a package with Update Manager. Pinning should never be used for installing Debian binary packages on Ubuntu. Ubuntu strongly recommends against using Debian binary packages on Ubuntu, == Karmic Example == === Pinning the ubuntu-mozilla-daily PPA === "I regularly use a package from the Ubuntu Daily Mozilla PPA. Unfortunately the PPA also contains snapshot builds of Firefox 3.5 and XulRunner 1.9.1, which I want to keep at their standard Ubuntu versions". The Pinning Solution To make apt-get upgrading as painless as possible set a lower Pin-Priority on the PPA, this will stop unwanted package versions from installing. Once set, packages from the ubuntu-mozilla-daily PPA will always lose in any contest with packages from other repositories, even if they have a higher version. Create the file: <ol><li>/etc/apt/preferences.d/ubuntu-mozilla-daily-pin-400 </li><li>Add the following to the file:</li></ol> Code: <pre><nowiki> Package: * Pin: release o=LP-PPA-ubuntu-mozilla-daily Pin-Priority: 400 </nowiki></pre> Use the following commands, before and after, to check that the Pin-Priority has been updated. <pre><nowiki> apt-cache policy </nowiki></pre> <pre><nowiki> apt-cache policy firefox-3.5 </nowiki></pre> Make sure the file name does not have a dot in it! == Links == These documents were used as a foundation for this page, and might give you more background information: * For Basic apt-get usage and instructions see [[UbuntuHelp:AptGetHowTo|AptGetHowTo]] * [http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html The official Debian documentation] [[category:UbuntuHelp]]
该页面使用的模板:
模板:From
(
查看源代码
)
模板:Languages
(
查看源代码
)(受保护)
模板:Languages/Lang
(
查看源代码
)(受保护)
返回至
UbuntuHelp:PinningHowto
。