尝试安装 apache,但它显示“软件包 apache2 不可用”

尝试安装 apache,但它显示“软件包 apache2 不可用”
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

相关内容