colorful

zc qq:1337220912

 

postgresql安装


下载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


posted on 2012-05-30 16:48 多彩人生 阅读(417) 评论(0)  编辑 收藏 引用 所属分类: postgresql


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

统计

常用链接

留言簿(3)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