Can I have two versions of the same package in an apt repository?
Solution 1:
Yes, you can, and you don't need to do anything special. In fact, the usual Debian and Ubuntu repositories typically do have several versions of each package (from oldstable/stable/testing/unstable or dapper/hardy/lucid/maverick/natty). The distributions only have a single package in each version's index file (the Packages
files), but you don't have to follow suit.
Of course, apt-get install myapp
will only install the latest version (unless configured otherwise). You can run apt-get install myapp=1.42
to force the installation of version 1.42.
Caveat: if all the versions have the same package name, you can't have more than one installed at the same time. If this is important, give each version a different package name: myapp-1.42
, myapp-1.43
, etc. Debian and Ubuntu do this for major versions of libraries, where you may need more than one if you have executables linked with different libraries (e.g. libcap1
and libcap2
), as well as for a few other packages such as the kernel.