Redhat Linux Server 7.4 安装postgresql 10


  1. 安装对当于前版本的 repository RPM:

    yum install

  2. 安装postgresql 10 服务器包 和客户端包

    yum install postgresql10-server

    yum install postgresql10

  3. 初始化数据库

    /usr/pgsql-10/bin/postgresql-10-setup initdb

  4. 启动postgresql 服务

    systemctl start postgresql-10

  5. 将postgresql服务开机自启动项服务(可选)

    systemctl enable postgresql-10


  1. 修改用户密码

    su – postgres 

    切换用户,执行后提示符会变为 ‘-bash-4.2$’

    psql -U postgres

    登录数据库,执行后提示符变为 ‘postgres=#’

    ALTER USER postgres WITH PASSWORD 123456;   




  2. 开启远程访问

    vi /var/lib/pgsql/10/data/postgresql.conf

    修改#listen_addresses = ‘localhost’

    为 listen_addresses=’*’


  3. 设置信认连接

    vi /var/lib/pgsql/10/data/pg_hba.conf


        # IPv4 local connections:

        host    all            all      ident

        host all all (也可设定为只需要连接的服务器IP) md5

  4. 重启服务

    systemctl restart postgresql-10



安装中无法找到package, 这是因为repository 中对应的$releasever 不能正确的解晰成对应的系统版本而造成的。解决办法是直接 $releasever改为系统版本。

[root@lux01 download]# yum install postgresql10

Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile

* epel:

* remi-php73:

* remi-safe:

* webtatic: [Errno 14] HTTPS Error 404 – Not Found

Trying other mirror.

To address this issue please refer to the below wiki article

If above article doesn’t help to resolve this issue please use [Errno 14] HTTPS Error 404 – Not Found

Trying other mirror.

One of the configured repositories failed (PostgreSQL 11 for RHEL/CentOS $releasever – x86_64),

and yum doesn’t have enough cached data to continue. At this point the only

safe thing yum can do is fail. There are a few ways to work “fix” this:

1. Contact the upstream for the repository and get them to fix the problem.

2. Reconfigure the baseurl/etc. for the repository, to point to a working

upstream. This is most often useful if you are using a newer

distribution release than is supported by the repository (and the

packages for the previous distribution release still work).

3. Run the command with the repository temporarily disabled

yum –disablerepo=pgdg11 …

4. Disable the repository permanently, so yum won’t use it by default. Yum

will then just ignore the repository until you permanently enable it

again or use –enablerepo for temporary usage:

yum-config-manager –disable pgdg11


subscription-manager repos –disable=pgdg11

5. Configure the failing repository to be skipped, if it is unavailable.

Note that yum will try to contact the repo. when it runs most commands,

so will have to try and fail each time (and thus. yum will be be much

slower). If it is a very temporary problem though, this is often a nice


yum-config-manager –save –setopt=pgdg11.skip_if_unavailable=true

failure: repodata/repomd.xml from pgdg11: [Errno 256] No more mirrors to try.$releasever-x86_64/repodata/repomd.xml: [Errno 14] HTTPS Error 404 – Not Found


  1. 执行完 yum install postgresql10
  2. 查找对应的repo 文件,将文件中的releasever 改为系统版本, 如7

需要将repo 文件中的releasever都改正过来

保存后,重新执行 yum install postgresql10 ,问题应该 可以解决。

Leave a Comment