22 C
Texas
Mel K
LInux Guru and Technical Writer

Guide to install Apache HTTP server manually

 

What is Apache HTTP Server

The Hypertext Transfer Protocol (HTTP) is an application protocol for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, where hypertextdocuments include hyperlinks to other resources that the user can easily access, for example by a mouse click or by tapping the screen in a web browser.

How to get installation packages

Apache server require few dependent package like

  • apr
  • apr-util
  • pcre
  • expat

Download httpd from below mentioned link

- Advertisement -

https://httpd.apache.org/download.cgi

OR

Download directly by shared links

https://www-eu.apache.org/dist//httpd/httpd-2.4.39.tar.gz

Download apr and apr util from below mentioned link

https://apr.apache.org/download.cgi

OR

Download directly by shared links
https://www-us.apache.org/dist//apr/apr-1.7.0.tar.gz
https://www-us.apache.org/dist//apr/apr-util-1.6.1.tar.gz

Installation

First install dependent packages

yum install expat-devel.x86_64  -y
yum install pcre-devel.x86_64  -y

Now go to the directory containing packages and extract the downloaded packages

[root@myserver2 httpd_packages]# tar -xvzf httpd-2.4.39.tar.gz

[root@myserver2 httpd_packages]# tar -xvzf apr-util-1.6.1.tar.gz

[root@myserver2 httpd_packages]# tar -xvzf apr-1.7.0.tar.gz

Now go to APR directory and start installing APR

[root@myserver2 apr-1.7.0]# ./configure --prefix=/usr/local/apr

[root@myserver2 apr-1.7.0]# make
[root@myserver2 apr-1.7.0]# make install

If you will see output without errors .Congratulations you have installed apr package

Now go to APR-util directory and start installing it. You should add APR path while installation of APR util.

Syntax to include APR path is

. /configure –with-apr=path to apr directory

[root@myserver2 apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/

Now run following commands

make
make install

If your output has no errors. Congratulations you have installed apr-util.

lets start with installation of Apache web-server.

First download httpd source. I am using wget to download  httpd source. You can use wget ,curl or directly download from httpd homepage.

After extracting the tar file. Go to extracted directory and configure httpd server.

./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr/ --with-apr=/usr/local/apr-util

After successful completion of above step. Now run the following commands to install httpd

make
make install

If every thing goes fine. configurations you have successfully installed Apache web server from source file.

Go to  /usr/local/apache/conf/ and open file httpd.conf

httpd.conf file contain all the configuration required to run httpd server.

Search for listen 80
Default port for Apache is port 80. If you want to change the port replace 80 by any available port.
like i am using Port 8080 for httpd server.

Note : You can skip below mentioned step

Go to htdocs directory and make change in index.html file and write following line in it

Congratulations you have installed Apache webserver. it is working on port 8080

How to start httpd server

Move to  /usr/local/apache/bin directory and run following command

./apachectl start

Now find the process is running use following command

ps -ef |grep httpd

you will see output like

root 11027 1 0 02:50 ? 00:00:00 /usr/local/apache/bin/httpd -k start
daemon 11028 11027 0 02:50 ? 00:00:00 /usr/local/apache/bin/httpd -k start
daemon 11029 11027 0 02:50 ? 00:00:00 /usr/local/apache/bin/httpd -k start
daemon 11030 11027 0 02:50 ? 00:00:00 /usr/local/apache/bin/httpd -k start
root 11120 1618 0 02:50 pts/0 00:00:00 grep --color=auto httpd

use the below mentioned url in your browser to test httpd server

http://localhost:8080

I am using elinks browser. You can install elinks browser

Elinks

Links is a text mode WWW browser, supporting colors, table rendering, background downloading, menu driven configuration interface, tabbed browsing and slim code.Frames are supported. You can have different file formats associated with external viewers. mailto: and telnet: are supported via external clients. ELinks can handle both local files and remote URLs. The main supported remote URL protocols are HTTP, HTTPS (with SSL support compiled in) and FTP. Additional protocol support exists for BitTorrent finger, Gopher, SMB and NNTP. The homepage of ELinks can be found at http://elinks.cz where the ELinks manual is also hosted.

You you want to use elinks . Use following command

elinks http://localhost:8080

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article