apache2 command not found

In this troubleshooting guide we learn how to fix apache2 command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

apache2: command not found

or when using sudo you get the following error message

sudo: apache2: command not found

Solutions to apache2: command not found

How To Fix apache2: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu apache2 is provided by apache2-bin package.

apache2-bin is:

The Apache HTTP Server Project’s goal is to build a secure, efficient and extensible HTTP server as standards-compliant open source software. The result has long been the number one web server on the Internet.

This package contains the binaries only and does not set up a working web-server instance. Install the “apache2” package to get a fully working instance.

To fix this problem, we can install more using the command below.

sudo apt-get -y install apache2-bin

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install apache2-bin.

sudo apt -y install apache2-bin

Or if you have aptitude installed you can use the following command.

sudo aptitude install apache2-bin

Summary

In this tutorial we learn how to fix apache2 command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.