How to install Apache server on Ubuntu?

  1. Open a terminal window by pressing Ctrl+Alt+T or by searching for “terminal” in the Activities screen.
  2. Update the package list by running the following command:
    1
    sudo apt update
  3. Install the Apache package by running the following command:
    1
    sudo apt install apache2
    Apache server is now installed and ready to use. You can view or modify the server configuration files in the /etc/apache2/ directory.

Note: If you have a firewall configured (such as ufw), you may need to allow HTTP traffic through the firewall by using the following command:

1
sudo ufw allow 'Apache'