How to install Apache Web Server on Ubuntu 18.10

Apache is a free and open source web server that's used widely in Linux servers

Apache HTTP server is an immensely popular cross-platform web server that’s used worldwide. It is a free, open-source, powerful, and can run on UNIX/Linux as well as MS Windows platforms.

Notable features include the ability to allow the server to serve more concurrent requests due to Multi-Processing Module (MPM) and integrated proxy module support for the FastCGI protocol, asynchronous read and write handling, and significant integration with different application/software, various modules, etc. It also supports embedded Lua scripting. It’s not just a web server. It also works as a reverse proxy for other web servers.

Installing Apache Web Server on Ubuntu 18.10

Official Ubuntu software repositories come with Apache and its dependencies. Hence, it’s simpler to update the system’s package index and then use the APT package manager to install the Apache package and its dependencies.

Step 1) Launch Terminal and enter the following command to update the system.

sudo apt-get update

Step 2) Check available Apache version on Ubuntu repository

sudo apt-cache policy apache2

Check available Apache Version
Check available Apache Version

Step 3) Install apache2

sudo apt-get install apache2

Install Apache
Install Apache

Step 4) It will ask, “do you want to continue.” Type Y.

Step 5) Normally, the Apache service should be started automatically. We can check the apache status.

sudo systemctl status apache2.service


Starting and managing Apache Services

Apache services can be managed by using the following commands:

To start Apache2 service

sudo systemctl start apache2

To stop Apache2 Service

sudo systemctl stop apache2

To Restart Apache2 Service

sudo systemctl restart apache2

To Reload Apache2 service after configuration changes

sudo systemctl reload apache2

Enable Apache2 service to start at boot

sudo systemctl enable apache2

Disable Apache2 on boot

sudo  systemctl disable apache2

Checking UFW Firewall

If you have the UFW firewall enabled, you need to open port 80 and 443. This is because the Apache webserver gets client requests via HTTP and HTTPS. Check UFW status by entering the following command:

sudo systemctl status ufw.service

Checking UFW status
Checking UFW status

Now you can allow ports 80 and 443 as follows:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw  reload

Allowing Ports
Allowing Ports

By chance, if you see a message “Firewall not enabled (skipping reload)”  at the reload UFW command, edit “ufw.conf” file using VIM command as follows:

sudo  vim /etc/ufw/ufw.conf

Editing Conf
Editing Conf

Change ENABLED=no to ENABLED=yes
save and exit file using: wq

Here is how the final edited file will look like:

Edited Conf
Edited Conf

Now try to reload Firewall again. It should work without issue this time.

sudo ufw  reload

UFW Reload
UFW Reload

Checking the Apache installation

To check the Apache installation running status, launch the browser using hostname/server IP address:



Using server Ip (Your server IP)

This is the Apache default page, and if you can see this, it means your apache server is working well.

Apache2 default page
Apache2 default page

Additional Note:- Main directories of Apache can be classified as follows

Web DocumentRoot: /var/www/html/
Main config files directory: /etc/apache2/
Main config file: /etc/apache2/apache2.conf
Additional configuration : /etc/apache2/conf-available/ and /etc/apache2/conf-enabled/
Virtual hosts configuration : /etc/apache2/sites-available/ and /etc/apache2/sites-enabled/
Configuration  for loading modules: /etc/apache2/mods-available/ and /etc/apache2/mods-enabled/
Log files directory: /var/log/apache2/

I hope it worked well for you. Got any questions? Shoot below.

Hey! I'm Darshana, a Linux / DevOps Engineer and also a contributor to FOSS Linux. I enjoy working on various kind of Linux distributions and cloud technologies. During my free time, I love to swim and hike across nature trails. Linux is my love and I'm here to share all my learnings with all of you! Hope you enjoyed reading my article.


    • May be you are missing PHP library for Apache
      Try this according to your php Version
      1. apt-cache policy libapache2-mod-php*
      Then it will say installed or not and show available packages
      2 . apt-get install libapache2-mod-php7.2 (with your php version)


Please enter your comment!
Please enter your name here




Top 10 Reasons to use Xfce as your Desktop Environment

There are many choices for desktop environments for Linux based operating systems. Mainly, you can install any DE of your choice on most of the Linux based distributions, even if they are not offered as a package officially. In our recent articles, we discussed the best of KDE and Cinnamon. In this article, we wish to present to you the top reasons why you should consider Xfce as your desktop environment.

The 10 Best Linux Network Monitoring Tools

Having total control over your network is essential to prevent programs from overusing your network resources and slowing down the overall performance. This is why you should install a network monitoring tool on your system, giving you a visual overview of everything that's happening on your network. Networking Tools are like swiss-knife for the system administrators for troubleshooting system issues.

How to install CouchPotato on Ubuntu

Downloading movies and copying them over to your home server can get frustrating, especially if you are doing it daily! What if you have an option to download videos automatically, quickly, and above all with excellent quality. CouchPotato allows you to download movies easily once they are available and released automatically.

Top 20 Rsync Examples in Linux

The Rsync (remote sync) command is a Linux/Unix utility used to synchronize and copy files and directories either locally or remotely. Most Linux geeks use Rsync to mirror, backup or migrate data across folders, across disks and networks. One notable feature with the Rsync command is that it uses the "delta transfer algorithm."

Setting up NFS Server on Ubuntu Server

We have put together a detailed step-by-step tutorial that will guide you on how to install and set up NFS Server on Ubuntu so you too can start sharing data with other client systems. It is divided into sections, the first part discussing how to set up the host server and the second part showing you how to set up the client-side. For this tutorial, we will be using Ubuntu 20.04 LTS.

Crontab in Linux Explained With Examples

Crontab is the Linux equivalent of the Window's Task Scheduler. It can help you set up a task to run automatically at a regular...


Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

Top 10 reasons to use KDE as your Desktop Environment

In this article, we will take a look at yet another popular desktop environment, KDE. It's one of the most amazing Linux Desktop environments available in the market.

6 Essential Command-Line Utilities Every Linux User Should Know

Last week, we shared with you several "cool and fun" commands to get comfortable and confident with the Linux command-line. In our quest to further aid Linux users with mastery of the command line, or CLI, we present you with a variety of command-line utilities essential for all Linux users, regardless of proficiency level.

6 cool and fun Linux commands you don’t want to miss

The real purpose of this article is to help Linux newbies get comfortable and confident with the Linux command-line.  While knowledge and comfort of the Linux GUI allow great power, it is the mastery of the command line, or CLI, affords the Linux user unlimited power and certifies them as a Linux power user well on their way to becoming an expert.

Top 5 Linux Distros for Windows Users

When Microsoft initially released Windows 7 in October 2009, the software giant committed to providing ten years of support for its popular operating system.  The much-maligned Microsoft was true to their word, support for Windows 7 ended just yesterday a little over ten years after its release.