原始碼安裝postgresql

abstractcyj發表於2020-08-26

作業系統版本

[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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章