ติดตั้ง Postgres ลงบน Ubuntu 9.04 อย่างง่ายและรวดเร็ว

ตุลาคม 17th, 2009 Kowit Leave a comment Go to comments

ผมมีปัญหากับการติดตั้ง postgres มาตลอด เมื่อเปรียบเทียบกับ mysql แล้วพบว่ายุ่งยากมาก ลองใช้วิธีต่อไปนี้ทำให้ติดตั้ง postgres ภายในสามนาที!!

sudo apt-get install postgresql pgadmin3 python-psycopg2

หลังจากรอขั้นตอนการติดตั้งจนเสร็จเรียบร้อยแล้วให้ตั้งรหัสผ่านให้กับ user postgres เพื่อไปติดตั้งส่วนอื่นๆต่อไปดังนี้

sudo -u postgres psql

postgres=# \password postgres
postgres=# \q

ได้รหัสผ่านของ user postgres แล้ว!!
อย่าลืมแก้ไฟล์ sudo nano /etc/postgresql/8.3/main/pg_hba.conf ตรงบรรทัด

# "local" is for Unix domain socket connections only
local   all         all                               ident sameuser
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

เป็น

# "local" is for Unix domain socket connections only
local   all         all                               md5
# IPv4 local connections:
host    all         all         127.0.0.1/32          md5
# IPv6 local connections:
host    all         all         ::1/128               md5

เมื่อได้รหัสผ่านก็สามารถ login ผ่าน pgadmin ได้แล้ว เร็วใหม?

Categories: Programming Tags: ,
  1. No comments yet.
  1. No trackbacks yet.