How to install Apache web server on Linux Ubuntu server

Apache web server is one of the most popular web servers for UNIX and Windows operating systems. It allows you to serve web pages and deploy web applications. It can also be used as a reverse proxy server. In this article, I will show you how to install and configure Apache web server on Linux Ubuntu server.

Prerequisites

Before installing Apache web server, you need to have the following:

  • A Linux Ubuntu server with at least 4GB RAM and 5GB of storage.
  • Java version 8 or newer installed on your server. You can check your Java version by running java -version command.
  • A non-root user with sudo privileges.

Step 1: Update the system repository

The first step is to update the system repository to ensure that you have the latest packages available for installation. Log in to your Ubuntu server using SSH and run the following command:

sudo apt update

Step 2: Install Apache web server

The next step is to install Apache web server from the APT repository. Run the following command:

sudo apt install apache2

This will install Apache web server and its dependencies on your server.

Step 3: Start and enable Apache service

After installing Apache web server, you need to start and enable the Apache service so that it runs automatically when your server boots up. Run the following commands:

sudo systemctl start apache2
sudo systemctl enable apache2

Step 4: Test your Apache web server installation

To verify that your Apache web server installation was successful, you can run the following command:

service apache2 status

This will show you the status of the Apache service. You should see something like this:

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-05-06 11:17:54 CEST; 3min 12s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 1234 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 1235 (apache2)
      Tasks: 55 (limit: 2286)
     Memory: 6.7M
     CGroup: /system.slice/apache2.service
             ├─1235 /usr/sbin/apache2 -k start
             ├─1236 /usr/sbin/apache2 -k start
             └─1237 /usr/sbin/apache2 -k start

May 06 11:17:54 ubuntu-server systemd[1]: Starting The Apache HTTP Server...
May 06 11:17:54 ubuntu-server apachectl[1234]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
May 06 11:17:54 ubuntu-server systemd[1]: Started The Apache HTTP Server.

Alternatively, you can also use your web browser to access your server’s IP address or domain name. You should see the default Apache welcome page like this:

Conclusion

In this article, I have shown you how to install and configure Apache web server on Linux Ubuntu server. You can now use Apache to host your own website or web application on your server.

If you have any questions or feedback, feel free to contact me at  leaving me a message in the comments. Thank you for reading! 😊


Home » Blog » EN » Linux – EN » How to install Apache web server on Linux Ubuntu server

Lascia un commento