安装POSTGRESQL

安装POSTGRESQL

opensuse中安装postgresql按照他官方的说法下子onekey即可,但是我一向都很“倒霉”注定不会这么好运,下载好后安装报错。找了很久发现bz2的安装成功机会比较大,于是安装bz2版。

解压,终端中允许./configure报错,说没有readline,在opensuse的软件安装中把readline安装好了。继续./configure成功,make成功,make install 报错无权限,su。输入秘密,成功。

建立postgres用户

useradd postgres

linux-z0bx:/ # chown postgres /usr/local/pgsql/data
linux-z0bx:/ # su postgres

postgres@linux-z0bx:/> /usr/local/pgsql/bin/initdb --no-locale -D /usr/local/pgsql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to "english".

fixing permissions on existing directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers/max_fsm_pages ... 32MB/204800
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
or
    /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

postgres@linux-z0bx:/>  /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
LOG:  could not bind IPv4 socket: Address already in use
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
LOG:  database system was shut down at 2008-08-23 11:29:20 CST
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections
不知你说的onekey和readline是什么,我用postgresql有一年多了,没听说过,不好意思

那个是系统里面的东东,不是数据库里面的,但数据库会用到