How to build MongooseIM
Instructions provided in this page are verified for:
- CentOS 7
- Ubuntu 16.04 LTS (Xenial)
- Ubuntu 18.04 LTS (Bionic)
- macOS 13.3 (Ventura)
For any other OS versions, the instructions should still work, however, some steps or file paths may be different.
Requirements
To compile MongooseIM you need:
- Make:
make
, - C and C++ compiler:
gcc
,gcc-c++
, - Erlang/OTP 24.0 or higher:
erlang
package, or,esl-erlang
from Erlang Solutions website, or,- install using kerl,
- OpenSSL 0.9.8 or higher, for STARTTLS, SASL and SSL encryption:
openssl
andopenssl-devel
, - ODBC library:
unixODBC-devel
, - Zlib 1.2.3 or higher:
zlib-devel
.
- Make:
make
, - C and C++ compiler:
gcc
,g++
, - Erlang/OTP 24.0 or higher:
erlang
package, or,esl-erlang
from Erlang Solutions website, or,- install using kerl,
- OpenSSL 0.9.8 or higher, for STARTTLS, SASL and SSL encryption:
olibssl-dev
, - ODBC library:
unixodbc-dev
, - Zlib 1.2.3 or higher:
zlib1g-dev
.
Preparing the environment
Please install the required dependencies:
1 |
|
Now, please proceed to the "Building" section.
Please install the required dependencies:
1 |
|
Now, please proceed to the "Building" section.
Step 1
Install Homebrew to manage packages on your Mac. You may use a different package manager but you'll need to figure out the package names and file paths on your own.
Step 2
Install Xcode Command Line Tools.
1 |
|
Step 3
Install dependencies with Brew.
1 |
|
Step 4
Add OpenSSL paths to the compiler and linker environment variables:
1 2 |
|
Now, please proceed to the "Building" section.
Building
To compile MongooseIM, navigate to the main repo directory (referenced as $REPO
in this guide) and execute:
1 |
|
rel
is optional as it is the default target.
This will download all dependencies, compile everything and build a prod
release.
If a more advanced release is required (with only specific DB support, e.g. mysql or pgsql) or you want to set the prefix
or user
for the installation script please refer to the release configuration page in our documentation.
The make rel
commands will generate a self-contained OTP system structure in the project's _build/prod/rel/mongooseim
subdirectory.
The contents of that directory are as follows:
bin
- startup/administration scripts,etc
- configuration files,lib
- MongooseIM binary, header and runtime files,var
- spool directory,log
- log file directory,releases
- release files directory.
Running MongooseIM
To run MongooseIM from the project tree after compiling it, change the directory to $REPO/_build/prod/rel/mongooseim
.
There you can use the mongooseim
command line administration script to start and stop MongooseIM.
For example, this command will start the server:
1 |
|
You can also run the server in interactive mode (drop into an Erlang shell):
1 |
|
There's also a tool called mongooseimctl
to perform some operations on a running instance, e.g.:
1 2 3 4 5 6 7 8 9 10 |
|
Building the testing target and running tests
For testing purposes there's a different make target available:
1 |
|
which will generate releases mim1
, mim2
, mim3
, fed1
, reg1
in $REPO/_build/
and prepare them for testing and generating coverage reports.
In order to learn how to execute tests, please consult Testing MongooseIM page.