'AD-HOC command for installing a package in ubuntu
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",
""
]
}
Solution 1:[1]
Hmm, how about try to update your adhoc command
sudo apt update && sudo apt upgrade && sudo apt install apache2
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Z.Liu |
| Solution 2 | pA1_pv |
