一、指定版本命令
apt-get install <<package name>>=<<version>>
For example
sudo apt-get update
sudo apt-get install apache2=2.2.20-lubuntu1
二、查询所有可用版本pkg
0.通过官网查询
1.使用apt-cache madison命令
apt-cache madison <<package name>>
For example
apt-cache madison vim
vim | 2:7.3.547-1 | http://debian.mirrors.tds.net/debian/ unstable/main amd64 Packages
vim | 2:7.3.429-2 | http://debian.mirrors.tds.net/debian/ testing/main amd64 Packages
vim | 2:7.3.429-2 | http://http.us.debian.org/debian/ testing/main amd64 Packages
vim | 2:7.3.429-2 | http://debian.mirrors.tds.net/debian/ testing/main Sources
vim | 2:7.3.547-1 | http://debian.mirrors.tds.net/debian/ unstable/main Sources
2.使用apt-cache policy 命令
apt-cache policy <<package name>>
或这
apt policy <<package name>>
输出结果如图
apt-cache policy gdb
gdb:
Installed: 7.7.1-0ubuntu5~14.04.2
Candidate: 7.7.1-0ubuntu5~14.04.2
Version table:
*** 7.7.1-0ubuntu5~14.04.2 0
500 http://fr.archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
100 /var/lib/dpkg/status
7.7-0ubuntu3 0
500 http://fr.archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages