I want to download an old version of an open source project to cut out and re use some of its code that's no longer supported.
If that's all you want to do, you don't even need to install or run the software. All you need to do is download the source code and browse it (in an IDE or just in a text editor) to find the code that you want to cut and paste.
The way to download the source code depends on how it's distributed. Nowadays a lot of open source projects have their code in a public distributed version control repository such as GitHub or GitLab. If that's the case, you can just install the appropriate version control software (e.g. git), clone the repository and then switch to the version you want (since the repository normally contains the entire development history of the software, including all versions ever released).
Note that cloning a git repository doesn't "install" anything to your computer. It just creates a directory with the source code for the software, plus a "hidden" subdirectory (named .git
) that contains the version history in a compressed form, allowing you to switch between different versions of the source code. When you don't need the source code anymore, all you need to do to get rid of it is to delete the directory.
(In fact, you might not even need to download anything, since sites like GitHub and GitLab also let you browse the source code online and have the option to choose which "branch" or "tag" you want to view. This lets you view and copy the source code for older versions directly from the website. However, if you need to copy code from multiple files, cloning the repository may still be easier.)
If the source code is not available via git (or hg or other similar version control software), it may instead be distributed as a series of compressed archives (most commonly .tar.gz
files, a.k.a. "tarballs", which you can decompress using tar -xz
or most GUI file managers), typically one for each released version. This used to be more common in the past, but some older projects may still do it. In that case you need to download the source code archive for the version you want, decompress it into a directory and then browse that directory (just like you'd browse a cloned git repo) to find the code you want. Again, that doesn't require installing the software to your computer.
If you do want to also run the old version of the software, you can usually do that without permanently installing anything to your computer or interfering with other versions of the software you may already have installed. The precise details depend on the software in question, but there will almost always be a way to do this, simply because it's something that software developers need to do a lot.
Typically the source code repository (or tarball) will include instructions for building the software from the source code, often in a text file named BUILDING
, INSTALL
or README
. This file (which might have a suffix like .txt
or .md
or just no suffix at all) will typically contain either plain text (readable in any text editor) or Markdown code (the same syntax that's used for writing questions and answers here on Stack Exchange, intended for rendering as "rich text" but also mostly readable in a plain text editor).
The specific instructions will vary depending on which build system the software uses, but it typically includes several phases:
Pre-build configuration, which may involve either running an "auto-configure" script and/or manually editing a configuration file to e.g. specify which build tools you want to use, where to find any required libraries or other build dependencies, and which optional features you want to include in the built software.
Building the software, which will compile the source code into an executable file (or several files) inside the directory that you've cloned the git repository (or unpacked the source code tarball) into.
Testing, which will run some automated tests on the executable files built in the previous step to verify that they work as intended. (This is an optional step, but it can be very useful if you've made any changes to the code or if you're not 100% sure you've configured it correctly.)
Either installation, which copies the executable files (and any additional data files they may need to run) from the building step into a shared directory (such as /usr/bin
) from which any user on the system can run them, or packaging, which collects the executable files into an installation package (like an .rpm
or .deb
file) that can then be installed using a package manager (and possibly distributed to others to let them install it as well).
Again, the details may vary, but the important thing is that steps 1–3 should not require "root" or administrator access and should not modify anything outside the directory containing the source code repository. Thus, they will not interfere with any other software (including other versions of the same software) that you may have installed.
(The one exception is that you may need to install some libraries, compilers or other development tools to be able to build the software, and while it's usually possible to install those locally without admin access, it's often easiest to just install them globally using your system package manager.)
After step 2, you should be able to run the software from the directory you built it in. And to get rid of it afterwards, you still just need to delete the directory.
(Some software may require you to specify the path where it will be installed into and run from already in step 1. This can be awkward, but it may be required e.g. if the built executable files need to contain paths to data files. Often such software will include instructions for making a "test build", which can be run directly from the build directory without installing it anywhere else, or it will have some other way to allow testing the software without installing it. Because, again, software developers don't want to have to reinstall the software they're working on every time they need to test some change.)