从源代码在 Debian 9 Stretch Linux 上安装 Ansible
客观的
以下指南介绍了如何安装最新版本的开源自动化引擎 Ansible 的简单易行的步骤。
操作系统和软件版本
操作系统: – Debian Stretch 9
要求
需要对 Debian Linux 系统进行特权访问。
困难
简单的
惯例
# – 要求以root权限直接以root用户身份或使用
sudo
命令执行给定的linux命令$ – 要求以常规非特权用户身份执行给定的 Linux 命令
指示
先决条件
首先,我们需要安装所需的先决条件。执行以下 linux 命令来执行所有先决条件的安装:
# apt update
# apt install make git make python-setuptools gcc python-dev libffi-dev libssl-dev python-packaging
下载 Ansible 源代码
使用 git 命令下载 Ansible 源代码:
$ git clone git://github.com/ansible/ansible.git
导航到 ansible
目录:
$ cd ansible
选择 Ansible 版本
此步骤是可选的,因为它只允许您选择要在系统上安装的所需 Ansible 版本。以下 linux 命令将列出所有可用的 Ansible 稳定版本:
$ git branch -a | grep stable
remotes/origin/stable-1.9
remotes/origin/stable-2.0
remotes/origin/stable-2.0-network
remotes/origin/stable-2.0.0.1
remotes/origin/stable-2.1
remotes/origin/stable-2.2
remotes/origin/stable-2.3
记下您所需的版本并执行 git checkout 。例如要设置 Ansible 版本 stable-2.2
运行:
$ git checkout stable-2.2
Ansible安装
剩下的就是执行编译和 Ansible 安装:
$ make
# make install
确认 Ansible 安装
通过检索 Ansible 版本来测试 Ansible 安装:
$ ansible --version
ansible 2.2.2.0
config file =
configured module search path = Default w/o overrides