在Centos中,我遵循以下步骤:
在/etc/yum.repos.d/CentOS-Base.repo上。
在“基础”和“更新”部分中,添加下一行exclude = postgresql *(然后,您不会从普通存储库中更新postgres rpm)。
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=postgresql*
#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
exclude=postgresql*
然后下载所需的版本。参见http://yum.pgrpms.org/howtoyum.php
wget http://yum.pgrpms.org/reporpms/8.3/pgdg-centos-8.3-6.noarch.rpm
rpm -ivh pgdg-centos-8.3-6.noarch.rpm
现在,您的/etc/yum.repos.d/ pgdg-82-centos.repo中还有另一个存储库。
ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-Media.repo pgdg-82-centos.repo
那么如果您安装postgres,centos将取自yum.pgsqlrpms.org/
yum install postgresql postgresql-server