OpamPack is a shell script that creates a tar.gz file containing all
the dependencies of a project, enabling the installation of a minimal
OCaml environment on a machine that doesn’t have access to the internet.
Notes describing in detail what it does internally are available here
On the machine connected to the internet, run:
./OpamPack.sh ocaml.4.12.0 ocamlbuild zarith zmq sexplib ppx_sexp_conv ppx_deriving getoptDon’t forget to include the ocaml package with the version of the
compiler you want.
In the _build directory, you will find a file named
opampack.tar.gz containing all you need to install OPAM, OCaml and
the dependencies you specified in the command line without any
network access.
Copy the opampack.tar.gz file to the machine that doesn’t have
internet access, and extract the file:
tar -zxvf opampack.tar.gz
And run the install script in the opampack directory:
cd opampack ./install.sh
Before using OCaml, you will need to execute:
export OPAMROOT=/path/to/opampack/opamroot
eval $(/path/to/opampack/opam env --root=$OPAMROOT)