How to Install Apache on Ubuntu 22.04 LTS - TechvBlogs

How to Install Apache on Ubuntu 22.04 LTS

In this guide, you’ll learn how to install an Apache web server on your Ubuntu 22.04 server.


Smit Pipaliya - Author - TechvBlogs
Smit Pipaliya
 

3 months ago

What is Apache?

Apache web server is developed by “Robert McCool.” This open-source web server is responsible for accepting HTTP requests from the users and providing the requested information in web pages and files. Programmers mainly utilize it for code testing. Apache also offers a secure file-sharing feature that permits users to store their essential files in its root directory and share them with other users.

This tutorial explains how to install and manage the Apache Web server on Ubuntu 22.04.

How to install Apache on Ubuntu 22.04

Before installing new software, it's a good idea to refresh your local software package database to make sure you are accessing the latest versions. This helps cut down on the time it takes to update after installation, and it also helps prevent zero-day exploits against outdated software.

Open a terminal and run this command:

sudo apt-get update

1. Install Apache

Run this command to install the apache package on ubuntu:

sudo apt-get install apache2

The system prompts for confirmation - do so, and allow the system to complete the installation.

How to Install Apache on Ubuntu 22.04 LTS - TechvBlogs

2. Verify Apache Installation

For Verify Apache was installed correctly, open a web browser and type in the address bar http://server_ip_address

After opening this URL you can see the apache2 default page as in the image below:

How to Install Apache on Ubuntu 22.04 LTS - TechvBlogs

3. Configure Your Firewall

Check the available ufw application profiles:

sudo ufw app list

How to Install Apache on Ubuntu 22.04 LTS - TechvBlogs

Let’s enable the most restrictive profile that will still allow the traffic you’ve configured, permitting traffic on port 80:

sudo ufw allow 'Apache'

How to Install Apache on Ubuntu 22.04 LTS - TechvBlogs

Verify the change:

sudo ufw status

If you have other applications or services to allow, make sure you configure your firewall to allow traffic.

For example, using the sudo ufw allow 'OpenSSH' command will enable secure, encrypted logins over the network.

4. Managing the Apache Process

Now that you have your web server up and running, let’s go over some basic management commands.

To stop your web server, run this command:

sudo systemctl stop apache2

To start the web server when it is stopped, run this command:

sudo systemctl start apache2

To stop and then start the service again, run this command:

sudo systemctl restart apache2

 If you are simply making configuration changes, Apache can often reload without dropping connections. To do this, use this command:

sudo systemctl reload apache2

By default, Apache is configured to start automatically when the server boots. If this is not what you want, disable this behavior by typing:

sudo systemctl disable apache2

To re-enable the service to start up at boot, type:

sudo systemctl enable apache2

This blog helped you install Apache on Ubuntu using a set of simple commands.

Thank you for reading this blog.

Read Also: How to add an external JS scripts to VueJS Components

If you want to manage your VPS / VM Server without touching the command line go and  Checkout this linkServerAvatar allows you to quickly set up WordPress or Custom PHP websites on VPS / VM in a  matter of minutes.  You can host multiple websites on a single VPS / VM, configure SSL certificates, and monitor the health of your server without ever touching the command line interface.

If you have any queries or doubts about this topic please feel free to contact us. We will try to reach you.

Comments (0)

ServerAvatar
Multiple sites on a single VPS/VM/Server Deploy PHP sites on cloud in minutes, simple as that!
ServerAvatar
Generate Free SSL Certificate - SSLForWeb

Generate Free SSL Certificate

  • 90-Day Certificates
  • SSL Monitoring
  • Wildcard Certificates
  • Multiple Domains
  • Certificate Management
  • Expiration Reminders

Comment


Note: All Input Fields are required.