To install Apache on Ubuntu 24.04, follow these steps:
Update the package index:
sudo apt updateInstall Apache:
sudo apt install apache2Verify that Apache is installed and running:
sudo systemctl status apache2This command will show the status of the Apache service. You should see a message indicating that the service is active (running).
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 statusTest 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.Basic Commands to Manage Apache:
Start Apache:
sudo systemctl start apache2Stop Apache:
sudo systemctl stop apache2Restart Apache:
sudo systemctl restart apache2Reload Apache (useful if you made changes to the configuration files):
sudo systemctl reload apache2Enable Apache to start on boot:
sudo systemctl enable apache2Disable 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.

