201806-05 mesos安装--软件源安装

对http://mesos.apache.org/documentation/latest/building/的实操。

下载的mesos包中的执行文件都为.sh.in文件且无执行权限,所以都要进行软件源安装。


一、Downloading Mesos
There are different ways you can get Mesos:


方法1. Download the latest stable release from Apache (Recommended)
$ wget http://www.apache.org/dist/mesos/1.6.0/mesos-1.6.0.tar.gz
$ tar -zxf mesos-1.6.0.tar.gz


方法2. Clone the Mesos git repository (Advanced Users Only)。在当前目录下生成一个mesos文件
$ git clone https://git-wip-us.apache.org/repos/asf/mesos.git


NOTE: If you have problems running the above commands, you may need to first run through the System Requirements section below to install the wget, tar, and git utilities for your system.

二、System Requirements
Mesos runs on Linux (64 Bit) and Mac OS X (64 Bit). To build Mesos from source, GCC 4.8.1+ or Clang 3.5+ is required.
On Linux, a kernel version >= 2.6.28 is required at both build time and run time. For full support of process isolation under Linux a recent kernel >= 3.10 is required.
The Mesos agent also runs on Windows. To build Mesos from source, follow the instructions in the Windows section.
Make sure your hostname is resolvable via DNS or via /etc/hosts to allow full support of Docker’s host-networking capabilities, needed for some of the Mesos tests. When in doubt, please validate that /etc/hosts contains your hostname.


CentOS 7.1
Following are the instructions for stock CentOS 7.1. If you are using a different OS, please install the packages accordingly.

# Install a few utility tools。安装且更新到最新
# $ sudo yum install -y tar wget git

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

# Install the EPEL repo so that we can pull in 'libserf-1' as part of our subversion install below。更新epel-release-7-11.noarch
$ sudo yum install -y epel-release

# '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:。默认库不可用,SVN安装需要自定义repo库
$ sudo bash -c 'cat > /etc/yum.repos.d/wandisco-svn.repo <<EOF
[WANdiscoSVN]
name=WANdisco SVN Repo 1.9
enabled=1
baseurl=http://opensource.wandisco.com/centos/7/svn-1.9/RPMS/\$basearch/
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
EOF'

# Parts of Mesos require systemd in order to operate. However, Mesos only supports versions of systemd that contain the 'Delegate' flag. This flag was first introduced in 'systemd version 218', which is lower than the default version installed by centos. Luckily, centos 7.1 has a patched 'systemd < 218' that contains the 'Delegate' flag. Explicity update systemd to this patched version.。centos小于7.1版本时需要安装systemd命令。
$ sudo yum update systemd

# Install essential development tools.。安装更新软件群组"Development Tools"。
$ sudo yum groupinstall -y "Development Tools"
实操警告:分组 development 不包含任何可安装软件包。

# Install other Mesos dependencies.。安装更新Mesos的其他依赖
$ sudo yum install -y apache-maven python-devel python-six python-virtualenv java-1.8.0-openjdk-devel zlib-devel libcurl-devel openssl-devel cyrus-sasl-devel cyrus-sasl-md5 apr-devel subversion-devel apr-util-devel
报错:Error downloading packages:
  subversion-devel-1.9.7-1.x86_64: [Errno 256] No more mirrors to try.
  subversion-1.9.7-1.x86_64: [Errno 256] No more mirrors to try.
解决办法:分开下载:
sudo yum install -y apache-maven
sudo yum install -y python-devel
sudo yum install -y python-six
sudo yum install -y python-virtualenv
sudo yum install -y java-1.8.0-openjdk-devel
sudo yum install -y zlib-devel
sudo yum install -y libcurl-devel
sudo yum install -y openssl-devel
sudo yum install -y cyrus-sasl-devel
sudo yum install -y cyrus-sasl-md5
sudo yum install -y apr-devel
sudo yum install -y subversion-devel
sudo yum install -y apr-util-devel

三、Building Mesos (Posix)
# Change working directory.
$ cd mesos

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

