Installing a Web Server


Apache is the name of the web server software you need to install, you need to use the terminal to get it for installing a web server but it’s easy and should take only a few minutes.

First, open the terminal and make sure you’re up-to-date with:

sudo apt update

Next enter the command to install Apache and press Enter:

sudo apt install apache2

After doing this, it will tell you how much space the install will take, type Y and press Enter to proceed.

That’s it! You’ve finished installing a web server software called Apache and now your machine should be live on the web.

Check your website

Here’s how to check your web server is working. We’re going to look for the default web page that comes with Apache in any web browser you like to use, by visiting your Linux computers IP address. (we can link a name like yoursite.com to it later)

I’m going to keep it simple because we only want to confirm that installing a web server was successful and that it’s now running, so we’re going to check on your local network only.

First, find out your computers local IP address using:

hostname -I

The output will show your local IP address (e.g. 192.168.1.49)

Enter the IP address in a web browser on another device connected to the same network (same WiFi or LAN), or if you only have your Linux computer available just type localhost into the address bar

The page in your web browser should look like this:

Installing a web server with Apache

If you want to check that your web server is live and visible to the whole internet, read our next article: Making it Live

Installing a web server on Windows or Mac

You can also find out about installing a web server on Windows or Mac from the links I’ve included below. It’s not only Linux that can be used as a web server but 96.3% of the top one million web servers are running Linux.

https://www.wikihow.com/Install-the-Apache-Web-Server-on-a-Windows-PC

https://tech-cookbook.com/2021/10/25/how-to-setup-mamp-macos-apache-mysql-php-on-macos-12-monterey-2021/