[转]Ubuntu Precise - Install youtube-dl package using Quantal repo

Ubuntu Precise - Install youtube-dl package using Quantal repo

Ubuntu Precise 12.04 currently contains in repository youtube-dl version 2012.02.27-1. As of recent YouTube changes this package version is not usable anymore but there is an updated version in Ubuntu Quantal 12.10 repository. To use it you need to perform couple of steps described below.

Used Ubuntu release:

$ lsb_release -d -r -c
Description:    Ubuntu 12.04.1 LTS
Release:        12.04
Codename:       precise

Update system packages and perform standard system upgrade operation:

$ sudo apt-get update
$ sudo apt-get upgrade

Verify that there is only youtube-dl 2012.02.27-1 version in repository:

$ apt-cache policy youtube-dl
youtube-dl:
  Installed: 2012.02.27-1
  Candidate: 2012.02.27-1
  Version table:
 *** 2012.02.27-1 0
        500 http://pl.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status

Define default release as Precise (12.04) as for now you (very likely) don't want to upgrade whole system using Quantal (12.10) repository so create file /etc/apt/apt.conf.d/00release with contents:

APT::Default-Release "precise";

Add Quantal repository to /etc/apt/sources.list:

deb http://pl.archive.ubuntu.com/ubuntu/ quantal universe

To upgrade youtube-dl package you need only universe component but if you plan to check out other packages later then you can add more components:

deb http://pl.archive.ubuntu.com/ubuntu/ quantal main restricted universe multiverse

Update package list:

$ sudo apt-get update

As you defined default release as Precise - there should not be any packages to update:

# sudo apt-get upgrade --simulate
Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Verify that there is a new version of youtube-dl in package list:

$ sudo apt-cache policy youtube-dl
youtube-dl:
  Installed: 2012.02.27-1
  Candidate: 2012.02.27-1
  Version table:
     2012.09.27-1 0
        500 http://pl.archive.ubuntu.com/ubuntu/ quantal/universe amd64 Packages
 *** 2012.02.27-1 0
        990 http://pl.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status

Create a file /etc/apt/preferences.d/youtube-dl with contents:

Package: youtube-dl
Pin: release a=quantal
Pin-Priority: 990

APT will use youtube-dl package from Quantal repository unless the installed version is more recent.

$ apt-cache policy youtube-dl
youtube-dl:
  Installed: 2012.02.27-1
  Candidate: 2012.09.27-1
  Package pin: 2012.09.27-1
  Version table:
     2012.09.27-1 990
        500 http://pl.archive.ubuntu.com/ubuntu/ quantal/universe amd64 Packages
 *** 2012.02.27-1 990
        990 http://pl.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
        100 /var/lib/dpkg/status

Now the package is selected to be updated using Quantal repository:

# sudo apt-get -y upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  youtube-dl
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/50.2 kB of archives.
After this operation, 119 kB disk space will be freed.
(Reading database ... 347979 files and directories currently installed.)
Preparing to replace youtube-dl 2012.02.27-1 (using .../youtube-dl_2012.09.27-1_all.deb) ...
Unpacking replacement youtube-dl ...
Processing triggers for man-db ...
Setting up youtube-dl (2012.09.27-1) ...

To learn about package priorities and preference control file for APT read manual page:

$ man apt_preferences

Update - easier solution - use youtube-dl self update

Perform self update to the latest stable version:

$ sudo youtube-dl -U

I overlooked this solution but the first one could be useful for other packages.

Milosz Galazka

posted @   popsuper1982  阅读(465)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
点击右上角即可分享
微信分享提示