Install http Apache server using dnf on Fedora / Redhat / CentOS

Install http Apache server

To install http Apache server you will use dnf command

Syntax

sudo dnf install httpd

Running this command will install basic packages required for working of http server

Install httpd Apache server using dnf command
Installation of http server using DNF command

Enabling Apache http server to start on Boot

After installation of http server, you will have to start service and enable httpd service so as it starts at every boot.

Start httpd service

After installation http service does not start on its own, it need to be started with below command

Syntax

sudo systemctl start httpd

Enable httpd service

Once started you will also need to enable httpd service to start on boot

Syntax

sudo systemctl enable httpd

Note: enabling service doesn’t mean service will start in current session. To start in current session use command sudo systemctl start httpd .

Configure firewall to allow Apache http

Firewall needs to be configured before you can use http service on network. If you want to use http and https both, you will have enable them. Use below command which sets firewall to allow http and https to work through it.

Syntax

sudo firewall-cmd --add-service http --add-service https --permanent
enable http service to work through firewall using firewall-cmd command

You will get success message once it has been enabled.

Testing of your http Apache server

Testing of your http server can be done on browser. Enter http://localhost/ on browser of your local system. If you are testing from any other computer on your network then enter http://ip_address of your system. Initial home page will be default Web Server test page. Below is my server test page

Default Web server test page