How To install an Apache server from the terminal on a Linux distribution

To install the Apache server from the terminal on a Linux distribution, you can use the package manager that comes with your distribution. Here are the steps for some popular Linux distributions:

Ubuntu or Debian:

  1. Open a terminal window by pressing Ctrl + Alt + T.
  2. Update the package list and upgrade any existing packages by running the following command:

How to Apache server on your Mac M1

sudo apt-get update && sudo apt-get upgrade
  1. Install Apache server by running the following command:
sudo apt-get install apache2
  1. Once the installation is complete, start the Apache server by running the following command:
sudo systemctl start apache2
  1. Check if the Apache server is running by opening a web browser and going to http://localhost. If you see the “It works!” message, then the Apache server is running.

CentOS or Fedora:

  1. Open a terminal window by pressing Ctrl + Alt + T.
  2. Update the package list and upgrade any existing packages by running the following command:
sudo yum update
  1. Install Apache server by running the following command:
sudo yum install httpd
  1. Once the installation is complete, start the Apache server by running the following command:
sudo systemctl start httpd
  1. Check if the Apache server is running by opening a web browser and going to http://localhost. If you see the “It works!” message, then the Apache server is running.

That’s it! You have successfully installed and started the Apache server on your Linux distribution using the terminal.

Leave a Comment