09 มกราคม 2552

ติดตั้ง PostgreSQL บน CentOS 5.1,5.2

สรุปขั้นตอนการติดตั้ง PostgreSQL บน CentOS 5.1,5.2
1. install cent os 5.1 (Install แบบ Graphic) ให้เสร็จ
2. vi /etc/sysconfig/i18n
แก้ไขค่า en_EN เป็นค่า th_TH
3. ติดตั้ง font ภาษาไทย มีขั้นตอนดังนี้
1. เปิด terminal ขึ้นมาครับ
2. เปลี่ยนไปยัง directory ที่ต้องการ แล้วพิมพ์คำสั่งดังนี้ครับ
3. wget ftp://linux.thai.net/pub/ThaiLinux/software/thai-ttf/thai-ttf-0.4.6.tar.gz
4. tar xvfz thai-ttf-0.4.6.tar.gz
5. cd thai-ttf-0.4.6
6. mkdir /usr/share/fonts/thai-ttf
7. cp *.* /usr/share/fonts/thai-ttf/
8. chkfontpath –a /usr/share/fonts/thai-ttf
9. restart เครื่อง หรือพิมพ์คำสั่ง init 6
4. wget http://yum.pgsqlrpms.org/reporpms/8.3/pgdg-centos-8.3-4.noarch.rpm
5. rpm -ivh pgdg-centos-8.3-4.noarch.rpm
6. yum install postgresql postgresql-server postgresql-libs postgresql-devel postgresql-phppgadmin
7. chkconfig postgresql on
8. service postgresql initdb
9. chkconfig postgresql on
10. service postgresql start
11. กำหนดค่าของ postgresql โดยเปิด terminal แล้วพิมพ์คำสั่งดังนี้
# su - postgres
$ cd data
$ vi pg_hba.conf แก้ไขค่าใน IPv4 local connections:
จะมีบรรทัด host all all 127.0.0.1/32 ident sameuser
เพิ่มบรรทัดใหม่ต่อท้าย คือ host all all 192.168.0.0/24 password
(แก้ไข 192.168.0.0 ให้เป็น IP ใน Local ที่ใช้งาน)
$ vi postgresql.conf แก้ไขค่าตามนี้
บรรทัด #listen_addresses = 'localhost' ให้เอาเครื่องหมาย # ออก แล้วเปลี่ยน 'localhost' ให้เป็น '*'
บรรทัด #port = 5432 ให้เอาเครื่องหมาย # ออก
$ psql -c "ALTER USER postgres WITH PASSWORD 'platinum' " -d template1
$ exit
#_
12. service postgresql restart
13. กำหนดค่า IPTABLE ให้เปิด port 5432 เพื่อให้ client สามารถ access เข้ามาใช้งาน server ได้ ดังนี้
# vi /etc/sysconfig/iptables
เพิ่มบรรทัด -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT ต่อท้าย
# service iptables restart
14. #yum install php --enablerepo=centosplus