E: Package 'apache2' has no installation candidate on Ubuntu 17.10
Solution 1:
The main problem is missed /etc/apt/sources.list
.
You can recreate it with:
cat <<EOF | sudo tee /etc/apt/sources.list
deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs) main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu $(lsb_release -cs)-backports main universe restricted multiverse
EOF
Then run
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install apache2
Solution 2:
Try sudo apt-get update
and then sudo apt-get install apache2
.
I recommend installing the complete LAMP Stack using tasksel
sudo apt-get install tasksel
sudo tasksel
to launch it
Select LAMP server and install it.
Hope that helps.