我从 Ubuntu 卸载了 apache2,现在无法重新安装它

我从 Ubuntu 卸载了 apache2,现在无法重新安装它

我从 Ubuntu 卸载了 apach2,因为它现在看起来不起作用,我尝试使用以下命令再次安装它sudo apt install apache2

我可以看到以下错误

E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/a/apr/libapr1_1.7.0-8ubuntu0.22.04.1_amd64.deb  Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/a/apr-util/libaprutil1_1.6.1-5ubuntu4.22.04.2_amd64.deb  Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/a/apr-util/libaprutil1-dbd-sqlite3_1.6.1-5ubuntu4.22.04.2_amd64.deb  Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/a/apr-util/libaprutil1-ldap_1.6.1-5ubuntu4.22.04.2_amd64.deb  Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/a/apache2/apache2-bin_2.4.52-1ubuntu4.7_amd64.deb  Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/a/apache2/apache2-data_2.4.52-1ubuntu4.7_all.deb  Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/a/apache2/apache2-utils_2.4.52-1ubuntu4.7_amd64.deb  Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/a/apache2/apache2_2.4.52-1ubuntu4.7_amd64.deb  Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/pool/main/s/ssl-cert/ssl-cert_1.1.2_all.deb  Could not resolve 'mirrors.cloud.aliyuncs.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

我试过了apt-get update,现在有以下警告

W: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/dists/jammy/InRelease  Could not resolve 'mirrors.cloud.aliyuncs.com'
W: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/dists/jammy-updates/InRelease  Could not resolve 'mirrors.cloud.aliyuncs.com'
W: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/dists/jammy-backports/InRelease  Could not resolve 'mirrors.cloud.aliyuncs.com'
W: Failed to fetch http://mirrors.cloud.aliyuncs.com/ubuntu/dists/jammy-security/InRelease  Could not resolve 'mirrors.cloud.aliyuncs.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

当我运行以下命令时,出现错误

sudo systemctl status apache2

错误:找不到单元 apache2.service。

之后

sudo ufw app list

它说:可用的应用程序:

  • OpenSSH
  • 防火墙

所以现在我无法在 Ubuntu 上安装 apache2

答案1

由于某种我们不知道的原因,您安装的镜像服务器的名称已更改为名为 的不受信任的镜像mirrors.cloud.aliyuncs.com。这不是常规的 Ubuntu 镜像,当然也不是随您的 Ubuntu 系统安装而来的。此服务器此时甚至没有响应。

您可以将其更改回受信任的镜像,可以通过手动编辑/etc/apt/sources.list每个*.list文件来更改/etc/apt/sources.list.d;或者使用图形实用程序software-properties-gtk,如@Raffa所推荐的那样。

受信任的镜像通常是一个名为“ xxx.ubuntu.comwhere”的网络服务器xxx,其代码特定于您的国家/地区。

但是,安装完某些东西后,请检查文件*.list,看看它们是否没有变回原样。如果您的系统以某种方式被黑客入侵,则可能会再次被黑客入侵。如果是这样,只有完全重新安装才是安全的。

相关内容