安装postgresql后启动不了,试过无数次.

由 buzzard 在 02-13-2004 11:55 发表:

安装postgresql后启动不了,试过无数次.

哪位老大可以给我一段postgresql的安装过程,及安装配置,安装后配置.


由 optix 在 02-14-2004 10:30 发表:


1.安装 PostgreSQL

useradd postgres (自动建立 postgres组)password:sqlpostgre

tar xvfz postgresql-7.4.1.tar.gz

cd postgresql-7.4.1

./configure --prefix=/usr/local/pgsql --enable-multibyte=EUC_CN(支持双字节)

make

make install

chown -R postgres.postgres /usr/local/pgsql

这样安装完毕后,并不是万事大吉了,还有一些收尾工作要做:

vi ~postgre/.bash_profile

添加:

PGLIB=/usr/local/pgsql/lib

PGDATA=/usr/local/pgsql/data

PATH=$PATH:/usr/local/pgsql/bin

export PGLIB PGDATA PATH

以 postgres 用户登录,

su - postgres

建立数据库目录:

$cd /usr/local/pgsql

$ mkdir data

启动数据库引擎:

$ initdb

出现如下字样就是好了。

/usr/local/pgsql/bin/postmaster -D /home/postgre/data

or

/usr/local/pgsql/bin/pg_ctl -D /home/postgre/data start

然后启动pgsql

$ postmaster -i -D ~/data &

使用脚本来使数据库服务器随系统启动而自动启动。在PostgreSQL的源码包的contrib/start-scripts目录下面我们可以看到freebsd linux PostgreSQL.darwin StartupParameters.plist.darwin 4个文件,这些文件时用来作为系统启动脚本的,在这里我们用linux来做说明。

在这里的操作使用你编译PostgreSQL数据库时的用户身份。

cd $HOME/src/postgresql-7.4/contrib/start-scripts

su //切换到root用户

cp linux /etc/rc.d/init.d/postgres //把linux改名为postgres拷贝到系统的启动脚本的目录。

cd /etc/rc.d/init.d

使用你熟习的编辑器来编辑postgres启动脚本。

29 ## EDIT FROM HERE

30

31 # Installation prefix

32 prefix=/usr/local/pgsql

33

34 # Data directory

35 PGDATA="/usr/local/pgsql/data"

36

37 # Who to run pg_ctl as, should be "postgres".

38 PGUSER=postgres

39

40 # Where to keep a log file

41 PGLOG="$PGDATA/serverlog"

42

43

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus