AD-HOC command for installing a package in ubuntu

2.1k Views Asked by At

Whenever I tried to install the package in ubuntu but it's throwing an error like below following code

But if I tried to ping with slave machine it's look fine

172.31.6.185 | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "cache_update_time": 1619825195,
    "cache_updated": false,
    "changed": false,
    "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"      install 'httpd'' failed: E: Package 'httpd' has no installation candidate\n",
    "rc": 100,
    "stderr": "E: Package 'httpd' has no installation candidate\n",
    "stderr_lines": [
        "E: Package 'httpd' has no installation candidate"
    ],
    "stdout": "Reading package lists...\nBuilding dependency tree...\nReading state information...\nPackage httpd is a virtual package provided by:\n  nginx-core 1.18.0-0ubuntu1\n  apache2 2.4.41-4ubuntu3.1\n\n",
    "stdout_lines": [
        "Reading package lists...",
        "Building dependency tree...",
        "Reading state information...",
        "Package httpd is a virtual package provided by:",
        "  nginx-core 1.18.0-0ubuntu1",
        "  apache2 2.4.41-4ubuntu3.1",
        ""
    ]
}
2

There are 2 best solutions below

6
Z.Liu On

Hmm, how about try to update your adhoc command

sudo apt update && sudo apt upgrade && sudo apt install apache2
0
prio1 On

The problem is that Ubuntu does not have httpd as a package name, which is explained in the following error message:failed: E: Package 'httpd' has no installation candidate

The Red Hat distribution family (RHEL, CentOS, and Fedora) call it httpd that because technically that's the upstream project name, the Debian distribution family (of which Ubuntu is a descendant) is called apache2.

https://www.thinbug.com/q/58357332