在 Ubuntu 17.10 上E: Package 'apache2' has no installation candidate
安装 apache2 时出错。sudo apt-get install apache2
这是终端上显示的消息。
sudo apt-get install apache2
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package apache2 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'apache2' has no installation candidate
命令后的消息apt-cache policy apache2
。
apache2:
Installed: (none)
Candidate: (none)
Version table:
egrep -v '^#|^ *$' /etc/apt/sources.list /etc/apt/sources.list.d/*.list
命令后的消息
/etc/apt/sources.list.d/linuxgndu-ubuntu-sqlitebrowser-artful.list:deb http://ppa.launchpad.net/linuxgndu/sqlitebrowser/ubuntu artful main
/etc/apt/sources.list.d/mongodb-org-3.6.list:deb [arch=amd64,arm64] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.6 multiverse
/etc/apt/sources.list.d/slack.list:deb https://packagecloud.io/slacktechnologies/slack/debian/ jessie main
/etc/apt/sources.list.d/sublime-text.list:deb https://download.sublimetext.com/ apt/stable/
/etc/apt/sources.list.d/vscode.list:deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main
/etc/apt/sources.list.d/webupd8team-ubuntu-java-artful.list:deb http://ppa.launchpad.net/webupd8team/java/ubuntu artful main
我该如何解决这个问题?
主要问题是漏掉了
/etc/apt/sources.list
。您可以使用以下方法重新创建它:然后运行
尝试
sudo apt-get update
然后sudo apt-get install apache2
。我建议使用安装完整的 LAMP 堆栈tasksel
sudo tasksel
启动它 选择 LAMP 服务器并安装它。希望有帮助。这可能是最快的
sudo software-properties-gtk
现在,再次尝试安装命令。