Как установить opam ubuntu

Обновлено: 05.07.2024

The latest version of OCaml is 4.13.1. For more information about this release, see the 4.13.1 page.

The OCaml compiler and libraries can be installed in several ways:

  • With OPAM, the OCaml package manager (recommended).
  • With a system package manager supported by your platform (Linux, macOS, FreeBSD, OpenBSD, NetBSD, Windows)
  • In your browser.
  • On your mobile device.
  • By compiling the source.

For finding and installing OCaml libraries, see the libraries page. Information about the different versions of OCaml is available on the releases page.

OPAM is the package manager for OCaml. It is the recommended way to install the OCaml compiler and OCaml packages. Simply follow the OPAM install instructions.

Then, use opam to install an ocaml compiler. Example using the Bash shell and opam-2.0:

Linux

Most Linux distributions allow OCaml and/or OPAM to be installed directly through the system package manager.

Debian

Other Debian packages related to OCaml are listed here. They are made available through The Debian OCaml Taskforce.

Ubuntu

Other Ubuntu packages related to OCaml are listed here.

Fedora

OCaml packages are packaged according to this policy. There is an OCaml Special Interest Group and a mailing list for people interested in OCaml on Fedora or Red Hat Enterprise Linux.

Centos / Red Hat Enterprise Linux

Gentoo

With a user that is a member of the portage group do:

Mageia

Arch Linux

Other Arch Linux packages related to OCaml are listed here.

macOS

On macOS OCaml and/or OPAM can be installed via the existing third-party package systems.

Homebrew

MacPorts

FreeBSD

OpenBSD

NetBSD

Windows

Under Windows, the following direct solutions are available to use OCaml:

    provides an experimental OPAM repository and opam build for Windows.

Here are a few other alternatives:

The OCaml source distribution directly supports many different Windows ports. You will have to compile from source. See the README.win32 file included in the distribution for details.

Cygwin-based port. Requires Cygwin, you can install them using the setup tool. The compilers generate executables that do require Cygwin ( cygwin1.dll ).

Mobile

    provides an editor and an interactive toplevel for iOS, iPadOS and macOS, with a growing learn section.

Browser

The following pages allow to directly try snippets of OCaml in your browser:

    by OCamlPRO.
  • An OCaml toplevel compiled by the js_of_ocaml project. has OCaml toplevels with interactive notebook functionality.

From Source

Download an OCaml release or the development version and follow the instructions included therein.

Available versions

Here is the list of available versions across different Linux and UNIX distributions:

This page describes how to install and configure opam and external solvers. For further help on how to use opam, either read opam --help or move on to the Usage guide.

Upgrading from a previous version

Generally, you should just reproduce the same installation steps as for the original installation: upgrade from your system's package manager, or re-run the binary installer. Opam will automatically update its internal repository at

/.opam on first run if needed (backup that if you may want to rollback the upgrade without starting over).

Binary distribution

The quickest way to get the latest opam up and working is to run:

This will simply check your architecture, download and install the proper pre-compiled binary and run opam init .

We provide pre-compiled binaries for:

  • Linux i686, amd64 and arm7
  • OSX (intel 64 bits) (other platforms are available using the other methods below)

You can pick your download here, and simply put it in your PATH as opam , e.g.

Using your distribution's package system

This is generally the recommended way, when available and up-to-date. Here is a list of supported distributions:

Archlinux

The opam and opam-git packages are available in the AUR. Replace opam with opam-git in the following instruction to get the development version:

Debian

Binary packages of opam are available for the stable (a bit outdated), testing and unstable distributions, from the official repositories. You should be set with:

There are also unofficial packages from the OpenSUSE Build Service, for the latest version, when not yet in the Debian repositories:

Exherbo

The dev-ocaml/opam package can be installed with the command:

You might need to add the ::ocaml-unofficial repository first:

Fedora, CentOS and RHEL

