Mesos Installation on CentOS 6.4 (Linux 2.6.32-431)

This article is base on Mesos' Getting Started, and Setting up a Mesos and Marathon Cluster , and, revised for CentOS 6.4 environment.

Yum

  1. Add the mesosphere repo

    $ rpm -Uvh http://repos.mesosphere.com/el/6/noarch/RPMS/mesosphere-el-repo-6-2.noarch.rpm
    
  2. Install

    $ yum -y install mesos
    
  3. That's all.

Also you can install marathon and chronos by:

yum -y install marathon chronos

Build From Source

Preparation

Download Mesos

$ wget http://www.apache.org/dist/mesos/0.27.0/mesos-0.27.0.tar.gz
$ tar xzvf mesos-0.27.0.tar.gz

Check kernel version

$ uname -r
2.6.32-431.el6.x86_64

For reasons we can not upgrade the kernel, so just use it.

Install dependencies

# Install Utils
$ yum install -y nss git

# Install C++11
$ wget -O /etc/yum.repos.d/slc6-devtoolset.repo http://linuxsoft.cern.ch/cern/devtoolset/slc6-devtoolset.repo

# Import the CERN GPG key.
$ rpm --import http://linuxsoft.cern.ch/cern/centos/7/os/x86_64/RPM-GPG-KEY-CentOS-7

# Fetch the Apache Maven repo file.
$ wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo

# 'Mesos > 0.21.0' requires 'subversion > 1.8' devel package, which is
# not available in the default repositories.
# Create a WANdisco SVN repo file to install the correct version:
$ cat > /etc/yum.repos.d/wandisco-svn.repo <<EOF
[WANdiscoSVN]
name=WANdisco SVN Repo 1.8
enabled=1
baseurl=http://opensource.wandisco.com/centos/6/svn-1.8/RPMS/$basearch/
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
EOF

# Install essential development tools.
$ yum groupinstall -y "Development Tools"
# If failed, use belows instead:
$ yum install -y bison byacc cscope ctags cvs diffstat doxygen flex gcc gcc-c++ gcc-gfortran gettext git indent intltool libtool patch patchutils rcs redhat-rpm-config rpm-build subversion-devel swig systemtap

# Install 'devtoolset-2-toolchain' which includes GCC 4.8.2 and related packages.
$ yum install -y devtoolset-2-toolchain
# If gpg fail, change first `gpgcheck=1` to `gpgcheck=0` in /etc/yum.repos.d/slc6-devtoolset.repo

# Install other Mesos dependencies.
$ yum install -y apache-maven python-devel java-1.7.0-openjdk-devel zlib-devel libcurl-devel openssl-devel cyrus-sasl-devel cyrus-sasl-md5 apr-devel subversion-devel apr-util-devel

# Enter a shell with 'devtoolset-2' enabled.
$ scl enable devtoolset-2 bash
$ g++ --version  # Make sure you've got GCC > 4.8!

# Process isolation is using cgroups that are managed by 'cgconfig'.
# The default configuration does not attach the 'perf_event' subsystem.
# To do this, add 'perf_event = /cgroup/perf_event;' to the entries in '/etc/cgconfig.conf'.
$ yum install -y libcgroup
$ service cgconfig start

Build Mesos

# Change working directory.
$ cd mesos

# Bootstrap (Only required if building from git repository).
$ ./bootstrap

# Configure and build.
$ mkdir build
$ cd build
$ ../configure
$ make

# If you are behind got apache download failure, 

If need proxy to connect internet, put belows into your maven setting at $HOME/.m2/settings.xml before you do make:

<settings>
  <!-- Your other settings-->
  <proxies>
   <proxy>
      <id>example-proxy</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.example.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
    </proxy>
  </proxies>
  <!-- Your other settings-->
</settings>

Sit down and have cafe, it takes about half a hour on my virtual machines.

Check building and install

# Run test suite.
$ make check

# Install (Optional).
$ make install

Run Mesos

Run Standalone

# Start mesos master (Ensure work directory exists and has proper permissions).
$ ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos

# Start mesos slave.
$ ./bin/mesos-slave.sh --master=127.0.0.1:5050

# Visit the mesos web page.
$ http://127.0.0.1:5050

Run example frameworks

Mesos comes bundled with example frameworks written in C++, Java and Python. The framework binaries will only be available after running make check, as described in the Building Mesos section above.


# Run C++ framework (Exits after successfully running some tasks.).
$ ./src/test-framework --master=127.0.0.1:5050

# Run Java framework (Exits after successfully running some tasks.).
$ ./src/examples/java/test-framework 127.0.0.1:5050

# Run Python framework (Exits after successfully running some tasks.).
$ ./src/examples/python/test-framework 127.0.0.1:5050