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:
- Open a terminal window by pressing Ctrl + Alt + T.
- 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
- Install Apache server by running the following command:
sudo apt-get install apache2
- Once the installation is complete, start the Apache server by running the following command:
sudo systemctl start apache2
- 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:
- Open a terminal window by pressing Ctrl + Alt + T.
- Update the package list and upgrade any existing packages by running the following command:
sudo yum update
- Install Apache server by running the following command:
sudo yum install httpd
- Once the installation is complete, start the Apache server by running the following command:
sudo systemctl start httpd
- 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.