Installing Apache
In this page:
Where Apache Runs
Apache can run on your own laptop for local development, on a cloud server (a Linux VM on AWS, DigitalOcean, etc.), or on-premise hardware in a company's own server room. Most production Apache installs are on Linux, since that's where it's fastest to install, easiest to automate, and where the vast majority of hosting documentation assumes you're working.
Checking If It's Already There
Many Linux distributions and some hosting images come with Apache pre-installed, or it may have been installed by a previous admin. Before installing anything, check with apache2 -v (Debian/Ubuntu) or httpd -v (RHEL/CentOS/Fedora) to see if it's already there and which version.
The General Install Flow
On almost every platform, installing Apache follows the same three steps: install the package using the system's package manager, start the Apache service (and enable it to start on boot), then visit the server's IP address in a browser to confirm you see Apache's default "It works!" page. The exact commands differ by OS, which the next two lessons cover in detail for Linux and Windows.
curl localhost after installing -- a service that reports "active" isn't proof the server is actually reachable and configured correctly.Apache's Own Naming: httpd vs. apache2
The Apache binary is called httpd upstream and on RHEL-family distributions (CentOS, Fedora, Rocky Linux, AlmaLinux). Debian-family distributions (Debian, Ubuntu) package and name it apache2 instead. Functionally they're the same software -- the difference is purely in what the package, service, and config directory are called on each distro family.
apache2 onto a RHEL/CentOS box (or vice versa) will fail on the package/service name -- always match the commands to your actual distro family.- Running
apt install apache2on a RHEL/CentOS/Fedora system (oryum install httpdon Debian/Ubuntu) -- the package name is different on each distro family. - Not opening the firewall for ports 80/443 after installing, then assuming Apache is broken when the real problem is the server is unreachable from outside.
- Forgetting to enable the service to start on boot, so Apache works today but doesn't come back up after the next server reboot.
Chapter Quiz — Complete all 4 topics to unlock
0/4 topics done
Complete these topics first: