Detailed steps to build OCaml can be found here.

The text might scare some, but the steps for Ubuntu are fairly straightforward. Here are the steps:

First, download a version from the release page


$ tar -xf ocaml-4.03.0.tar.xz
$ cd ocaml-4.03.0
$ ./configure
$ make world
$ make opt
$ sudo su
# umask 022
# make install
# make clean
# exit
$ wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin

The explanation for the above commands are:

  1. extract the archive file
  2. configure
  3. build the OCaml compiler (bytecode and native code)
  4. become root and install to binary directory
  5. clean up
  6. Install opam