This question already has an answer here:

When I tried to install Apache in Ubuntu 18.04 using the command sudo apt install apache2, I got:

E: Distorted line 2 in the sources list /etc/apt/sources.list.d  /official-package-repositories.list
E: The list of sources is not read.
E: Distorted line 2 in the sources list /etc/apt/sources.list.d/official-package-repositories.list

The second line contains the word universe. After I deleted it, I got:

The apache2 package is not available, but is listed in the dependency list of another package.
E: No installation candidate found for the “apache2” package.

marked as duplicate by N0rbert, Eric Carvalho, RoVo, George Udosen, Charles Green Dec 19 '18 at 14:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Already tried :( – Racoon Dec 18 '18 at 13:08
  • 1
    Did you run sudo apt update after editing your sources? If not, do so. – user535733 Dec 18 '18 at 13:14

Comment out line 2 in //etc/apt/sources.list.d/official-package-repositories.list by preceding that line with a # character. Open the terminal and type:

sudo nano /etc/apt/sources.list.d/official-package-repositories.list 

Comment out line 2.

The instructions for using the nano editor are always found at the bottom of every page. Press the keyboard combination Ctrl+O and after that press Enter to save the file being edited. Press the keyboard combination Ctrl+X to exit nano.

Add the main repository to /etc/apt/sources.list. Open /etc/apt/sources.list with nano text editor and add the following lines to it.

deb http://archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse  
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse 

If you get a duplicate entry in sources.list error about any of the 4 new lines that you added, you can open /etc/apt/sources.list again in nano text editor, and comment out the duplicate lines by preceding them with a #.

Update the list of available software and try to install apache2 again.

sudo apt update    
sudo apt install apache2   

Not the answer you're looking for? Browse other questions tagged or ask your own question.