• 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 Apache on Ubuntu 18.04

Written by Admin, Updated On May 7, 2019
apache, httpd, ubuntu
How To Install Apache on Ubuntu 18.04

Apache is an open-source and most popular and used HTTP web server in the world. It powers a large number of websites among the world. Apache HTTP server is cross-platform, powerful, stable, reliable and free web server providing features which can be extended by the wide variety of modules. In this guide, you will learn how to install Apache on Ubuntu 18.04.

Prerequisites#

You need Ubuntu 18.04 server with a non-root user account with sudo privileges.

Install Apache on Ubuntu 18.04#

Apache is available in the default Ubuntu software repositories so Apache installation is very easy and straightforward to install using apt package management tool.

First, update the package index and with the below commands:

sudo apt update

On Debian and Ubuntu systems the Apache service and package is called apache2. To install apache2 execute below command :

sudo apt install apache2

Once process is completed, Apache is installed in your Ubuntu server. Apache service will start automatically after installation. You can check Apache service status by typing:

sudo systemctl status apache2

It will show output like below:

Output
● apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2019-03-23 16:30:47 UTC; 13min ago
Main PID: 491 (apache2)
CGroup: /system.slice/apache2.service
├─ 491 /usr/sbin/apache2 -k start
├─1723 /usr/sbin/apache2 -k start
└─1724 /usr/sbin/apache2 -k start

Adjust the Firewall#

If your Ubuntu server is protected by firewall then make sure that your firewall allows HTTP and HTTPS traffic. You can check “Apache Full” profile enables traffic or not :

sudo ufw app info "WWW Full"
Output
Profile: WWW Full
Title: Web Server (HTTP,HTTPS)
Description: Web Server (HTTP,HTTPS)

Ports:
80,443/tcp

It should show that it enables traffic to ports 80 and 443 or you can Allow incoming HTTP and HTTPS traffic for this profile:

sudo ufw allow in "Apache Full"

Verify Apache Installation#

To check that everything goes correctly, open your browser and visit your server IP address http://YOUR_SERVER_IP/

It should display a default Ubuntu 18.04 Apache web page as following screenshot :

Install Apache on Ubuntu 18.04

If you will see this page then your Apache installation is correct.

Manage Apache Processes#

Now Apache web server is installed on your machine and up to run so we will see few basic management commands.

You can stop Apache service by type:

sudo systemctl stop apache2

To start again Apache service type:

sudo systemctl start apache2

You can Restart (stop and start) the Apache service by:

sudo systemctl restart apache2

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

sudo systemctl reload apache2

Also, you can disable the Apache service by typing:

sudo systemctl disable apache2

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

sudo systemctl enable apache2

Finally, you have successfully installed Apache on your Ubuntu 18.04 server.

Conclusion#

By this guide, You successfully installed Apache on your Ubuntu 18.04 server. You can now start deploying your applications and use Apache as a web server.

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 MySQL on CentOS 7 Server
Next Article   How to Secure Apache with Let’s Encrypt on CentOS 7

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