Получил ошибку E: Package 'apache2' has no installation candidate
при установке apache2 с sudo apt-get install apache2
на Ubuntu 17.10. Вот сообщение, отображенное на терминале.
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
. Вы можете воссоздать его с помощью:
cat <<EOF | sudo tee /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu artful main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu artful-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu artful-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu artful-backports main universe restricted multiverse
EOF
Затем запустите
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install apache2
Попробуйте sudo apt-get update
, а затем sudo apt-get install apache2
. Я рекомендую установить полный стек LAMP, используя tasksel
sudo apt-get install tasksel
sudo tasksel
, чтобы запустить его. Выберите сервер LAMP и установите его. Надеюсь, это поможет.