How To Install and Setup Apache2 on Ubuntu

1

Updates the list of available packages and their versions

sudo apt-get update
2

Installs the newest versions of all packages currently installed on the system.

sudo apt-get upgrade
3

Installs the Apache2 web server.

sudo apt-get install apache2
4

Starts the Apache2 service.

sudo systemctl start apache2
5

Sets the Apache2 service to start on boot.

sudo systemctl enable apache2