Linux Debian – Install & Manage Apache Web Server

During my first time working with the Linux distribution Debian, aka Debian GNU/Linux, i had to pick up some new commands but many things are same as with Linux versions i usually work with e.g. Red Hat Enterprise Linux (RHEL) and CentOS. In Debian when managing (install, delete, update) packages you have to use Advanced Packaging Tool (apt) instead Yellowdog Updater (yum) for CentOS or lately, at least for Fedora Dandified YUM (DNF).

So back to the heading, to install apache on Debian you just have to follow the below two really simple steps:

  • sudo apt update -y – This to make sure you got the latest repository and it’s information available.
  • sudo apt install apache2 -y – The actual installation and use -y to answer yes to the questions automatically meaning a non interactive installation.

When done it might be useful to verify what you have accomplished and e.g

  • Verify the apache server is up and via the following command – “sudo systemctl status apache
  • Check apache version via e.g::
    • Reading the main config file which is
    • Query the web server running command curl –head http://localhost/

During normal operation you might have to stop and start the apache server and that done using the following commands:

  • sudo systemctl start apache2 – Start apache server
  • sudo systemctl stop apache2 – Stop apache server

Last thing will be to check the Debian version and it’s very similar to what you do in e.g. CentOS meaning reading the file /etc/redhat-release but with debian you check the file /etc/similar