การติดตั้ง Apache


การติดตั้ง APACHE

Apache เป็นตัวที่ใช้ในการ ดูเวบ

ให้ใส่ CD แผ่นที่ 1 ใน เครื่อง Server และที่เครื่องลูกที่เราทำงาน ไปที่หน้าต่างของโปรแกรม putty

[root@one root]# mount /mnt/cdrom/
[root@one root]# cd /mnt/cdrom/RedHat/RPMS/
[root@one RPMS]# rpm -Uvh expat-1.95.2-2.i386.rpm
Preparing... ########################################### [100%]
1:expat ########################################### [100%]
[root@one RPMS]# cd ;eject

ต่อให้ใส่ CD แผ่นที่ 2 ใน เครื่อง Server และที่เครื่องลูกที่เราทำงาน ไปที่หน้าต่างของโปรแกรม putty

[root@one root]# mount /mnt/cdrom/
[root@one root]# cd /mnt/cdrom/RedHat/RPMS/
[root@one RPMS]# rpm -Uvh mm-1.1.3-4.i386.rpm
Preparing... ########################################### [100%]
1:mm ########################################### [100%]
[root@one RPMS]# rpm -Uvh apache-1.3.23-11.i386.rpm
Preparing... ########################################### [100%]
1:apache ########################################### [100%]
[root@one RPMS]# cd ; eject
[root@one root]#

ก็เป็นว่าการติดตั้ง apache เสร็จเรียบร้อย จากนั้น

เนื่องจากว่าผู้เขียน มีการทดลองทำ Server บ่อยๆ ดังนั้นจึงได้ย้ายที่เก็บ HomePage จาก /var/www ไปไว้ที่ /home/httpd
ทั้งนี้ก็เพื่อจะได้เก็บ HomePage เก่าเอาไว้เพราะว่า ใน Partition /home จะไม่มีการ Format อีกต่อไป จึงต้องมีการ config
แฟ้มที่เกี่ยวข้องคือ httpd.conf โดยใช้คำสั่ง

[root@one root]# vi /etc/httpd/conf/httpd.conf

#ServerName localhost
ServerName www.abcdef.com ; เดิมเป็น localhost
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/home/httpd/html" ; เดิมเป็น /var/www/html

# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/home/httpd/html"> ; เดิมเป็น /var/www/html

ยังมีอีกหลายๆที่ในแฟ้มนี้หมายถึงว่าให้แก้ จากเดิมซึ่งเป็น /var/www ให้แก้เป็น /home/httpd ให้หมดทั้งแฟ้ม

จากนั้นให้ทำการ copy จาก /var/www ไปไว้ที่ /home/httpd โดย

[root@one root]# cp -R /var/www/ /home/httpd

เมื่อเรียบร้อยก็สั่ง run โดย /etc/init.d/httpd start

[root@one root]# /etc/init.d/httpd start
Starting httpd: [ OK ]
[root@one root]#

จากนั้นสิ่งที่ตามมาหลังจากการเปลี่ยนที่อยู่ข้องเวบ มี file ที่เกี่ยวข้องต้องเปลี่ยนตามคือ

[root@one root]# cd /etc
[root@one etc]# vi webalizer.conf

โดยที่ให้แก้ จากเดิมซึ่งเป็น /var/www ให้แก้เป็น /home/httpd ให้หมดทั้งแฟ้ม
จากนั้นก็แก้แฟ้ม mrtg.cfg ในทำนองเดียวกัน

[root@one etc]# cd /etc/mrtg/
[root@one mrtg]# vi mrtg.cfg

ก่อนที่เราจะเข้าขอดูเวบ เราจะมาทำ Proxy จาก Squid ก่อนในลำดับต่อไป

|BACK|. : : By Mr.Sontaya
Hosted by www.Geocities.ws

1