postgres安装

软件下载地址

http://www.postgres.cn/v2/download

软件安装参考文档

http://www.postgres.cn/docs

安装过程

将安装包解压到opt/postgresql-12.2目录中

# cd postgresql-12.2

 检查安装环境信息

# ./configure

 需要额外安装的包

# yum -y install gcc
# yum -y install gcc-c++
# yum -y install python
# yum -y install python-devel
# yum -y install readline-devel
# yum -y install bison
# yum -y install flex

 开始编译

make
make all
make world
检查编译内容
make check
make install
安装文档,可以不选
make install-docs
make install-world

设置环境变量

# vi /etc/profile
i

PATH=/usr/local/pgsql/bin:$PATH export PATH LD_LIBRARY_PATH=/usr/local/pgsql/lib export LD_LIBRARY_PATH MANPATH=/usr/local/pgsql/share/man:$MANPATH export MANPATH

:wq
# source /etc/profile

#echo $LD_LIBRARY_PATH
#echo $MANPATH
#echo $PATH

 创建文件目录

# cd /usr/local/pgsql
# mkdir data
# adduser postgres
# passwd postgres # chown postgres
/usr/local/pgsql/data # su - postgres # initdb -D /usr/local/pgsql/data # pg_ctl -D /usr/local/pgsql/data -l logfile start # createdb test # psql test

 

postgres安装

上一篇:系统引导过程及服务控制


下一篇:Centos7 升级内核为最新版本