下載postgresql-9.1.3.tar.bz2
解壓tar -vxf postgresql-9.1.3.tar.bz2
安裝
./configure –without-readline –without-zlib
make
su
make install
設置
mkdir /home/zc/postgresql/data
chown postgres /home/zc/postgresql/data
su - postgres
/usr/local/gpsql/bin/initdb -D /home/zc/postgresql/data
/usr/local/gpsql/bin/postgres -D /home/zc/postgresql/data >logfiel 2>&1 &
/usr/local/pgsql/bin/createdb test
/usr/local/pgsql/bin/psql test // 這里修改postgres的密碼,
test=# ALTER USER postgres WITH PASSWORD ‘postgres’;
test=# \q
修改系統用戶postgres的密碼(注意,上面的是數據庫用戶,這個是debian用戶, 將它們密碼設為相同的)
root@ubuntuserver:~# sudo passwd -d postgres
root@ubuntuserver:~# sudo -u postgres passwd
修改配置文件
cd /home/zc/postgresql/data
vim postgresql.conf
找到listen_address=’localhost’, 將前面的注釋去掉,并把’localhost’該為’*’。
vim pg_hba.conf
在后面加上
host all all 192.168.0.0/24 password
這句的意思是:同網絡中192.168.0.*的機器可以以密碼的形式使用所有的數據庫。更具體的參數意義直接看該配置文件中的注釋就可以了
配置好后重起數據庫
/usr/local/pgsql/bin/pg_ctl stop -D /home/zc/postgresql/data
/usr/local/gpsql/bin/postgres -D /home/zc/postgresql/data >logfiel 2>&1 &
Ok
查看是否有開啟監聽
netstat -plunt | grep 5432
-----------------------------------------------------------
mkdir -p /data/postgres
ln -s /data/postgres/ /home/
groupadd postgres
useradd -d /home/postgres -g postgres postgres
chown -R postgres:postgres /data/postgres/
su - postgres -c "/usr/local/services/postgresql/bin/initdb -A md5 --locale=en_US.utf8 --lc-ctype=en_US.utf8 -E UTF-8 -W /data/postgres"
mkdir /data/postgres/pg_log
chown -R postgres:postgres /data/postgres/pg_log