In this recipe, we will download the Mesos source files, build the code, and install the Mesos binaries and libraries.
Follow the previous sections in this chapter to prepare your operating system for a Mesos source installation.
- Browse to the following location: http://mesos.apache.org/downloads/.
- Download the TAR file for the most recent stable release of Mesos. For example, to download Mesos version 1.0.1:
$ wget http://www.apache.org/dist/mesos/1.0.1/mesos-1.0.1.tar.gz
- Extract the contents of the TAR file. For example, to extract the Mesos 1.0.1 TAR file:
$ tar xvzf mesos-1.0.1.tar.gz
- Change the directory to the extracted TAR file directory created in the previous step, for example:
$ cd mesos-1.0.1
- Create the
build
directory:
$ mkdir build
- Change directory to the
build
directory:
$ cd build
- Configure the Mesos build script. You can
run ../configure --help
to see all the available configuration options. Refer to the There's more... section at the end of this recipe for more configuration tips:
$ ../configure
- Build the Mesos binaries (executing
'make -j <number of cores> V=0
will decrease both the build time and log verbosity on multicore systems). Refer to the There's more... section at the end of this recipe for more build tips:
$ make
- Optional: Run some tests:
$ make check
- Optional: Execute the
make install
command if you would like to install the Mesos binaries and libraries in/usr/local/
and add them to the system path. Mesos can also be installed in other locations or run directly from the build directory. Refer to the There's more... section at the end of this recipe for instructions on installing Mesos to alternative locations, as well as for other installation tips:
$ sudo make install
- Optional: For Ubuntu only, create links to the Mesos libraries if you chose the default installation to
/usr/local
:
$ sudo ldconfig
- At this point, you can start Mesos to do some basic testing. To start the Mesos master and agent daemons, first create the
mesos
working directory:
$ sudo mkdir /var/lib/mesos
- Change into the Mesos source
build
directory:
$ cd build
- Now start the Mesos master:
$ sudo ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos
- And start the Mesos agent (in a separate terminal session):
$ sudo ./bin/mesos-agent.sh --master=127.0.0.1:5050 --work_dir=/var/lib/mesos
- To validate the Mesos installation, open a browser on the Mesos host and point it to
http://127.0.0.1:5050
. If you wish to validate with a browser remotely, you will need to replace 127.0.0.1 with the real IP of the Mesos host in the previous commands and restart both the master and agent. You will also need to use the real IP of the Mesos host in the browser.
Building the Mesos source code will create the binaries needed to run Mesos. Next, you will configure ZooKeeper, which is covered in Chapter 2, Implementing High Availability with Apache ZooKeeper.
Refer to the following tips.
There are a number of options that can be configured in the Mesos build script. For example, if you want to build Mesos with SSL support, you will need to enable the ssl
and libevent
features by executing ../configure --enable-ssl --enable-libevent
prior to executing make
. To see a full list of the configure options, execute ../configure --help
from the Mesos build
directory.
If you are building out a Mesos cluster using hosts with the same operating system version, you can configure and build the source code on one server and then copy that source directory to the other servers. You can then skip the ../configure
and make
commands and just run Mesos from the build
directory or execute make install to install it without having to go through the build (make
) process on every server.
If you do plan on copying pre-built Mesos software to other servers, make sure all of the servers have the supporting packages required to run Mesos and that the OS is patched to the same version.
The default behavior of make install
is to install the Mesos binaries and libraries in the /usr/local
path. If you would like to change the installation path, execute ../configure --prefix=/path/to/install/directory
during the configure stage prior to the build (make
) and install (make install
) stages.
If at some point you would like to uninstall the Mesos binaries from the installation path, you can execute make uninstall
from the source code build
directory. After building and installing the Mesos source code, we recommend archiving the source code directory for future reference.