Wednesday, May 6, 2009

Installing webserver on linux.

1- Check if httpd is running on the box or not

[root@mrbu-devtest html]# netstat -tunlp | grep 80
tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN 7042/Xvnc
tcp 0 0 0.0.0.0:5802 0.0.0.0:* LISTEN 28998/Xvnc
tcp 0 0 0.0.0.0:5803 0.0.0.0:* LISTEN 29895/Xvnc
tcp 0 0 0.0.0.0:5804 0.0.0.0:* LISTEN 1446/Xvnc
tcp 0 0 0.0.0.0:5805 0.0.0.0:* LISTEN 1572/Xvnc
tcp 0 0 0.0.0.0:5807 0.0.0.0:* LISTEN 28971/Xvnc
tcp 0 0 0.0.0.0:5808 0.0.0.0:* LISTEN 29093/Xvnc
tcp 0 0 0.0.0.0:5809 0.0.0.0:* LISTEN 6434/Xvnc
tcp 0 0 127.0.0.1:6012 0.0.0.0:* LISTEN 28075/31
tcp 0 0 :::80 :::* LISTEN 20792/httpd
tcp 0 0 ::1:6012 :::* LISTEN 28075/31
[root@mrbu-devtest html]#

the httpd will not be there if the server is not running.

2- if suppose httpd is coming we can check if this service is running or not.

[root@mrbu-devtest ~]# /sbin/service httpd start
httpd: unrecognized service
[root@mrbu-devtest ~]#


Unrecognized service will come if httpd is not installed.
else the output will come like this

[root@mrbu-devtest ~]# /sbin/service httpd start
Starting httpd: [ OK ]
[root@mrbu-devtest ~]#


3- Let's install the server on linux.
if you've connectivity to internet just do this

[root@mrbu-devtest ~]# uname -a
Linux mrbu-devtest 2.6.9-42.7.ELsmp #1 SMP Tue Sep 5 18:29:39 EDT 2006 i686 i686
i386 GNU/Linux
[root@mrbu-devtest ~]#
[root@mrbu-devtest ~]# yum install httpd
Setting up Install Process
Setting up repositories
emergency-install 100% |=========================| 1.1 kB 00:00
psec-tools 100% |=========================| 951 B 00:00
engineering-install 100% |=========================| 1.1 kB 00:00
engineering-update 100% |=========================| 1.1 kB 00:00
desktop-install 100% |=========================| 1.1 kB 00:00
base 100% |=========================| 1.1 kB 00:00
desktop-update 100% |=========================| 1.1 kB 00:00
cisco-linux-common 100% |=========================| 1.1 kB 00:00
emergency-update 100% |=========================| 1.1 kB 00:00
cisco-linux-desktop 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
...
...
...
once this is done.

now we have to start the webservice
[root@mrbu-devtest ~]# /sbin/service httpd start
Starting httpd: [ OK ]
[root@mrbu-devtest ~]#

4- Add or edit a WebPage.

[root@mrbu-devtest httpd]# cd /var/www/html/
[root@mrbu-devtest html]# ls
[root@mrbu-devtest html]# vi index.html
[root@mrbu-devtest html]#
[root@mrbu-devtest html]# cat index.html
!!!Woo it's working !!!
[root@mrbu-devtest html]#
<br />


No comments:

Post a Comment