用于在 ubuntu 中安装软件包的 AD-HOC 命令

问题描述

每当我尝试在 ubuntu 中安装该软件包时,它都会抛出如下代码所示的错误

但是如果我尝试用从机 ping 看起来没问题

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",""
    ]
}

解决方法

嗯,尝试更新您的临时命令如何

sudo apt update && sudo apt upgrade && sudo apt install apache2