![尝试安装 apache,但它显示“软件包 apache2 不可用”](https://linux22.com/image/1152651/%E5%B0%9D%E8%AF%95%E5%AE%89%E8%A3%85%20apache%EF%BC%8C%E4%BD%86%E5%AE%83%E6%98%BE%E7%A4%BA%E2%80%9C%E8%BD%AF%E4%BB%B6%E5%8C%85%20apache2%20%E4%B8%8D%E5%8F%AF%E7%94%A8%E2%80%9D.png)
sudo apt 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
答案1
大多数安装手册都建议在安装新软件包之前更新存储库并升级现有软件包。因此,请尝试:
sudo apt update && sudo apt upgrade
sudo apt install apache2
答案2
塔什尔是一个 Debian/Ubuntu 工具,它可以将多个相关包作为协调的“任务”安装到您的系统上。
安装:
sudo apt-get install tasksel
用法:
sudo tasksel
将显示taskel菜单,选择复选框您需要输入,,,Space等待…完成。TabEnter
安装自terminal lamp-server
(Apache/PHP/MySQL 服务器)
sudo tasksel install lamp-server
PHP 可选:
sudo apt-get install php php-mysql php-mbstring php-all-dev php-cgi libapache2-mod-php php-imagick
PhpMyAdmin
sudo apt-get install phpmyadmin