Friday, November 12, 2021

[SOLVED] Unable to install Ansible

Issue

I installed VM in Oracle VM VirtualBox manager and mounted /dev/sr0 and configured system.repo under /etc/yum.repos.d as below.

 [SYSTEM]
    name=rhel6
    baseurl=file:///mnt
    gpgcheck=0
    enabled=1

and downloaded epel-release-latest-6.noarch.rpm from one of Fedora site to install Ansible.

But yum command is not working and getting error as "Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again"

I did a few changes in epel repo file like replaced https as http for mirr orlist option but after that when I run any yum command it gives below message.

Existing lock /var/run/yum.pid: another copy is running as pid 2448. Another app is currently holding the yum lock; waiting for it to exit...

and when I kill the yum id and run again any yum command it gives an output as yum command killed.


Solution

Ideally, from your virtualBox, do yum search epel, and then yum install epel-release.

If epel is not available from yum, in your case, do:

rpm -ivh epel-release-latest-6.noarch.rpm

The above one of the steps will make the EPEL repo installed properly.

The repo's name will be epel.repo, like this:

/etc/yum.repos.d/epel.repo
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch

You will probably need to restart the yum service by:

service yum restart

find the package first by:

yum search ansible

and then yum install ansible

Your baseurl is /mnt, I doubt there is anything in it, it should be either a local repo or some real site for yum search rpm package.



Answered By - Gang