Hookstark
Hookstark

Reputation: 1159

Linux: How to install certain old version of a software via apt-get

I am trying to install the same versions of Apache, MySQL and PHP in my Linux PC (Raspberry Debian) as installed in my remote public server.

For instance, I'd like to install the last legacy release of the 2.2 branch, Apache/2.2.31.

apt-cache showpkg apache2

Output:

Package: apache2
Versions: 
2.4.10-10+deb8u4 (/var/lib/apt/lists/mirrordirector.raspbian.org_raspbian_dists_jessie_main_binary-armhf_Packages)

But there isn't any information about the 2.2.31 version, neither in "Reverse Provides" section. I can do it by compiling from the sources, but it takes a lot of time. And I tried to find a reliable PPA or a reliable sources for deb packages, without any success.

How can I do it?

Upvotes: 4

Views: 20715

Answers (3)

mrbean
mrbean

Reputation: 581

Warning do this at your own risk!!!

Running things like sid (unreleased/unstable distribution) from sources list can potentially update all the packages on your Raspberry Pi (PC). You probably don't want to do this.

You might be able to find a previous Debian distribution with that version of package.

On Debian, you can add mirrors to the /etc/apt/sources.list file in order to download different versions of packages from different Debian distributions/archives.

You can also download and install a Debian package (*.deb) by downloading the package from Debian's website and installing the package via dpkg -i; however, here is advice from 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.

To follow this advice, update /etc/apt/sources.list.

Before updating that file, you will need to gather more information. For example:

  • A download mirror (i.e. http:// or ftp)
  • Debian distribution information (i.e. bookwarm, sid (unreleased), ...etc.)
  • The archive area where the package lives (i.e. contrib archive)

Once you have that, you can edit /etc/apt/sources.list accordingly.

Example: deb http://ftp.de.debian.org/debian sid main contrib

Be sure to read up on how the sources list works on Debian's website:

https://wiki.debian.org/SourcesList

https://www.debian.org/doc/debian-policy/ch-archive.html

https://wiki.debian.org/DebianUnstable

Here would be the full process:

Let's say you wanted to download a newer version of a package:

  1. Open /etc/apt/sources.list in a text editor
  2. Add the necessary Debian information to sources.list

Example: deb http://deb.debian.org/debian sid main contrib non-free non-free-firmware

  1. Run sudo apt-get update to update the sources
  2. Run sudo apt install <disired-package>=<version> to install desired package version

You may need to hunt around the Debian webpage to find the desired version numbers and the mirrors that host the different versions of packages.

Don't be afraid to experiment.

Upvotes: 0

saq7
saq7

Reputation: 1818

If APT tracks the specific version you are looking for, (like Kyle said) then it's pretty easy.

sudo apt-get install <pkg_name>=<pkg_version>

or

sudo apt-get -t=<target_version> <pkg_name>

To see which packages are tracked, run

apt-cache showpkg <package_name> 

Unfortunately though, if a particular version is not managed by the APT, then you are out of luck using APT. It might be managed by some of the other package managers out there.

Upvotes: 6

Kyle Douglas
Kyle Douglas

Reputation: 1

Ref. How can I downgrade a package via apt-get?

If you have the version number, or the target release, apt-get supports choosing a particular version or target release. More details can be found on manual page of apt-get. It can also be accessed from a terminal by typing man apt-get.

sudo apt-get install <package-name>=<package-version-number> 

or

sudo apt-get -t=<target release> install <package-name>

Upvotes: 0

Related Questions