Ubuntu 18 Tutorial How to install the Apache Web Server

Register here to save your progress

? ?

Installing Apache Web Server

Since Apache can be found in the default's Ubuntu repositories we can install it using the normal package management tool like this:

  • First we are updating our local package index:
$ sudo apt update
  • Next we install the apache2 package using:
$ sudo apt install apache2

With just this commands we have installed the Apache Web Server on our environment.

What's the name of the Apache Web Server repository package?

Checking the status, start, stop, restart, reload Apache Web Server

To check the status of the Apache Web Server we use the command:

$ sudo systemctl status apache2

If we want to stop Apache Web Server we can use the following command:

$ sudo systemctl stop apache2 

To start again the server we may use:

$ sudo systemctl start apache2

We can also perform a stop and start again operation using a restart command while server running using:

$ sudo systemctl restart apache2

A similar command is reload. The difference between reload and restart if that we won't stop and start the Apache service, we will only reload the configuration while the server is running. This is recommanded if we want to update the server configuration while keeping it running. We can do this with:

$ sudo systemctl reload apache2

You just made some basic changes to your Apache server's configuration. What would be a good choice to load the new configuration while keeping it running?