I need to install some rpm, python and R packages on a server that has no internet connexion: I can only ssh to it.
I can download the packages and scp them to the server, then install them manually with rpm -i
and the like. But managing dependencies and finding the right rpm package is cumbersome, and specific to each software (here that would be
yum deplist foo
+yumdownloader foo
+rpm -i foo.rpm
,- a mirror of http://cran.r-project.org/src/contrib/ + https://stackoverflow.com/questions/10807804/offline-install-of-r-package-and-dependencies,
pip install --download ~/bar/ foo
+pip install --no-index --find-links ~/bar/ foo
Plus some dependency management for R and pip.)
So I'm considering another path that could work for any software:
- launch a «manual proxy» locally, as an interactive command-line tool
- in a new console, ask yum/R/pip to use that proxy and to install some package
- whenever yum requests some file from the web (like PACKAGES or foo.tar.gz), the manual proxy prints the URL and waits
- I download said URL from another machine and scp it to the server
- I tell the manual proxy that the file is there, which then answers yum's request.
Is there a tool to implement the manual proxy? It look like mitmproxy could do that, can anyone with knowledge of this tool confirm?
I see those potential challenges:
- I might need to increase yum's timeout.
- If the package manager yum, pip or R uses SSL, I'll need to install mitmproxy's certificate
- installing mitmproxy and its dependencies (on the internet-starved server) might be more hassle than the problem I'm trying to solve.
Any other tool to do that would be also welcome. Maybe a small Python script is enough.
Edit: Answer to TessellatingHeckler's second comment:
- SSH back out from the server? Probably, but the network admin might not be happy about it (plus, setup is not trivial as my computer is also behind a proxy, so I would need double hop + ssh -R).
- github.com/inaz2/proxy2 ? Looks good.
yum localinstall
? It's indeed better thanrpm -i
, but my goal here is (to gain some experience and) a generic solution to any proxy-enabled package managers. Package managers differ in their ways to list dependencies and install form local repo, and those features are usually less documented than telling them to use a proxy.