Skip to main content

Install apache on ubuntu

· 2 min read
Sivabharathy

To install Apache on Ubuntu 24.04, follow these steps:

  1. Update the package index:

    sudo apt update
  2. Install Apache:

    sudo apt install apache2
  3. Verify that Apache is installed and running:

    sudo systemctl status apache2

    This command will show the status of the Apache service. You should see a message indicating that the service is active (running).

  1. Adjust the Firewall to Allow Web Traffic: If you have a firewall running, you need to open HTTP (port 80) and HTTPS (port 443) traffic. You can do this with the following commands:

    sudo ufw allow in "Apache"

    To verify the changes:

    sudo ufw status
  2. Test Apache: Open a web browser and navigate to your server's IP address or domain name (e.g., http://your_server_ip). You should see the default Apache welcome page, which means the installation was successful.

  3. Basic Commands to Manage Apache:

    • Start Apache:

      sudo systemctl start apache2
    • Stop Apache:

      sudo systemctl stop apache2
    • Restart Apache:

      sudo systemctl restart apache2
    • Reload Apache (useful if you made changes to the configuration files):

      sudo systemctl reload apache2
    • Enable Apache to start on boot:

      sudo systemctl enable apache2
    • Disable Apache from starting on boot:

      sudo systemctl disable apache2

By following these steps, you'll have Apache installed and running on your Ubuntu 24.04 server.