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


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


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


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)


从网站下载源码, 解压


yum -y install -y readline-devel

yum -y install -y zlib-devel

yum -y install -y gcc


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.


来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量