Cent OS 7.7安装 Postgresql 12.3 rpm和源码安装、配置数据库
文章目录
下载Postgresql 12.3
这个是yum源
https://yum.postgresql.org/rpmchart/
找个合适的版本下载下来
https://yum.postgresql.org/12/redhat/rhel-7-x86_64/repoview/postgresqldbserver12.group.html
挨个下载
或者通过
yum install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
然后
yum install --downloadonly --downloaddir=pgsql123 postgresql12 postgresql12-contrib postgresql12-libs postgresql12-server
下载这四个rpm包。
postgresql12-12.3-5PGDG.rhel7.x86_64.rpm
postgresql12-libs-12.3-5PGDG.rhel7.x86_64.rpm
postgresql12-contrib-12.3-5PGDG.rhel7.x86_64.rpm
postgresql12-server-12.3-5PGDG.rhel7.x86_64.rpm
然后安装这四个包。
然后按照官网的说明进行配置。
https://www.postgresql.org/download/linux/redhat/
源码安装
这个是官网说明
https://www.postgresql.org/docs/current/installation.html
源码从官网下载:https://www.postgresql.org/download/linux/redhat/
rpm -ivh readline-6.2-11.el7.x86_64.rpm --force
rpm -ivh ncurses-devel-5.9-14.20130511.el7_4.x86_64.rpm --force
rpm -ivh readline-devel-6.2-11.el7.x86_64.rpm --force
./configure
make world (最全),也可以 make
make check
make install-world (最全),也可以 make install
官网的版本
./configure
make
su
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
配置
主要是配置环境变量和配置成服务
本文地址:https://blog.csdn.net/xiaoxiaokeren/article/details/107648110