# Configure and build.
$ mkdir build
$ cd build
$ ../configure
执行时报错:configure: error: cannot find libapr-1 headers
原因是缺少apr-devel-1.3.9-3.el6.x86_64
需要下载相应的rpm,并安装:
rpm -ihv apr-1.3.9-3.el6.x86_64.rpm
rpm -ihv apr-devel-1.3.9-3.el6.x86_64.rpm
rpm -ihv  apr-util-1.3.9-3.el6.x86_64.rpm
$ make
报错:
Building mesos-1.7.0.jar ...
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-remote-resources-plugin:1.3:process (default) on project mesos: Execution default of goal org.apache.maven.plugins:maven-remote-resources-plugin:1.3:process failed: Plugin org.apache.maven.plugins:maven-remote-resources-plugin:1.3 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-remote-resources-plugin:jar:1.3 -> org.apache.maven.shared:maven-filtering:jar:1.0 -> org.codehaus.plexus:plexus-interpolation:jar:1.12: Failed to read artifact descriptor for org.codehaus.plexus:plexus-interpolation:jar:1.12: Could not transfer artifact org.codehaus.plexus:plexus-interpolation:pom:1.12 from/to central (https://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.maven.apache.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
make[1]: *** [java/target/mesos-1.7.0.jar] 错误 1
make[1]: 离开目录“/home/weis/mesos/build/src”
make: *** [all-recursive] 错误 1
整理:[ERROR] Failed to execute goal org.apache.maven.plugins:
maven-remote-resources-plugin:1.3:
process (default) on project mesos:
Execution default of goal org.apache.maven.plugins:
maven-remote-resources-plugin:
1.3:process failed:
Plugin org.apache.maven.plugins:
maven-remote-resources-plugin:
1.3 or one of its dependencies could not be resolved:
Failed to collect dependencies at org.apache.maven.plugins:
maven-remote-resources-plugin:
jar:1.3 -> org.apache.maven.shared:
maven-filtering:
jar:1.0 -> org.codehaus.plexus:
plexus-interpolation:
jar:1.12: Failed to read artifact descriptor for org.codehaus.plexus:
plexus-interpolation:
jar:1.12: Could not transfer artifact org.codehaus.plexus:
plexus-interpolation:
pom:
1.12 from/to central (https://repo.maven.apache.org/maven2):
repo.maven.apache.org:
Unknown host repo.maven.apache.org ->
[Help 1]
未能执行目标org.apache.maven插件
解决办法:保持网络连接
报错二:存储空间不足。解决办法:需要10G的空间来运行

In order to speed up the build and reduce verbosity of the logs, you can append -j <number of cores> V=0 to make.
# Run test suite.上述make命名成功后,执行以下两条命令
$ make check


# Install (Optional).
$ make install

四、Examples
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.

# Change into build directory.
$ pwd
/home/weis/mesos/build

# Start Mesos master (ensure work directory exists and has proper permissions).。保持窗口打开,就可以访问了
$ sudo ./bin/mesos-master.sh --ip=127.0.0.1 --work_dir=/var/lib/mesos
报错:EXIT with status 1: Failed to initialize systemd: Failed to create systemd slice 'mesos_executors.slice': Failed to write systemd slice `/run/systemd/system/mesos_executors.slice`: Permission denied
原因:当前帐号无/run目录的写权限。
解决办法:sudo命令下执行。

# Start Mesos agent (ensure work directory exists and has proper permissions).
$ ./bin/mesos-agent.sh --master=127.0.0.1:5050 --work_dir=/var/lib/mesos

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

# Run C++ framework (exits after successfully running some tasks).运行C++框架(成功运行某些任务后退出)。找不到此文件
$ ./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
报错:Failed to find /home/weis/mesos/build/src/examples.jar

# Run Python framework (exits after successfully running some tasks).
$ ./src/examples/python/test-framework 127.0.0.1:5050
报错:Failed to find /home/weis/mesos/build/src/examples.jar

Note: These examples assume you are running Mesos on your local machine. Following them will not allow you to access the Mesos web page in a production environment (e.g. on AWS). For that you will need to specify the actual IP of your host when launching the Mesos master and ensure your firewall settings allow access to port 5050 from the outside world.


猜你喜欢

转载自www.cnblogs.com/shoubituling/p/9139426.html