Install Apache Server on Windows and Linux

Let’s kick off this tutorial by installing the Apache server on a Ubuntu machine. So without any further delay, let’s dive in and install Apache.

If you don’t already have Apache installed on your Ubuntu virtual machine:

  1. SSH into your Ubuntu VM using your favorite SSH client.
  2. Run the below command to ensure that Ubuntu has all the latest package sources. Apache will be installed as an apt package which you’ll download and install in the next step.
Sudo apt update
Updating the package repository on the Ubuntu Machine
Updating the package repository on the Ubuntu Machine
  1. Next, install the Apache package using the apt install command.
sudo apt install apache2 
Installing Apache server on Ubuntu Machine
Installing Apache server on Ubuntu Machine
  1. Now, verify if the Apache server has been successfully installed on the Ubuntu Machin. To test the apache server on your browser, navigate to <ip-address-of-server>:80, and you should see the Apache homepage below.

Install Apache Server on Windows Server

Previously you learned how to install an Apache server on an Ubuntu machine. In the same way, you can also make it happen on Windows operating system.

Installing the Apache server is a simple task and requires a few steps, as mentioned below.

  1. Open your favorite browser and download the appropriate version of the Apache server from here, as shown in the below image.

At the moment of the writing, the latest Apache web server version is 2.4.54. The examples will use this version.

Downloading the Apache on a Windows machine
Downloading the Apache on a Windows machine
  1. Create an Apache24 folder in your C:\ drive, extract the downloaded archive file, and copy the Apache exe file into the C:\Apache24 folder.
Extracting the Apache exe file in C drive
Extracting the Apache exe file in C drive
Moving the Apache24 folder from the extracted folder in the C drive
  1. Next, open the Apache configuration file httpd.conf at C:\Apache24\conf location and update the below lines. The below line will enable the SSL module on Windows machines and allow Apache to work with the Https port.
LoadModule rewrite_module modules/mod_rewrite.so
  1. Now, start the Apache server by executing the http.exe file on the command line or PowerShell.
./httpd.exe
Starting the Apache server on a Windows machine
Starting the Apache server on a Windows machine
  1. After executing the command, verify the Apache server by opening the browser and navigating to the localhost link. You should see an (It works!) message on the page confirming successful installation of Apache server on Windows machine.

Leave a comment