{"id":368,"date":"2011-02-25T22:44:22","date_gmt":"2011-02-25T14:44:22","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=368"},"modified":"2023-04-28T09:50:41","modified_gmt":"2023-04-28T09:50:41","slug":"how-to-install-apache-httpd-web-server-on-linux","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-apache-httpd-web-server-on-linux\/","title":{"rendered":"How to Install Apache Httpd Web Server on Linux"},"content":{"rendered":"<p>Apache HTTP Server, often referred to as Apache or httpd, is a widely used open-source web server software. It is known for its flexibility, reliability, and ease of use, making it an ideal choice for hosting websites on Linux systems.<\/p>\n<p>In this guide, we will walk through the steps to install Apache HTTP Server on a Linux system. By following these steps, you will set up a functional Apache web server that can host your website or web application. The goal is to have a running Apache web server accessible via a web browser.<\/p>\n<h2>Step 1: Update your system<\/h2>\n<p>Before installing the Apache HTTP Server, ensure that your system&#8217;s package list and installed packages are up to date:<\/p>\n<pre>\r\nsudo apt update && sudo apt upgrade\r\n<\/pre>\n<p>This command will work for Debian-based systems like Ubuntu. For other Linux distributions, replace apt with the appropriate package manager, such as yum for RHEL\/CentOS, or dnf for Fedora.<\/p>\n<h2>Step 2: Install Apache HTTP Server<\/h2>\n<p>Now that your system is up to date, install the Apache HTTP Server package:<\/p>\n<p>For RHEL-based systems (RHEL, CentOS):<\/p>\n<pre>\r\nsudo yum install httpd\r\n<\/pre>\n<p>For Fedora:<\/p>\n<pre>\r\nsudo dnf install httpd\r\n<\/pre>\n<p>For Debian-based systems (Ubuntu, Debian):<\/p>\n<pre>\r\nsudo apt install apache2\r\n<\/pre>\n<p>Wait for the installation process to complete.<\/p>\n<p>Like that:<\/p>\n<pre>\r\n[root@server \/]# yum install httpd\r\nLoaded plugins: fastestmirror\r\nLoading mirror speeds from cached hostfile\r\n * addons: mirror.oscc.org.my\r\n * base: mirror.oscc.org.my\r\n * extras: centos.maulvi.net\r\n * updates: centos.maulvi.net\r\naddons                                                       |  951 B     00:00\r\nbase                                                         | 2.1 kB     00:00\r\nextras                                                       | 2.1 kB     00:00\r\nkbs-CentOS-Extras                                            | 1.9 kB     00:00\r\nkbs-CentOS-Testing                                           | 1.9 kB     00:00\r\nupdates                                                      | 1.9 kB     00:00\r\nSetting up Install Process\r\nResolving Dependencies\r\n--> Running transaction check\r\n---> Package httpd.i386 0:2.2.3-43.el5.centos.3 set to be updated\r\n--> Finished Dependency Resolution\r\n\r\nDependencies Resolved\r\n\r\n====================================================================================\r\n Package        Arch          Version                        Repository        Size\r\n====================================================================================\r\nInstalling:\r\n httpd          i386          2.2.3-43.el5.centos.3          updates          1.2 M\r\n\r\nTransaction Summary\r\n====================================================================================\r\nInstall       1 Package(s)\r\nUpgrade       0 Package(s)\r\n\r\nTotal download size: 1.2 M\r\nIs this ok [y\/N]: y\r\nDownloading Packages:\r\nhttpd-2.2.3-43.el5.centos.3.i386.rpm                         | 1.2 MB     00:22\r\nRunning rpm_check_debug\r\nRunning Transaction Test\r\nFinished Transaction Test\r\nTransaction Test Succeeded\r\nRunning Transaction\r\n  Installing     : httpd                                                        1\/1\r\n\r\nInstalled:\r\n  httpd.i386 0:2.2.3-43.el5.centos.3\r\n\r\nComplete!\r\n[root@server \/]# \/etc\/rc.d\/init.d\/httpd start\r\nStarting httpd:                                            [  OK  ]\r\n[root@server \/]# chkconfig httpd on\r\n\r\n<\/pre>\n<h2>Step 3: Start and enable the Apache service<\/h2>\n<p>Once installed, start the Apache HTTP Server service and enable it to start automatically at boot:<\/p>\n<p>For Debian-based systems (Ubuntu, Debian):<\/p>\n<pre>\r\nsudo systemctl start apache2\r\nsudo systemctl enable apache2\r\n<\/pre>\n<p>For RHEL-based systems (RHEL, CentOS) and Fedora:<\/p>\n<pre>\r\nsudo systemctl start httpd\r\nsudo systemctl enable httpd\r\n<\/pre>\n<h2>Step 4: Configure firewall settings<\/h2>\n<p>To allow incoming HTTP and HTTPS traffic, update your firewall settings:<\/p>\n<p>For Debian-based systems (Ubuntu, Debian):<\/p>\n<pre>\r\nsudo ufw allow 'Apache'\r\n<\/pre>\n<p>For RHEL-based systems (RHEL, CentOS) and Fedora:<\/p>\n<pre>\r\nsudo firewall-cmd --permanent --add-service=http\r\nsudo firewall-cmd --permanent --add-service=https\r\nsudo firewall-cmd --reload\r\n<\/pre>\n<h2>Step 5: Verify the Apache installation<\/h2>\n<p>To verify that the Apache HTTP Server is running, open a web browser and visit your server&#8217;s IP address or domain name:<\/p>\n<pre>\r\nhttp:\/\/your_server_ip_or_domain_name\r\n<\/pre>\n<p>You should see the Apache default welcome page.<\/p>\n<h2>Programs Mentioned:<\/h2>\n<ul>\n<li><span class=\"fw-bold\">Apache HTTP Server (httpd)<\/span> &#8211; An open-source web server software that provides a secure, efficient, and extensible server for hosting websites and web applications.<\/li>\n<li><span class=\"fw-bold\">systemctl<\/span> &#8211; A command-line utility for managing and controlling systemd-based services, including starting, stopping, and enabling services to run at boot.<\/li>\n<li><span class=\"fw-bold\">ufw<\/span> &#8211; Uncomplicated Firewall, a user-friendly front-end for managing iptables firewall rules on Debian-based systems.<\/li>\n<li><span class=\"fw-bold\">firewall-cmd<\/span> &#8211; A command-line utility for managing firewalld, the default firewall management tool for RHEL-based systems and Fedora.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>In this guide, you have successfully installed and configured the Apache HTTP Server on your Linux system. You can now host websites and web applications using the Apache web server, ensuring they are accessible via a web browser. Going forward, you may want to explore more advanced configurations, such as setting up virtual hosts for hosting multiple websites, enabling SSL\/TLS for secure connections, or optimizing your server for improved performance.<\/p>\n<p>As you gain experience with the Apache HTTP Server, you can further customize its configuration to suit your specific needs, whether it&#8217;s for a personal website or a large-scale enterprise application.<\/p>\n<p>Feel free to share your thoughts, comments, or suggestions for improvements to this guide. Your feedback is crucial in helping us provide the most accurate and useful information possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache HTTP Server, often referred to as Apache or httpd, is a widely used open-source web server software. It is known for its flexibility, reliability, and ease of use, making&#8230;<\/p>\n","protected":false},"author":6,"featured_media":369,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[996],"tags":[1536],"class_list":["post-368","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-linux"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/368","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=368"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/368\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/369"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}