When I tried to install apache2 on Ubuntu 14.04, I got the following error message:
root@Final-Gitsetup-Developers:~# 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
However the following packages replace it: libapache2-mpm-itk libapache2-mpm-itk:i386
E: Package 'apache2' has no installation candidate Results of apt-cache policy | grep http | awk '{print $2 $3}' | sort -u
1 Answer
All the software sources in your /etc/apt/sources.list file that have the string wily (Ubuntu 15.10) in them are conflicting with your Ubuntu 14.04 software sources and preventing you from installing apache2. To fix this, preface each line that has the strings wily or xenial in it by a # character in order to turn it into a comment.
Edit the /etc/apt/sources.list file with nano text editor. Open the terminal and type:
sudo nano /etc/apt/sources.list A standard sources.list file for Ubuntu 14.04 looks like this:
deb trusty main restricted universe multiverse
deb trusty-updates main restricted universe multiverse
deb trusty-backports main restricted universe multiverse
deb trusty-security main restricted universe multiverse
deb trusty partner
deb trusty main Every line in the above standard sources.list file has the string trusty in it because you are using Ubuntu 14.04. Adding repositories of other Ubuntu releases such as 15.10 or 16.04 to your Ubuntu 14.04 software sources is very bad package management.
Nano editor keyboard shortcuts
Use the keyboard combination Ctrl + O and after that press Enter to save the file to its current location.
Use the keyboard combination Ctrl + X to exit nano.
Update the list of available software and install apache2.
sudo apt update
sudo apt install apache2 9