This post shows students and new users steps to find out what version of Apache is running on their server or install a specific Apache version on Ubuntu Linux. For users who want to know what version of Apache is running on their server, the steps below will show them how.
For those who also want to know how to install a specific version of Apache on Ubuntu Linux, the steps below will show them how to do that. In addition, the steps will also include options to find out what modules are loaded with Apache on Ubuntu Linux.
For those who don’t know what Apache is, here’s an overview:
Apache is the most popular open-source web server in the world. Chances are, many of the websites you visit today are most likely running Apache HTTP servers. And if you’re thinking of running a website, you find yourself using an Apache web server.
To get started with finding out what version of Apache you’re running, or installing a specific Apache version on Ubuntu Linux, continue below.
How to find out what version of Apache you are running in Ubuntu Linux
Installing Apache on Ubuntu Linux is easy. Run the apt-get install apache2 commands to get it installed.
Run the commands below to check the Apache version on the Ubuntu Linux command console.
apache2 -v # OR apachectl -v
Once you run the command above, it should output similar lines as below:
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2021-10-14T16:24:43
As you can see, version 2.4.41 is currently available in the Ubuntu repository. However, it doesn’t mean that the latest version of Apache can be installed.
You may also be able to find more info by running the commands below:
apt info apache2
When you run the commands above, it should list similar lines as below:
Package: apache2 Version: 2.4.41-4ubuntu3.8 Priority: optional Section: web Origin: Ubuntu Maintainer: Ubuntu Developers <[email protected]> Original-Maintainer: Debian Apache Maintainers <[email protected]> Bugs: https://bugs.launchpad.net/ubuntu/+filebug
If you have curl installed, you may also be able to tell what version of Apache is running on Ubuntu Linux by using the commands below:
curl -I http://localhost/
When running the commands above, it should list something similar to the lines below:
HTTP/1.1 200 OK
Date: Mon, 27 Dec 2021 18:06:03 GMT
Server: Apache/2.4.41 (Ubuntu)
Last-Modified: Mon, 27 Dec 2021 17:52:16 GMT
ETag: "2aa6-5d4245d84cdaf"
Accept-Ranges: bytes
Content-Length: 10918
Vary: Accept-Encoding
Content-Type: text/html
How to find out what Apache modules are currently loaded in Ubuntu Linux
Now that you know how to find out what version of Apache is installed on your system, the commands below show you how to list all the modules that are currently loaded with Apache.
apache2ctl -M
Once you run the commands above, it should output similar lines as below.
Loaded Modules: core_module (static) so_module (static) watchdog_module (static) http_module (static) log_config_module (static) logio_module (static) version_module (static) unixd_module (static) access_compat_module (shared) alias_module (shared) auth_basic_module (shared) authn_core_module (shared) authn_file_module (shared) authz_core_module (shared) authz_host_module (shared) authz_user_module (shared) autoindex_module (shared) deflate_module (shared) dir_module (shared) env_module (shared) filter_module (shared) mime_module (shared) mpm_event_module (shared) negotiation_module (shared) reqtimeout_module (shared) setenvif_module (shared) status_module (shared)
Depending on your environment, the list above may be long or short.
How to install a specific version of Apache on Ubuntu Linux
By default, the Ubuntu repository contains the latest stable version of Apache. When you install Apache from the Ubuntu repository, it will only install that specific version available.
You may have to add a third-party repository to your system if you need to install a specific version unavailable in Ubuntu Linux.
Run the commands below to add a repository to Ubuntu Linux that will allow you to install specific versions.
First, install the necessary commands below:
sudo apt update sudo apt install software-properties-common
Next, run the commands below to add the repository.
sudo add-apt-repository ppa:ondrej/apache2 sudo apt-get update
After that, you can search for and install a specific version of Apache.
apt-cache showpkg apache2
Install a specific version by running the command format below:
sudo apt-get install apache2=<complete version name>
Replace <complete version number> with the version number available for Ubuntu.
Example:
sudo apt install apache2=2.4.52-1+ubuntu20.04.1+deb.sury.org+1
Now the new version should reflect as shown below:
Server version: Apache/2.4.52 (Ubuntu)
Server built: 2021-12-20T21:07:12
That should do it!
Conclusion:
- Understanding the Apache version running on your server is crucial for maintenance and security.
- The commands provided enable you to check your Apache version and see the modules loaded quickly.
- Installing a specific version of Apache on Ubuntu can enhance compatibility with your web applications.
- Adding a third-party repository gives you access to a wider range of Apache versions.
- Regularly updating and managing your Apache installation is essential for optimal performance and security.
Leave a Reply