由于升级后新电脑的性能强劲,可以用vmware虚拟机更好的学习debian了,今天尝试安装PostgreSQL-8.4,不过在输入
apt-cache search postgresql
都只是找到postgresql-8.3版本,于是上网google后,在
/etc/apt/sources.list 加上
deb http://debian.cn99.com/debian/ unstable main
就可以了,原来lenny是不存在postgresql-8.4的.
然后
apt-get install postgresql-8.4
这样就ok了。
还要打开debian的防火墙, 我在我的/etc/firewall.sh 防火墙脚本里加上了
iptables -A FIREWALL -p tcp -m tcp –dport 5432 –syn -j ACCEPT
iptables -A FIREWALL -p udp -m udp –sport 5432 -j ACCEPT
这样postgresql的5432端口就打开了
然后去安装pqadmin III,网址
http://www.pgadmin.org/download/windows.php
这是window版的,在win xp安装后,然后去虚拟机里的debian
vim /etc/postgresql/8.4/main/pg_hba.conf
找到# IPv4 local connections: 这行下的,然后修改
host all all 192.168.0.0/24 trust
家里的服务器网段是192.168.0.0段的,如果是192.168.1.0段就修改成
host all all 192.168.1.0/24 trust
其它类似
然后继续
vim /etc/postgresql/8.4/main/postgresql.conf
将
#listen_addresses = ‘localhost’
改为
listen_addresses = ‘*’
然后
/etc/init.d/postgresql-8.4 restart
跟着到windows那边打开pgadmin III , 在菜单上选择: 文件=>添加服务器

名称乱填,我填了ufo, 主机填你服务器地址,我的是192.168.0.28 , 按确定,跟住有其它窗口弹出,继续确定按钮,这样就可以连接了, 这是非密码连接的.
修改用户密码的话,点击登录角色,指着postgres鼠标右键属性,出现以下窗口,这样就可以修改密码了.

然后去debian里
vim /etc/postgresql/8.4/main/pg_hba.conf
把之前的
host all all 192.168.1.0/24 trust
改为
host all all 192.168.1.0/24 md5
继续
etc/init.d/postgresql-8.4 restart
这样用pgadmin III 登录就变为需要密码登录了
好,大概啰嗦到此
参考资料
http://database.e800.com.cn/articles/2008/37/1204839953638799581_1.html
http://www.blogjava.net/zhyiwww/archive/2009/03/18/260524.html