安装 vim8
epel角色任务:
---
- name: Install epel-release
yum: name=epel-release state=latest
become: yes
vim 角色任务:
---
- name: Install vim
yum: disablerepo=* enablerepo=epel update_cache=yes name=vim state=latest
become: yes
错误:
fatal: [DevBox]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'vim' found available, installed or updated", "rc": 126, "results": ["No package matching 'vim' found available, installed or updated"]}
进一步的研究表明 epel 不包含 vim8:
yum list | grep vim
vim-minimal.x86_64 2:7.4.160-1.el7 @anaconda
beakerlib-vim-syntax.noarch 1.15-1.el7 epel
fluxbox-vim-syntax.noarch 1.3.7-1.el7 epel
golang-vim.noarch 1.3.3-2.el7_0 extras
protobuf-vim.x86_64 2.5.0-8.el7 base
vim-X11.x86_64 2:7.4.160-1.el7_3.1 updates
vim-clustershell.noarch 1.7.3-1.el7 epel
vim-common.x86_64 2:7.4.160-1.el7_3.1 updates
vim-enhanced.x86_64 2:7.4.160-1.el7_3.1 updates
vim-filesystem.x86_64 2:7.4.160-1.el7_3.1 updates
vim-go.x86_64 1.8-3.el7 epel
vim-gtk-syntax.noarch 20130716-1.el7 epel
vim-minimal.x86_64 2:7.4.160-1.el7_3.1 updates
vim-vimoutliner.noarch 0.3.7-5.el7 epel
答案1
vim
EPEL 或基础仓库中没有软件包。
基础 repo 包括vim-minimal
(或者vim-enhanced
甚至vim-x11
)。
答案2
http://www.karan.org/blog/2016/11/05/vim-8-for-centos-linux-7/为此提供了一个 repo。您需要先添加 repo,如下所示:
- name: Add repository
yum_repository:
name: epel
description: EPEL YUM repo
baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/
然后您就可以安装该包。
答案3
直接从 repo 构建 vim8:
---
- name: Install libraries needed to make vim
yum: name={{ item }} state=latest
with_items:
- gcc
- ncurses-devel
become: yes
- name: Clone vim
git: repo=git://github.com/vim/vim.git
dest=/tmp/vim
version=v8.0.0586
- name: Make vim
shell: "{{ item }}"
args:
chdir: /tmp/vim/src
with_items:
- make
- make install
become: yes