Is there a way to check if Apache is installed on my Ubuntu 14.04 (Trusty Tahr) machine?
I am trying to install LAMP on my Ubuntu installation.
Is there a way to check if Apache is installed on my Ubuntu 14.04 (Trusty Tahr) machine?
I am trying to install LAMP on my Ubuntu installation.
 
    
     
    
    You can use the below commands to check if Apache is installed or not:
dpkg --get-selections | grep apache
or
apache2 -v
 
    
     
    
    Command:
dpkg --get-selections | grep apache
Output:
apache2            install
apache2-bin        install
apache2-data       install
apache2-utils      install
Command:
apache2 -v
Output
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2019-10-08T13:31:25
 
    
     
    
    This might be useful for a more generic approach, not depending on dpkg
command -v apache2
There's a post on this subject: How can I check if a program exists from a Bash script?
