HowTo: Install And Start The Apache or Httpd Service Under Linux

How do I install and start the Apache or httpd web server under Fedora or RHEL or Red Hat / CentOS Linux?

Apache HTTP Server is a free software/open source web server for Unix-like systems and other operating systems.
Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements Apache
Est. reading time N/A
Apache features configurable error messages, DBMS-based authentication databases, and content negotiation. It is also supported by several graphical user interfaces (GUIs) which permit easier, more intuitive configuration of the server.

Use rpm command to install the Apache server under Linux. You can also use up2date or yum command to install the same.

Task: Install Apache/httpd under Fedroa Core/Cent OS Linux

Type the following command if you are using Fedora / RHEL / Cent OS Linux, run:
# yum install httpd
To start the Apache/httpd, run:
# chkconfig httpd on
# /etc/init.d/httpd start

Task: Install Apache/httpd under Red Hat Enterprise Linux

Type the following command:
# up2date httpd
# yum install httpd
To start the Apache/httpd, run:
# chkconfig httpd on
# /etc/init.d/httpd start

Task: Debian Linux httpd/Apache installation

Use the apt-get command:
# apt-get install apache2
# /etc/init.d/apache2 start

Task: Verify that port 80 is open

# netstat -tulpn | grep :80

You can also install httpd from CDROM with rpm command:
# rpm -ivh httpd*

Task: Store files / upload files for your web site

  1. You need to upload files at /var/www/html under RHEL / CentOS / Fedora Linux operating system.
  2. You need to upload files at /var/www/ under Debian or Ubuntu Linux operating system.

Apache Server configuration

