ITPub博客

首页 > 数据库 > PostgreSQL > 源码安装postgresql

源码安装postgresql

原创 PostgreSQL 作者:abstractcyj 时间:2020-08-26 10:37:12 0 删除 编辑

操作系统版本

[root@mysqlcomm ~]# cat /etc/issue

\S

Kernel \r on an \m


[root@mysqlcomm ~]# 

[root@mysqlcomm ~]# uname -a

Linux mysqlcomm 4.14.35-1902.3.2.el7uek.x86_64 #2 SMP Tue Jul 30 03:59:02 GMT 2019 x86_64 x86_64 x86_64 GNU/Linux

[root@mysqlcomm ~]# cat /etc/redhat-release 

Red Hat Enterprise Linux Server release 7.7 (Maipo)


数据库版本:12.4


从网站下载源码, 解压

首先需要安装library

yum -y install -y readline-devel

yum -y install -y zlib-devel

yum -y install -y gcc


./configure

make && make install

adduser postgres

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 -l logfile start

/usr/local/pgsql/bin/createdb test

/usr/local/pgsql/bin/psql test


[root@mysqlcomm postgresql-12.4]# adduser postgres

[root@mysqlcomm postgresql-12.4]# mkdir /usr/local/pgsql/data

[root@mysqlcomm postgresql-12.4]# chown postgres /usr/local/pgsql/data

[root@mysqlcomm postgresql-12.4]# su - postgres

[postgres@mysqlcomm ~]$ /usr/local/pgsql/bin/initdb -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 "en_US.UTF-8".

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 /usr/local/pgsql/data ... ok

creating subdirectories ... ok

selecting dynamic shared memory implementation ... posix

selecting default max_connections ... 100

selecting default shared_buffers ... 128MB

selecting default time zone ... Asia/Shanghai

creating configuration files ... ok

running bootstrap script ... ok

performing post-bootstrap initialization ... ok

syncing data to disk ... ok


initdb: warning: enabling "trust" authentication for local connections

You can change this by editing pg_hba.conf or using the option -A, or

--auth-local and --auth-host, the next time you run initdb.


Success. You can now start the database server using:


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


[postgres@mysqlcomm ~]$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile

pg_ctl: no operation specified

Try "pg_ctl --help" for more information.

[postgres@mysqlcomm ~]$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

waiting for server to start.... done

server started

[postgres@mysqlcomm ~]$ /usr/local/pgsql/bin/createdb test

[postgres@mysqlcomm ~]$ /usr/local/pgsql/bin/psql test

psql (12.4)

Type "help" for help.


test=# 



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8520577/viewspace-2714729/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
曾从事java方向开发多年。近年已经转入数据库方向。主要擅长SQL优化,Oracle数据库问题诊断,Oracle备份与恢复等。服务于医药物流,医院等行业

注册时间:2010-01-26

  • 博文量
    582
  • 访问量
    946362