文章目录
官方文档
http://mesos.apache.org/documentation/latest/building/
安装依赖
Ubuntu18.04
换源
junyu@junyu:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
junyu@junyu:~$ sudo apt update
junyu@junyu:~$ sudo gedit /etc/apt/sources.list
最前面粘贴
deb http://mirrors.aliyun.com/ubuntu/ bionic main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main multiverse restricted universe
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main multiverse restricted universe
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main multiverse restricted universe
然后更新源
junyu@junyu:~$ sudo apt update --fix-missing
junyu@junyu:~$ sudo apt -y upgrade
mesos依赖
# Update the packages.
$ sudo apt-get update
# Install a few utility tools.
$ sudo apt-get install -y tar wget git
# Install the latest OpenJDK.
$ sudo apt-get install -y openjdk-8-jdk
# Install autotools (Only necessary if building from git repository).
#$ sudo apt-get install -y autoconf libtool
# Install other Mesos dependencies.
$ sudo apt-get -y install build-essential python-dev python-six python-virtualenv libcurl4-nss-dev libsasl2-dev libsasl2-modules maven libapr1-dev libsvn-dev zlib1g-dev iputils-ping
设置JAVA_HOME(我没有设置)
root@junyu:/home/junyu/mesos/build# which javac
/usr/lib/jvm/java-8-openjdk-amd64/bin/javac
root@junyu:/home/junyu/mesos/build# gedit ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
export JRE_HOME=$JAVA_HOME/jre
root@junyu:/home/junyu/mesos/build# . ~/.bashrc
构建Mesos
下载Mesos
junyu@junyu:~$ wget http://www.apache.org/dist/mesos/1.7.2/mesos-1.7.2.tar.gz
junyu@junyu:~$ tar -xzf mesos-1.7.2.tar.gz
junyu@junyu:~$ rm mesos-1.7.2.tar.gz ; mv mesos-1.7.2 mesos
构建Mesos
需求:
硬盘至少30G,内存至少4G,如果使用虚拟机,构建时间很长,需要多分配几个CPU。
在Mesos目录中创建一个build目录,在编译过程中输出的文件将全部放入该目录中,在一次编译完成后,build中的输出文件可以直接在其他同类型OS上使用,无须再在其他节点重新编译。
使用make进行编译,make check构建实例Framework来验证编译环境,最后通过make install安装
# Change working directory.
$ cd mesos
# Bootstrap (Only required if building from git repository).
#$ ./bootstrap
# Configure and build.
$ mkdir build
$ cd build
$ ../configure
# In order to speed up the build and reduce verbosity of the logs, you can append -j <number of cores> V=0 to make.如make -j8,make -j8 check,make -j8 install代表8核
$ make
# Run test suite.
$ make check
# Install (Optional).
$ make install
启动Mesos
在启动Mesos之前,先建立Mesos工作目录,并授予权限:
junyu@junyu:~/mesos/build$ sudo mkdir -p /var