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

Posted on in Categories , last updated January 17, 2013

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.

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
OR
# 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.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

Share this on (or read 37 comments/add one below):

37 comment

    1. 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

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

  2. 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!!

  3. hello,

    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
    [[email protected] ~]#

  4. 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?

  5. [[email protected] ~]# 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
    [[email protected] ~]#
    what shoul di do ?

Leave a Comment