Installing Apache 2.4 on Ubuntu 22.04

Ready to install Apache 2.4 on Ubuntu 20.04 or 22.04? You're in the right place!

Before We Begin: A Few Cautions!

Back it up! Before starting, ensure you've backed up your system. Because hey, things can go sideways sometimes, and it's best to be prepared!

1. Update and Upgrade

First and foremost, always ensure your system repositories are up to date. A fresh start makes for a smoother journey!

sudo apt update
Update package list Ubuntu

Personal Experience Alert: Once, I skipped apt update and ran into all kinds of version conflicts. Trust me; make sure the package list is up to date before upgrading!

2. Installing Apache

And now – installing Apache!

sudo apt install apache2
Install apache 2 on Ubuntu

Once installed, you should be able to start the service using:

sudo systemctl start apache2
Start the apache web service on Ubuntu

To ensure Apache automatically starts upon boot:

sudo systemctl enable apache2
Enable apache service on Ubuntu

And just like that, you've got Apache running! 🚀

3. Verify Apache Installation

After installing, it's always good practice to ensure everything's working. Open your preferred web browser and navigate to:

localhost:80

You should see the Apache default welcome page! If not, double-check your steps or dive into some troubleshooting.

4. Adjusting the Firewall

For those of you with UFW (Uncomplicated Firewall) enabled, make sure to allow the Apache profiles:

sudo ufw allow 'Apache'
Allow apache through UFW firewall on Linux

Safety first, folks! This step ensures only permitted traffic reaches your Apache server.

5. Additional Configurations (Optional)

Depending on your project, you might need additional configurations. This could be enabling specific Apache modules or tweaking performance settings. Apache's main configuration file is located at:

/etc/apache2/apache2.conf

Caution!: Always backup configuration files before editing. A wrong configuration might make the server misbehave and you'll want to easily restore it!


6. Wrapping Up

Your Apache 2.4 is now installed and humming away on your Ubuntu machine! 🎉

However, remember that the web is ever-evolving. To keep up, ensure you regularly update and maintain your Apache server. Last I checked the latest was Ubuntu apache 2.4.55, but always make sure to update!