How to install Apache in Mac and Linux?

Installing Apache from sources involves the following steps

  • Download Apache. Make sure that you download the source (stable version)
  • The downloaded file will be something like this httpd-x.x.x.tar.gz (where x.x.x is the Apache version)
  • Now execute the following commands
    • ./configure –prefix=/usr/local/apache2
    • make
    • sudo make install
  • If everything is installed fine, run the following command,
  • 
    /usr/local/apache2/bin/apachectl start
    
    (13)Permission denied: make_sock: could not bind to address [::]:80
    (13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    Unable to open logs
    
    

And you may be wandering why this error occurred. This is because opening any port between 0 and 1024 requires root access. Since 80 is a special port, you must use sudo to run the command

Now run the above command like this


sudo /usr/local/apache2/bin/apachectl start

To check whether everything is fine: Enter “http://localhost/index.html” in your browser.You will see the following output

It works!

And that’s it, the apache is up and running.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s