I've been trying for the past few days to install Apache2 on Kali Linux. No matter what I've tried, when I do

sudo apt install apache2

it says that there's no installation candidate for the package. I'm fairly new to Linux.

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
  • 4
    "Apache2 on Kali Linux" ... why? – roaima Jun 28 '20 at 19:16

Have you updated your repo metadata? I am assuming your installation is new, so you probably need apt to look over your package sources and index the available packages. Try sudo apt update && sudo apt install apache2.


Kali needs only one line in the /etc/apt/sources.list file:

deb https://http.kali.org/kali kali-rolling main non-free contrib

Edit /etc/apt/sources.list if necessary with sudo nano /etc/apt/sources.list and save the file.

Nano text 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.

Install apache2: ← from kali-rolling repository

sudo apt update
sudo apt install apache2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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