How to Install Apache on Ubuntu

Before you can start hosting websites from your Ubuntu server, you will first need to install web server software. This software will function as a handler for your server, allowing users to connect to the server over the public internet. While there are many different types of web server software available, one of the most popular is Apache. In this guide, we will outline how to install and configure Apache on your Ubuntu server via SSH. Please note that you will need root access to complete this guide.

Topics Include:

Install Apache on your Dedicated Hosting server to start establishing your online presence today!

Installing Apache

  1. Before you can install Apache, you will first want to make sure to update the software package using the following command:

    sudo apt update
  2. Once the package has updated, you can then install Apache using the following command:

    sudo apt install apache2

    The installation process will prompt you to press a key to continue. Press the Y key and hit enter.

Configuring UncomplicatedFirewall

Before Apache can start accepting connections, you need to allow the service in the Ubuntu firewall software, known as ufw or UncomplicatedFirewall.

  1. If ufw is not already enabled, enable it with the following command:

    sudo ufw enable
  2. With ufw enabled, you can allow Apache connections using the following command:

    sudo ufw allow 'Apache'
  3. To confirm that the firewall is now allowing Apache connections, use the following command:

    sudo ufw status

    The output will then display which connections are now allowed in the firewall.

Managing Apache

To check the status of the Apache service, run the following command:

sudo systemctl status apache2

If Apache is running properly, it should say active in the output.

Occasionally, making changes to your server may require you to restart Apache. You can do this via the following command:

sudo systemctl restart apache2

If you want to restart Apache without dropping active connections, you can reload Apache with the following command:

sudo systemctl reload apache2 

Testing Apache

  • To confirm that Apache is installed properly and accepting connections over the public internet, you can test it by visiting your server IP address in your browser. For example, if your server IP is 123.456.789.0, you would navigate to this URL in your browser:

    https:// 123.456.789.0

  • If the installation process was successful, you should see the following splash page:

    Apache Ubuntu Splash Page

Congratulations, you have now installed Apache on your Ubuntu server!

AK
Alyssa Kordek Technical Writer

Alyssa started working for InMotion Hosting in 2015 as a member of the Technical Support team. Before being promoted to Technical Writer, Alyssa developed a skillset that includes data migration and system administration. She now works to produce quality technical content such as how-to guides that help users get the most out of their hosting experience.

More Articles by Alyssa

Was this article helpful? Let us know!