Your server is started, but you need to configure and use Apache as per your requirement. /etc/httpd/conf/httpd.conf (RHEL/Cent OS/Fedora Core Linux) or /etc/apache2/httpd.conf (Debian / Ubuntu Linux) configuration file. Use a text editor such as vi to edit a file. This file is very well documented or read official Apache configuration documentation for more information.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 37 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
37 comments… add one
  • ahmad Oct 31, 2008 @ 10:00

    i have installed apache server by using this document

  • Pontus Mar 23, 2009 @ 19:12

    +1. Works like a charm. Thx.

  • yasaman Apr 14, 2009 @ 11:18

    i could install was very good

  • ej May 4, 2009 @ 13:40

    good but when you try of add a file, access denied message invokes :(

    • Bryce Mar 30, 2014 @ 23:53

      use sudo

  • fadl Jul 23, 2009 @ 6:16

    it works, tks :)

  • sagar Jul 26, 2009 @ 18:51

    good but when you try of add a file, access denied message . for root
    pl say proplay

  • nolan Sep 17, 2009 @ 13:03

    this could really use some more obvious points that noobs need, every cmd i typed in, that i found in this article, all i got was “command not found” im using centos 5.

    • Amar Jun 8, 2010 @ 11:15

      Nice One

  • gozen Sep 26, 2009 @ 10:12

    Can I ask what about the integration with PHP and My SQL?
    I use debian base…

  • Anonymous Mar 17, 2010 @ 3:16

    u saved my ass

  • jay Sep 3, 2010 @ 5:59

    hai sir i want to use all windows softwear in linux !
    so what can i do for use .exe file in linux pleas sir
    tell me about this

    • Anonymous Mar 2, 2011 @ 15:38

      Why would you want to use Windows based applications in Linux?, it defeats the object of open source and there is no benifit to this at all.
      If you really do have a need though, you can use wine to run your windows applications in Unix, and something like Samba for mounting files held on other MS servers
      This sounds beyond your current level of experience though from what I can see

      • jay Apr 23, 2011 @ 6:44

        I want to install wine but i can`t install. So can you send me how to install wine in linux 5.4 pleas sir

  • sh Dec 10, 2010 @ 16:15

    very useful post. thanks. i never knew that there is no httpd on debian..but now it’s clear. how to install “service” that we can do service apache2 restart? instead /etc/init.d…

  • Mohd Adil Apr 18, 2011 @ 22:19

    ./configure –prefix=/opt/apps/metatax/apache –with-mpm=worker –enable-so –enable-mods-shared=all –enable-ssl –enable-rewrite –enable-proxy
    compile with it

  • Joseph Apr 15, 2012 @ 7:34

    Great and very helpful thanks for sharing

  • mohamd Apr 16, 2012 @ 14:15

    Thank you …
    Good Luck ….

  • Edmund May 29, 2012 @ 3:38

    This is priceless information! I’ve only just begun using Linux Fedora ver.16 and I wanted to get my hands dirty with Apache……now….thanks to your article I can actually say “Yes….I HAVE installed / built an Apache server” that should do wonders for my resume….now if I can just figure out exactly where the hosts file is for setting up a web-site…..LoL!

    Thanx Again! You guys rock!!

    • ijat Nov 6, 2012 @ 20:06


      • Edmund Feb 14, 2013 @ 4:05

        @ijat: Thanks so much!


        EGO II

  • Daniel Ibañez Jun 20, 2012 @ 9:48

    Gracias conciso y eficiente

  • rush Aug 11, 2012 @ 10:05


    how i can use it as reverse proxy ?

  • Eswaran K Aug 14, 2012 @ 16:11

    ok but these is a temperuary solution

  • kiran Feb 13, 2013 @ 9:22

    Thank You……………..

  • kiran Feb 14, 2013 @ 8:32

    i have installed apache server by using this document

  • Best Feb 20, 2013 @ 0:49

    +2. Works like a charm. Thx.

  • Salim Apr 22, 2013 @ 23:58

    Nice tutorial ..
    I have new VPS server tried to make Apache work
    but page still not loading could this be related to CSF Firewall setting .

  • kamlesh gour May 15, 2013 @ 14:34


    my problem is…
    that i want to kaunch the website (JAVA/Mysql) and i have purchased the VPS 1
    Plan but not proved apache and mysql s/w (Only proved empty sever with cpanel)
    so how cant launch my this web site
    please guide me
    my server console
    [root@vps ~]#

  • DanIT Aug 18, 2013 @ 15:48

    Thanks, this helped me greatly setting up an Apache server for a college assignment.

  • joe Dec 10, 2013 @ 21:35

    I’m installed the apache2 v2,2,32
    But the modules folder is empty
    used the command ./configure –prefix=/ora/apache2 with-mpm=preforked –with-includes=apr

    I tried installing both as root and service user. Any ideas?

  • reshma Apr 14, 2014 @ 6:46

    [root@dhcppc2 ~]# yum install httpd
    Loading “rhnplugin” plugin
    Loading “security” plugin
    Loading “installonlyn” plugin
    This system is not registered with RHN.
    RHN support will be disabled.
    Setting up Install Process
    Setting up repositories
    No Repositories Available to Set Up
    Reading repository metadata in from local files
    Parsing package install arguments
    Setting up repositories
    No Repositories Available to Set Up
    Reading repository metadata in from local files
    No Match for argument: httpd
    Nothing to do
    [root@dhcppc2 ~]#
    what shoul di do ?

  • Muskan May 19, 2015 @ 16:47

    when i write #yum install httdp…then after some time there is written Error:cannot load services ?????

    • dhirajkumar Jul 5, 2015 @ 12:02

      use systemctl command for start the service

  • Dhirajkumar Jul 5, 2015 @ 11:58

    now in Rhel7 command are change

    systemctl enable

    systemctl start

  • Kazuki Nguyen Jul 7, 2015 @ 3:22

    This is so useful. I have worked well with Apache by following this guide.

  • Randitha Vernon Jan 2, 2016 @ 17:52

    Greatly helped.
    ease and accurate.. I am done with this doc. for Apache installation.

    Thank You

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum