在 SUSE Linux 上安装 PostgreSQL 10.x

SUSE Linux Enterprise Server 12SP5 (PostgreSQL) 10.12

SUSE Linux Enterprise Server 12SP3 (PostgreSQL) 10.8

linux-137:/usr/local # zypper install postgresql-server postgresql
linux-137:/usr/local # psql --version
psql (PostgreSQL) 10.12

linux-137:/home # chown postgres:postgres ./psqldata/

linux-137:/home # su postgres
postgres@linux-137:/home> initdb -D /home/psqldata/
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 locales
  COLLATE:  C
  CTYPE:    en_US.UTF-8
  MESSAGES: C
  MONETARY: C
  NUMERIC:  C
  TIME:     C
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /home/psqldata ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Asia/Shanghai
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
 

postgres@linux-137:/home> pg_ctl -D /home/psqldata/ start
waiting for server to start....2020-10-13 21:00:44.354 CST   [15250]LOG:  listening on IPv6 address "::1", port 5432
2020-10-13 21:00:44.355 CST   [15250]LOG:  listening on IPv4 address "127.0.0.1", port 5432
2020-10-13 21:00:44.359 CST   [15250]LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2020-10-13 21:00:44.373 CST   [15250]LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2020-10-13 21:00:44.387 CST   [15250]LOG:  redirecting log output to logging collector process
2020-10-13 21:00:44.387 CST   [15250]HINT:  Future log output will appear in directory "log".
 done
server started
 

后台运行的命令 postgres -D /usr/local/pgsql/data >logfile 2>&1 &

还是以下命令来的省事

systemctl start postgresql.service

systemctl enable postgresql.service

服务目录:/usr/lib/systemd/system 

创建数据库及用户

psql postgres

create user pub password 'test001';

create database pgsql1 owner pub; 

标签
菜单分类