• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

How to Install the Apache Web Server on Ubuntu 20.04

Written by Admin, Updated On May 4, 2020
apache, ubuntu
How to Install the Apache Web Server on Ubuntu 20.04

Apache is popular and most widely used cross-platform HTTP server. It powers a large number of websites and includes many powerful features, dynamically loadable modules with other popular software. This tutorial explains how to install Apache web server on Ubuntu 20.04 Focal Fossa.

Install Apache on Ubuntu#

Before you begin installation, make sure you are logged in as root or a non-root user account with sudo privileges.

Step 1 – Installing Apache#

By default, Apache package is available in within Ubuntu repositories. Let’s update the package index first and then install apache2 package:

sudo apt update
sudo apt install apache2

Here, we use sudo as command so these operations are executed with root privileges and it will prompt you to enter your regular user password to verify.

Once Apache is installed and it will start apache2 service automatically.

Step 2 – Adjusting the Firewall#

After Apache installation make sure that your firewall allows HTTP and HTTPS traffic. You can get list of ufw profile list by typing :

sudo ufw app list
Available applications:
   Apache
   Apache Full
   Apache Secure
   OpenSSH

Allow incoming HTTP and HTTPS traffic for this profile:

sudo ufw allow in "Apache Full"

Step 3 – Verifying Apache Installation#

At this point, your Apache web server should be up and running. To verify that Apache works correctly, execute below command :

sudo systemctl status apache2

It will show you output like below :

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Thu 2020-05-03 10:15:30 UTC; 10s ago
       Docs: https://httpd.apache.org/docs/2.4/
     ...

Alternatively, open your web browser, type your server IP address or domain name http://YOUR_SERVER_IP and you will see the default Apache welcome page as shown below:

ubuntu-apache-default-page

This page means that Apache is working correctly. It also showing some basic information about important Apache files and directory locations.

Step 4 – Manage Apache Processes#

Now your web server is installed and up to run so we will see some basic management commands.

To stop Apache service you can run :

sudo systemctl stop apache2

You can again start Apache service by type :

sudo systemctl start apache2

To do Restart (stop and start) the Apache service:

sudo systemctl restart apache2

If you have need to making configuration changes, Apache can reload without dropping connections. For this, use this command:

sudo systemctl reload apache2

If you want to disable the Apache service type:

sudo systemctl disable apache2

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

sudo systemctl enable apache2

Apache service should start automatically when the server boots again.

Conclusion#

You have successfully learned how to install Apache web server on your Ubuntu 20.04 machine. Start deploying your applications and use Apache as a web or proxy server.

If you have any question or suggestion, feel free to leave a comment below.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article How to Install VirtualBox Guest Additions on CentOS 8
Next Article   How to Set Up SSH Keys on Ubuntu 20.04

Related Posts

  • How to Install and Use PHP Composer on Ubuntu 22.04

    How to Install Composer on Ubuntu 22.04

    January 31, 2023
  • How to Install Nginx on Ubuntu 22.04

    How to Install Nginx on Ubuntu 22.04

    January 28, 2023
  • How to Install Puppet Agent on Ubuntu 22.04

    How to Install Puppet Agent on Ubuntu 22.04

    January 22, 2023

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Jenkins on Debian 11
    How to Install Jenkins on Debian 11 January 5, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook