Install from Source Code

Dependencies

To compile and install EMQX from the source code, the following dependencies are needed:

  • Erlang/OTP OTP 24 or 25
  • GCC 4.8 or higher versions
  • Git
  • make
  • openssl-devel
  • libcurl-devel

You can use the Docker compilation environment EMQX BuilderInstall from Source code - 图1 (opens new window) to compile and install EMQX from source code.

With the following commands, you can create an EMQX Builder container, configure the port mapping (optional), and start the preview after the compilation is complete:

  1. docker run -d --name emqx-builder \
  2. # -p 1883:1883 \
  3. # -p 8083:8083 \
  4. # -p 8084:8084 \
  5. # -p 8883:8883 \
  6. # -p 18083:18083 \
  7. ghcr.io/emqx/emqx-builder/5.0-17:1.13.4-24.2.1-1-ubuntu20.04 \
  8. bash -c "tail -f /dev/null"

Compile and Start EMQX

The EMQX repository is located at https://github.com/emqx/emqxInstall from Source code - 图2 (opens new window), where the master branch is the latest EMQX 5.0 version, and the main-* branch corresponds to different minor versions (such as 4.4.x, 5.1. x).

To compile and run the latest version of EMQX, run:

  1. # docker exec -it emqx-builder bash
  2. git clone https://github.com/emqx/emqx.git
  3. cd emqx
  4. make
  5. _build/emqx/rel/emqx/bin/emqx console