Assuming you have installed the Opam with SU permissions on the CENTOS7, return to normal permissions below. Use Opam to install something else.
Opam installation of things, by default in the ~/.opam directory, it does not have permissions to change the system directory of things.
If there is a problem with the configuration, it is simple. Delete ~/.opam directory, everything NEW!
1. Opam Init
Initialize the environment, go all the way yes.
Test whether the criteria for success, see if the environment variables are added well:
Printenv Ocaml_toplevel_path
Sometimes, you might need to perform the following instructions:
Eval ' opam config env '
Note that it is an anti-quote.
2. Opam switch
To check the version number of the compiler, you should switch to the following version:
Opam Switch 4.01.0
This may take some time to wait patiently for the prompt to appear.
Eval ' opam config env '
Refresh the loop change
3. Opam Install core Utop
Install two important packages: core and Utop
In learning "real world OCaml", often used in the core package of things, it must be installed.
Utop offers more powerful features than the toplevel environment that OCaml comes with. such as code auto-completion, convenient document query and so on.
4. Edit the. ocamlinit file
Add the following content:
#use "Topfind";;
#thread;;
#camlp4o;;
#require "Core.top";;
#require "Core.syntax";;
In this way, each time you start Utop, these features will be loaded automatically.
Many of the books are in need of CORE.STD package support, so, after entering Utop, do not forget:
Open core.std;;
5. Start Utop
Now, the environment is ready, you can follow the "real World OCaml" study.
OCaml Primer (2)