我正在尝试在我的 Linux PC (Raspberry Debian) 中安装与远程公共服务器中安装的相同版本的 Apache、MySQL 和 PHP。
例如,我想安装 2.2 分支的最后一个旧版本 Apache/2.2.31。
apt-cache showpkg apache2
输出:
Package: apache2
Versions:
2.4.10-10+deb8u4 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_jessie_main_binary-armhf_Packages)
但是没有任何关于 2.2.31 版本的信息,“反向提供”部分也没有。我可以通过从源代码编译来完成,但这需要很多时间。我尝试寻找可靠的 PPA 或 deb 包的可靠来源,但没有成功。
我该怎么做?
如果 APT 跟踪您正在寻找的特定版本(就像凯尔所说),那么这非常简单。
sudo apt-get install <pkg_name>=<pkg_version>
或
sudo apt-get -t=<target_version> <pkg_name>
要查看跟踪了哪些包,请运行
apt-cache showpkg <package_name>
不幸的是,如果某个特定版本不由 APT 管理,那么您就无法使用 APT。它可能由其他一些包管理器管理。
如果您有版本号或目标版本,apt-get支持选择特定版本或目标版本。更多详细信息可以在 apt-get 的手册页上找到。也可以通过输入 man apt-get 从终端访问它。
sudo apt-get install <package-name>=<package-version-number>
或
sudo apt-get -t=<target release> install <package-name>
您也许可以找到包含该版本软件包的先前 Debian 发行版。
在 Debian 上,您可以将镜像添加到
/etc/apt/sources.list
文件中,以便从不同的 Debian 发行版/存档下载不同版本的软件包。
您还可以通过从 Debian 网站下载软件包并通过
dpkg -i
安装软件包来下载并安装 Debian 软件包(*.deb);然而,这是 Debian 的建议:
If you are running Debian, it is strongly suggested to use a package manager like aptitude or synaptic to download and install packages, instead of doing so manually via this website.
You should be able to use any of the listed mirrors by adding a line to your /etc/apt/sources.list like this:
deb http://ftp.de.debian.org/debian sid main contrib
Replacing ftp.de.debian.org/debian with the mirror in question.
要遵循此建议,请更新
/etc/apt/sources.list
。
在更新该文件之前,需要更多信息。例如:
bookwarm
、sid
(未发布)、...等)contrib
存档)一旦获得,请相应地编辑
/etc/apt/sources.list
。
示例:
deb http://ftp.de.debian.org/debian sid main contrib
请务必阅读 Debian 网站上的源列表如何工作:
https://wiki.debian.org/SourcesList
https://www.debian.org/doc/debian-policy/ch-archive.html
https://wiki.debian.org/DebianUnstable
完整流程如下:
假设您想下载更新版本的软件包:
/etc/apt/sources.list
sources.list
示例:
deb http://deb.debian.org/debian sid main contrib non-free non-free-firmware
sudo apt-get update
sudo apt install <disired-package>=<version>
安装所需的软件包版本您可能需要在 Debian 网页上查找所需的版本号以及托管不同版本软件包的镜像。
不要害怕尝试。