การติดตั้ง PostgreSQL ผ่าน Ports บน freebsd8.2
#cd /usr/ports/databases/postgresql91-server #make #make install
Add this line to /etc/rc.conf:
postgresql_enable="YES"
Next, initialize a PostgreSQL database cluster:
#/usr/local/etc/rc.d/postgresql initdb
Now add this line to /usr/local/pgsql/data/postgresql.conf:
listen_addresses = '*'
Thirdly, add this line to /usr/local/pgsql/data/pg_hba.conf:
host all all 192.168.1.0/24 trust
Reboot. Now let’s create a new user for our PostgreSQL database:
#su pgsql $ createuser -sdrP username Enter password for new role: ****** Enter it again: ****** $ exit
Finally, we need to install psycopg2 client in order to be able to connect to the PostgreSQL server from a Django web application.
#pip install psycopg2 #/usr/local/sbin/apachectl restart
Cool. Now you should be able to connect to the PostgreSQL server from your Django app. Make sure to create a database first:
#su pgsql $ createdb myapp $ exit
ที่มา :: http://blog.richardknop.com/2012/01/install-postgresql-on-freebsd-8-2-and-make-it-work-with-django/
Off
15
Mar