0

Part 1

I have CentOS with no Internet access. I have a docker container based on Ubuntu. I want to install Python inside the Docker container. I downloaded some .deb files for installing Python 2.7. I tried to install them with apt-get. But those commands required Internet access. I used dpkg -i to install the packages. I use dpkg -i libpython2.7-stdlib_2.7.6_8_amd64.deb. I then followed up with apt-get install -f. I am prompted with a yes/no question about extra packages. I chose Y. I then received an error about not being able to reach some URLs. This isn't surprising because the underlying server cannot get to the Internet. The URLs refer to python2.7-minimal_2.7.5-5ubuntu3_amd64.deb among others. I specifically have this .deb file. But when I try to install it, I get an error about an unmet dependency python2.7-minimal. I am well aware that this was not installed. I want it installed.

How do I install python2.7-minimal_2.7.6-amd64.deb in Docker?

Part 2

I tried to workaround the problem that I don't know how to solve. I obtained Python-2.7.11.tar.xz. It is 12 MB. In the Docker container, tried this:

tar xvf Python-2.7.11.tar.xz

But I get tar (child): xz: connect exec: No such file or directory

I verified the file exists. In fact, when I type the command "tar xvf Python2.7" I can press tab to complete the full name of the file. Is there a standalone file or other offline method for installing Python?

Final request:

Ideally I can get assistance for both parts even though only one needs to work.

  • 1
    Do you need to do it while blindfolded also? – jordanm Apr 1 '16 at 23:55
  • The easy thing to do might be to set up the docker container elsewhere and move over the whole image. I wouldn't replace python that way too - there's a reasonble risk you may break something. Also, that's an xz compressed file and needs another application for it – Journeyman Geek Apr 2 '16 at 2:38
1

The cache solution in Mark Smith's answer is a great idea; I've done that succesfully.

Another solution, having on my machine internet connection and SSH connection to the VM's is: Install a proxy (squid) on my machine that has SSH connection to the firewalled VM's. Declare on the firewalled VM's a local proxy 127.0.0.1:3128 and make an SSH tunnel from that port to my own machine's port.

This way you can install, update, and patch dynamically.

0

I have had to do this (albeit with different packages, not Python) a few times on build machines which are not allowed to see the Internet and are in a different part of the building to my Internet-connected machine. It's a bit of a pain.

There are ways to recursively list the dependencies of a given package (some given here), so that you can download them all in one go, and minimise the to-ing and fro-ing, but in reality I find the following easier:

  • Install the same OS in a virtual machine which CAN see the internet.
  • Install what you need onto it.
  • Copy /var/cache/apt/archives/* to a CD (or however you move the stuff to this machine) and then you'll have everything you need. Either copy it all into /var/cache/apt/archives on your target machine, or if you're trying to keep it minimal, do them one at a time as you need them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.