首先去pg官网下载postgresql11-11.2
https://www.postgresql.org/
centos7离线安装postgres11(版本可随意选择)
centos7离线安装postgres11(版本可随意选择)
选择版本
centos7离线安装postgres11(版本可随意选择)
下拉
centos7离线安装postgres11(版本可随意选择)
选版本
centos7离线安装postgres11(版本可随意选择)
进入:
centos7离线安装postgres11(版本可随意选择)
选择:
centos7离线安装postgres11(版本可随意选择)
选择库:
centos7离线安装postgres11(版本可随意选择)
选lib:
centos7离线安装postgres11(版本可随意选择)
选server:
centos7离线安装postgres11(版本可随意选择)
此时,还需要安装依赖libicu,这个我是在别的服务器下载的rpm包,制作方法:
找一台能联网的服务器,执行: yum -y install libicu --downloadonly --downloaddir=./home/…
centos7离线安装postgres11(版本可随意选择)
然后找到文件夹,把libicu-50.2-4.el7_7.x86_64.rpm包上传到离线服务器。
centos7离线安装postgres11(版本可随意选择)
上传到服务器,准备工作做完,开始安装:
rpm -ivh postgresql11-libs-11.8-1PGDG.rhel7.x86_64.rpm
centos7离线安装postgres11(版本可随意选择)
rpm -ivh libicu-50.2-4.el7_7.x86_64.rpm
centos7离线安装postgres11(版本可随意选择)
rpm -ivh postgresql11-11.8-1PGDG.rhel7.x86_64.rpm
rpm -ivh postgresql11-server-11.8-1PGDG.rhel7.x86_64.rpm
centos7离线安装postgres11(版本可随意选择)
初始化数据库:
/usr/pgsql-11/bin/postgresql-11-setup initdb
centos7离线安装postgres11(版本可随意选择)
设置开机启动项:
systemctl enable postgresql-11

修改文件:
vi /var/lib/pgsql/11/data/pg_hba.conf
centos7离线安装postgres11(版本可随意选择)
vi /var/lib/pgsql/11/data/postgresql.conf
centos7离线安装postgres11(版本可随意选择)
重启数据库:
systemctl restart postgresql-11
登陆:
su - postgres
psql
centos7离线安装postgres11(版本可随意选择)
修改密码命令:alter user postgres with password ‘postgres’;
退出命令:\q
验证登陆:
psql -h ip地址 -U postgres
centos7离线安装postgres11(版本可随意选择)
成功!!

相关文章: