I have to install a package (let's call it foobar) on a RHEL 6 server which has some pretty tight constraints:the server cannot access the Internet due to security reasonsit lacks quite a lot of packages, e.g. the C compiler is missingthe foobar to be installed is not the latest version but a previous oneThe biggest problem is solving the dependencies. Because of point #3 I cannot simply run yumdownloader --resolve foobar-3.1.3-1 on an Internet-connected machine to grab the RPMs, transfer them to the server and then do a localinstall: AFAIK yum only works with the latest package versions.Also, grabbing the code source of the foobar package and compiling it is not an option because of point #2. 
Install and solve dependencies offline for an old version of a package
yum
Since the answer might interest other people, here's how I solved the problem after constraint #3 was relaxed.  I did a minimal installation of RHEL 6 on another machine.  Then I simulated an install of foobar via yum, got the list of dependencies, and wrote a script to have yumdownloader fetch all the packages.  Finally I packaged the RPMs into a local repo and transferred it to the server.  All that was left to do after that is to run yum install foobar on the server.      