# dcos所需要的RPM包

在dcos的安装过程中，有三个软件是使用rpm包进行安装的

* `docker-engine-1.12.6-1.el7.centos.x86_64.rpm`
* `docker-engine-selinux-1.12.6-1.el7.centos.noarch.rpm`
* `keepalived-1.2.13-7.el7.x86_64.rpm`

所以，我们要找出这三个rpm包所依赖的rpm包。

## 如何找依赖包及循环依赖包？

我们可以使用命令`rpm -qpR ./xxxx.rpm`来查看某个rpm包依赖的包，把依赖包下载下来后，我们继续找到依赖包的依赖包，如此循环，直到把所有的包都找下来。

但是，我们并不这么做，第一是centos已经自带了其中的一些包，第二是我们下载下来后，也需要用一个新装的系统来验证。

**所以，我们的方法是：首先A主机可以使用外网yum源，且已经安装好上面的软件。然后新建一个全新的centos虚拟机B（注意一定要全新），B不可以连外网的yum源。然后在A上搭建一个yum源，一开始只把上面的三个rpm包放进去。然后在B上配置使用A的yum源。**

## 步骤

### 1、在A上配置好外部的基础yum源

参考`https://pshizhsysu.gitbooks.io/linux/yum/ji-chu-yum-yuan-de-pei-zhi.html`

### 2、在A上安装docker-engine、docker-engine-selinux、keepalived

```
$ yum -y install ./docker-engine-selinux-1.12.6-1.el7.centos.noarch.rpm
$ yum -y install ./docker-engine-1.12.6-1.el7.centos.x86_64.rpm
$ yum -y install ./keepalived-1.2.13-7.el7.x86_64.rpm
```

### 3、在A上制作一个yum源

在A上制作一个yum源，只把上面的三个rpm包放进去，然后在B上清空`/etc/yum.repos.d/`目录下的所有文件，然后使用A的yum源。

参考`https://pshizhsysu.gitbooks.io/installation-on-linux/yumyuan.html`

### 4、在B上安装docker与keepalived，找到依赖包与依赖库文件

当在B上安装`docker-engine`时，就会提示缺哪些包和so文件，如下：

```
$ yum -y install docker-engine
...
--> Finished Dependency Resolution
Error: Package: docker-engine-1.12.6-1.el7.centos.x86_64 (local)
           Requires: libcgroup
Error: Package: docker-engine-selinux-1.12.6-1.el7.centos.noarch (local)
           Requires: policycoreutils-python
Error: Package: docker-engine-1.12.6-1.el7.centos.x86_64 (local)
           Requires: libltdl.so.7()(64bit)
...
```

* 依赖的rpm包

如上提示，安装`docker-engine-1.12.6-1.el7.centos.x86_64`缺少依赖包`libcgroup`和`policycoreutils-python`，以及缺少依赖库文件`libltdl.so.7`。

然后我们在A上查看`libcgroup`与`policycoreutils-python`所安装的版本，以及所在的repo（base、updates、extras）

```
$ yum list installed | grep libcgroup
libcgroup.x86_64                      0.41-20.el7                    @base
```

我们可以看到，A上安装了`0.41-20`版本的`libcgroup`，这个包属于`base`仓库。于是我们去到base仓库下载（这里我们去中科大的yum镜像源），用浏览器打开链接`https://mirrors.ustc.edu.cn/centos/7/os/x86_64/Packages/`，然后搜索`libcgroup`，会发现如下的几个包

![](/files/-MA1FZ_L3musk4uCztlo)

下载目标包，然后放到A的yum源上，更新yum源（参考A中的链接）。

以同样的方式，找到并下载`policycoreutils-python`包，并放到A的yum源上。

* 依赖的库文件

上面我们找到了依赖的rpm包`libcgroup`和`policycoreutils-python`，但是除了这两个包以外，`docker-engine`还依赖了库文件`libltdl.so.7()(64bit)`，这个库文件是属于哪个rpm包的呢？

我们去到A主机上，去到`/usr/lib64/`目录下（因为这里提示该库文件为64bit），执行以下的命令找到该库文件所属的rpm包：

```
$ rpm -qf libltdl.so.7
libtool-ltdl-2.4.2-22.el7_3.x86_64
```

从输出可以看到，`libltdl.so.7`这个库文件属于`libtool-ltdl-2.4.2-22.el7_3.x86_64`这个rpm包。于是，我们去下载这个rpm包放到A上的yum源中，然后再继续在B上安装`docker-engine`，直到找出这些依赖包的依赖包。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pshizhsysu.gitbook.io/dcos/dcossuo-xu-yao-de-rpm-bao.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
