FedoraRHEL Based

How To Install Apache on Fedora 40

Install Apache on Fedora 40

In this tutorial, we will show you how to install Apache on Fedora 40. The Apache HTTP Server is the world’s most widely-used web server software. It powers millions of websites and web applications across the internet. If you’re running a Fedora 40 server, installing Apache allows you to host websites, deploy web apps, and leverage Apache’s robust feature set.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Apache web server on a Fedora 40.

Prerequisites

Before we dive into the installation process, ensure that you have the following prerequisites in place:

  • A server running one of the following operating systems: Fedora 40.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. Fedora provides the Terminal application for this purpose. It can be found in your Applications menu.
  • A stable internet connection to download the necessary packages.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Apache on Fedora 40

Step 1. Update the System.

Keeping your system packages up-to-date is crucial for security and stability. Use the DNF package manager to update all installed packages:

sudo dnf clean all
sudo dnf update

This fetches the latest versions of packages from the Fedora repositories and installs any available updates.

Step 2. Installing Apache HTTP Server on Fedora 40.

With your system updated, you can now install the Apache web server package:

sudo dnf install httpd

This command installs the httpd package, which is Fedora’s standard Apache package. During the installation, you might be prompted to approve the download and installation of dependencies, which are crucial for Apache to function correctly.

Even if Apache started automatically, it’s a good idea to verify its status and enable it to start on system boot:

sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl status httpd

The status command should show Apache running. If not, investigate any errors reported.

Step 3. Open Firewall for HTTP/HTTPS.

For remote clients to access your Apache web server, you need to open the HTTP (80) and HTTPS (443) ports on the firewall:

sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload

Verify the new rules are in place:

sudo firewall-cmd --list-all

Step 5. Test Apache.

With Apache installed and the firewall configured, you can test if it’s serving content by accessing the default Apache page. Using your server’s IP address or hostname, enter this in a web browser:

http://server_ip_or_hostname

You should see the Apache2 Test Page with the iconic “It works!” message. This confirms Apache is successfully installed and serving HTTP traffic.

Install Apache on Fedora 40

Step 6. Configure Apache.

While the default configuration is fine for testing, you’ll want to customize Apache for your production use case. This is done by modifying the main configuration file at /etc/httpd/conf/httpd.conf.

Some common configuration changes include:

  • Setting ServerAdmin and ServerName values
  • Changing Apache’s user/group
  • Configuring NameVirtualHost for name-based virtual hosts
  • Enabling additional modules (mod_ssl, php, etc.)

For example, to enable name-based virtual hosting, uncomment these lines:

#NameVirtualHost *:80

#Include conf.d/*.conf

After making changes, restart Apache for them to take effect:

sudo systemctl restart httpd

Congratulations! You have successfully installed Apache. Thanks for using this tutorial for installing the Apache web server on your Fedora 40 system. For additional or useful information, we recommend you check the official Apache website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button