How to install a specific version of apt?
I have apt version 1.6.12, I want to install apt version 1.4.2 and use it.I have tried
sudo apt-get install apt=1.4.2but it gives "E: Version '1.4.2' for 'apt' was not found".
1 Answer
First and foremost, I would strongly advise against this. This can break your system in many ways.
On Linux, you should use a virtual environment (KVM, VirtualBox), or LXC/LXD to install an older environment, and do whatever you wish. Downgrading core components like this can be very dangerous.
Details...
apt does not support installing multiple versions of a software. You basically have a set of so called sources in the /etc/apt/sources.list file and /etc/apt/sources.list.d/ folder. These are practically just links, and at the end of the links, there is just a list of packages.
Meaning, a package will only have one version.
So how do you download an older package?
Method A - Direct download & install: You can usually download an older version by using a different repository. Usually one, that is meant for a previous release of your distribution. For example, let's say you are using Ubuntu 18.04. Then, you can grab a 16.04 package from the relevant repository and install it.
Sometimes this works, sometimes this is not so straightforward.
To search Ubuntu packages:
To search Debian packages:
You can just grab the .deb file of what you are looking for. Keep in mind, Linux is not like Windows. Here, a package will have dependencies. So installing an older software and such can be more than troublesome. Still, if you opt for this route, go to the links, pick your target, and grab the .deb files for your target architecture.
Once you have the files, use dpkg -i packagename.deb to install the target file(s).
Method B - APT-Pinning: There is also a so called APT-Pinning that let's you grab just a package and the dependencies from a different repository. But you must read this documentation very carefully, as this too, can cause a system breakage.
1