【PostgreSQL】linux环境下的PostgreSQL安装

【PostgreSQL】linux环境下的PostgreSQL安装,第1张

概述实验环境: OS:OEL 5.8  x86_64 PostgreSQL安装包:postgresql-9.3.9.tar.gz   PostgreSQL可以使用root用户安装也可以使用普通用户安装,这里我用的是普通用户进行安装: 创建组及用户: [root@edb1 ~]# groupadd pg [root@edb1 ~]# useradd -g pg pg 解压安装包: [root@edb1 

实验环境:

OSOEL5.8x86_64

Postgresql安装包:postgresql-9.3.9.tar.gz

Postgresql可以使用root用户安装也可以使用普通用户安装,这里我用的是普通用户进行安装:

创建组及用户:

[root@edb1~]#groupaddpg

[root@edb1~]#useradd-gpgpg

解压安装包:

[root@edb1~]#su-pg

[pg@edb1~]$cd/soft/

[pg@edb1soft]$tar-zxvfpostgresql-9.3.9.tar.gz

[pg@edb1soft]$cdpostgresql-9.3.9

安装过程(过程中注意有无报错):

configure

[pg@edb1postgresql-9.3.9]$./configure-prefix=/home/pg/pgsql--指定安装目录

checkingbuildsystemtype...x86_64-unkNown-linux-gnu

checkinghostsystemtype...x86_64-unkNown-linux-gnu

checkingwhichtemplatetouse...linux

checkingwhethertobuilDWith64-bitintegerdate/timesupport...yes

checkingwhetherNLSiswanted...no

checkingfordefaultportnumber...5432

......

make

[pg@edb1postgresql-9.3.9]$make

make-Csrcall

make[1]:Enteringdirectory`/soft/postgresql-9.3.9/src'

make-Ccommonall

make[2]:Enteringdirectory`/soft/postgresql-9.3.9/src/common'

make-C../backendsubmake-errcodes

......

make[1]:Leavingdirectory`/soft/postgresql-9.3.9/config'

AllofPostgresqlsuccessfullymade.Readytoinstall.

makeinstall

[pg@edb1postgresql-9.3.9]$makeinstall

make-Csrcinstall

make-Ccommoninstall

Postgresqlinstallationcomplete.

修改pg用户环境变量,增加以下内容:

[pg@edb1~]$vi.bash_profile

LD_liBRARY_PATH=/home/pg/pgsql/lib

exportLD_liBRARY_PATH

PATH=/home/pg/pgsql/bin:$PATH

exportPATH

PGDATA=/home/pg/pgsql/data

生效环境变量:

[pg@edb1~]$..bash_profile

创建Postgresql默认库:

[pg@edb1~]$initdb-D$PGDATA

Thefilesbelongingtothisdatabasesystemwillbeownedbyuser"pg".

Thisusermustalsoowntheserverprocess.

ThedatabaseclusterwillbeinitializeDWithlocale"en_US.UTF-8".

ThedefaultdatabaseenCodinghasaccordinglybeensetto"UTF8".

Thedefaulttextsearchconfigurationwillbesetto"english".

Success.YoucanNowstartthedatabaseserverusing:

postgres-D/home/pg/pgsql/data

or

pg_ctl-D/home/pg/pgsql/data-llogfilestart

创建完成之后也给出了数据库启动命令

启动数据库:

[pg@edb1~]$pg_ctl-D/home/pg/pgsql/datastart

serverstarting

查看数据库进程:

[pg@edb1~]$ps-ef|greppost

pg283501001:15pts/200:00:00/home/pg/pgsql/bin/postgres-D/home/pg/pgsql/data

pg2835228350001:15?00:00:00postgres:checkpointerprocess

pg2835328350001:15?00:00:00postgres:writerprocess

pg2835428350001:15?00:00:00postgres:walwriterprocess

pg2835528350001:15?00:00:00postgres:autovacuumlauncherprocess

pg2835628350001:15?00:00:00postgres:statscollectorprocess

pg2891328406001:35pts/200:00:00greppost

查看监听端口:

[pg@edb1~]$netstat-natp|greppostgres

(NotallprocessesCouldbeIDentifIEd,non-ownedprocessinfo

willnotbeshown,youwouldhavetoberoottoseeitall.)

tcp00127.0.0.1:54320.0.0.0:*ListEN28350/postgres

关闭数据库:

[pg@edb1~]$pg_ctl-D/home/pg/pgsql/datastop

waitingforservertoshutdown....done

serverstopped

总结

以上是内存溢出为你收集整理的【PostgreSQL】linux环境下的PostgreSQL安装全部内容,希望文章能够帮你解决【PostgreSQL】linux环境下的PostgreSQL安装所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1175400.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存