RPMs for Fedora, CentOS and Red Hat Enterprise Linux are available with instructions on the OpenSUSE Build Server.

Mageia

The opam package for Mageia can be installed with the command:

OpenBSD

Opam builds via sources fine on OpenBSD 5.6 or earlier, and is available in the ports and packages tree on OpenBSD 5.7 or higher.

Note that the aspcud external solver is not yet available on OpenBSD, so you may see some odd upgrade attempts due to the use of the internal solver.

Opam packages for homebrew and MacPorts are available:

See also howto setup Emacs.app for Opam usage.

Ubuntu

Warning: although there is an opam package available officially in "Utopic" (14.10), it's currently broken. Don't use it, see the bug report. The Ubuntu "Vivid" (15.04) package is fine.

We provide binary packages for "Precise" and "Trusty"

There are also PPAs available that are pinned to specific revisions of OCaml and opam -- we use them for our automated testing.

If the command add-apt-repository is not available, you can install the package software-properties-common with apt-get install software-properties-common . Alternatively, you may manually edit the file /etc/apt/sources.list to add the PPA for your Ubuntu release.

From Sources

Getting the Sources

Sources of the latest stable version of opam are available on Github:

You can also download the full archives, including opam dependencies (these don't require any extra downloads, just the OCaml compiler -- 3.12.1 or later):

    MD5: 7d348c2898795e9f325fb80eaaf5eae8 SHA1: 415ff0506378ab8dfa428fcd0aff3aa28337d93b MD5: 04e8823a099ab631943952e4c2ab18fc SHA1: 189e309ee0659723abaaad5f887f5caf89b34422 MD5 (opam-full-1.2.0.tar.gz) = 17cc252c6c80fc503c4878eac8d123e7 MD5 (opam-full-1.1.2.tar.gz) = ba2a4136b65003c04d905de786f3c3ab MD5 (opam-full-1.1.1.tar.gz) = a7bebe947b3e6c1c10ccafabb839d374 MD5 (opam-full-1.1.0.tar.gz) = d6e2f56b10c0be73b5677963e6659d24

Follow the instructions in the included README.md to get opam built and installed from there.

Using ocamlbrew

ocamlbrew is a script that can bootstrap an OCaml environment including opam, from source. This option does not require an existing OCaml installation, or a pre-compiled opam binary for your platform. To bootstrap a new OCaml environment including opam, make sure that you have the necessary pre-requisites installed to run ocamlbrew, and then run:

Resolving package installations in the presence of dependencies and conflicts is known to be an NP-complete problem. Thankfully, a big effort has already been put into solving it very efficiently: opam relies on this effort and delegates the solving process to external solvers. opam integrates a simple solver, so it can used without any extra dependencies, but for best results you should have one of those solvers on your system:

    (recommended) (no built-in support at the moment, but may be used with the following solver configuration string: mccs -i %% -o %% -lexagregate[%%] .) , which may be the easiest if dependencies are a problem, as it comes as a single jar file. Dowload it and set the solver configuration string to java -jar <jarfile-location> -obj %% %% %% .

We recommend installing one through your packaging system whenever possible: this should already have been taken care of if you installed opam through your packaging system. If you have trouble installing an external solver and have reliable network connectivity, Irill kindly provides a "Solver farm" which can be used as a remote solver by opam.

If you use the internal solver only, the following symptoms may be sign that you need an external solver: very bad upgrade proposals, or dependency solving becoming very slow.

Opam will detect the availability of aspcud or packup commands on your system and should switch to using them directly. You can explicitly specify which external solver to use by using the --solver command-line argument, the $OPAMEXTERNALSOLVER environment variable, or the solver: field in the

External solvers also allow to specify fine-grained preferences. aspcud is currently recommended because it supports a richer language of solver preferences giving opam more control over the requested solution.

This page describes how to install and configure OPAM. For further help on how to use OPAM, either read opam --help or move on to the Basic Usage guide.

Installing OPAM with your distribution

You can use the OPAM package of your distribution if available. Here is a list of supported distributions:

Archlinux

The opam and opam-git packages are available in the AUR. Replace opam with opam-git in the following instruction to get the development version:

Debian

Binary packages of OPAM 1.1.1 are available for the testing and unstable distributions. Wheezy users are left with the options of compiling from source, pinning the packages from the testing repository, requesting a backport from Debian, or using our binary installer below.

Exherbo

Simply install the dev-ocaml/opam package: cave resolve -x dev-opam/ocaml .
You might need to add the ::ocaml-unofficial repository first: cave resolve -x repository/ocaml-unofficial .

Mageia

The opam package for Mageia can be installed with the command:

OPAM packages for homebrew and MacPorts are available:

See also howto setup Emacs.app for opam usage.

Ubuntu (Precise, Quantal, Raring and Saucy)

There are also PPAs available that are pinned to specific revisions of OCaml and OPAM to help with automated testing.

If the command add-apt-repository is not available, you can install the package python-software-properties with apt-get install python-software-properties . Alternatively, you may manually edit the file /etc/apt/sources.list to add the PPA for your Ubuntu release.

Ubuntu Trusty LTS

OCaml 4.01.0 and OPAM 1.1.1 are included in Ubuntu Trusty's universe repository, so just install them as normal.

Guix and Guix System

The opam package for guix can be installed with the command:

Binary installer

Pre-compiled versions for most common architectures and OSes are available on the Github "releases" page. We also provide a very simple installer script that will automatically download the right version for you, put it in your binary directory and initialize it.

You can also specify which version of OCaml you want to install:

From Sources

Getting the Sources

Sources of the latest stable version of OPAM are available on Github. You can also download the full archives, including OPAM dependencies:

    MD5 (opam-full-1.1.1.tar.gz) = a7bebe947b3e6c1c10ccafabb839d374 MD5 (opam-full-1.1.0.tar.gz) = d6e2f56b10c0be73b5677963e6659d24

Once the archive downloaded and extracted, you can then run the usual commands:

See Advanced Install guide for more information.

Using ocamlbrew

ocamlbrew is a script that can bootstrap an OCaml environment including OPAM, from source. This option does not require an existing OCaml installation, or a pre-compiled OPAM binary for your platform. To bootstrap a new OCaml environment including OPAM, make sure that you have the necessary pre-requisites installed to run ocamlbrew, and then run:

In this tutorial you will learn how to update and install opam On Ubuntu 16.04 Lts? Learn how to uninstall and completely remove the package opam from Ubuntu 16.04 LTS Operating System.

Quick installation of opam:

Step 1: Update system:

Step 2: Install: opam

Ater updaing the OS run following command to install the packae:

How to install opam on Ubuntu 16.04?

How to install opam On Ubuntu 16.04 Lts? Uninstall and remove opam Package

First of all update your system with the command:

Above command will download the package lists for Ubuntu 16.04 on your system. This will update the list of newest versions of packages and its dependencies on your system.

After downloading the latest package list with the help of above you can run the installation process.

If opam is not installed on your compter then the command 'dpkg -L opam' will give followin error.

After system update use the following command to install opam:

Above command will confirm before installing the package on your Ubuntu 16.04 Operating System. If you are not already logged in as su, installer will ask you the root password. After completion of the installation you can use the package on your system.

How to uninstall/remove opam from Ubuntu 16.04?

Now we will see the commands for uninstalling the opam from Ubuntu 16.04. For uninstalling this package you can easily use the apt command and remove the package from Linux Operating System.

To remove the opam following command is used:

Following command is used to remove the opam package along with its dependencies:

This will remove opam and all its dependent packages which is no longer needed in the system.

Completely removing opam with all configuration files:

Following command should be used with care as it deletes all the configuration files and data:

or you can use following command also:

Читайте также: