red hat 5中安装postgresql 8.2.4
从
http://www.postgresql.org下载posgtgresql源码.(8.2.4版)
将postgresql-8.2.4.tar.gz文件下载到usr/install中
按./configure --enable-nls
make
出现两个错误,由于以前装FC6没有问题.又去下了RPM包,但显示没有libpq.5.0,去下了一个回来放到/usr/lib中,安装RPM还是不正常.
重新安装了源码,正常了.整个过程可能需要5 分钟到半小时。要有耐心.显示的最后一行应该是All of PostgreSQL is successfully made. Ready to install.
最后是安装make install
(后来使用49af89414d147589 安装AS版没有出现这样的问题)
创建一个postgres的帐户
然后用gedit创建一个postgresql-backins.sh
mkdir /usr/local/pgsql/data
chown postgres /usr/local/pgsql/data
su postgres
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data start
如果不行就手工在终端中一行一行运行
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ -l logfile stop 这是手工停止的方法
自启动的方法
cd 安装目录/postgresql-8.2.4/contrib/start-scripts
su root
cp linux /etc/rc.d/init.d/postgresql //把linux改名为postgresql拷贝到启动脚本目录。
cd /etc/rc.d/init.d
chmod +x postgresql //使脚本具有可执行权
su root
cp linux /etc/rc.d/init.d/postgresql //把linux改名为postgresql拷贝到启动脚本目录。
cd /etc/rc.d/init.d
chmod +x postgresql //使脚本具有可执行权
cd /etc/rc.d/rc3.d
ln -sf /etc/rc.d/init.d/postgresql /etc/rc.d/rc3.d/S91postgresql
ln -sf /etc/rc.d/init.d/postgresql /etc/rc.d/rc3.d/K91postgresql
然后[系统]-->[管理]-->[服务器设置]-->[服务]
可以看到postgresql已经在后台服务中.选择自启动,点开始,出现成功字样
cd /usr/local/pgsql/bin
su postgres
./psql
可以连上去了
如果要远程通过TCP/IP来访问Postgresql数据库
修改数据库配置文件 pg_hba.conf
#gedit /var/database/pgsql/data/pg_hba.conf补充如下
host all all 192.168.0.0/24 trust
host all all 192.168.23.53/32 trust