Debian

How to Install Apache2 Web Server on Debian 12

To install Apache on Debian 12, launch the terminal, update system packages, and execute the “sudo apt install apache2 -y” command.

Apache Server is used to host websites as well as to make sure that the content of the websites is loading correctly. Apache server is the most commonly used HTTP server due to its compatibility and versatility with most operating systems. It is the favorite web server of developers.

In this particular article, we’ll elaborate on how to install Apache Web Server from the terminal.

How to Install Apache-2 Web Server on Debian 12?

Apache Server is the most common, free-to-use web server. It provides reliable services for hosting websites. Proceed with the following steps for installing Apache2 Web Server.

Step 1: Update the Libraries

Type the below-mentioned command to update the libraries and packages of Debian:

$ sudo apt update

The command displays the message that packages are up to date. But in your case, it may update the packages.

Step 2: Install Apache2 Server Using Terminal

Type command that installs the Apache2 Web Server :

$ sudo apt install apache2 -y

Apache2 will be installed after the execution of the above command.

Step 3: Installation Verification

For the confirmation of installation type the following command in the terminal:

$ sudo systemctl status apache2

The command will confirm that the Apache2 Server has loaded, enabled, and is active (running). Type the below-mentioned command and start the server if the server is not active:

$ sudo systemctl start apache2

The above-mentioned command will activate the Apache Server. To stop the Server’s active state, type the following command:

$ sudo systemctl stop apache2

If you want to interact with Apache Server for managing any task, open your Web Browser and type localhost in the search bar. It will open the following window:

 

From here you can interact with the Apache server.

How to Uninstall Apache2

If you have no need to use Apache2 on a regular basis, you can uninstall it by using the “sudo apt remove apache2 -y” command:

$ sudo apt remove apache2 -y

The command will remove Apache2 from the system. Remove all the files associated with the Apache server, by using the following command:

$ sudo apt autoremove -y

The command will delete all the files of the Apache web server.

Conclusion

To install Apache on Debian 12, open the terminal, update existing packages, and execute the “sudo apt install apache2 -y” command. Users can confirm the Apache’s installation by executing the “sudo systemctl status apache2” command. The server can be managed through the terminal by the use of systemctl utility. This article has presented a series of steps on how you can install the Apache Web server using a terminal.

Similar Posts