本文主要通过实际案例介绍如何在CentOS6环境中在线安装PostgreSQL10,安装环境需具备能够使用yum在线安装功能。具体安装步骤如下,
1 下载对应版本的PGDG文件
从https://yum.postgresql.org/repopackages.php页面找到对应的版本,
这里使用https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-centos10-10-2.noarch.rpm
2 安装上述PGDG文件
yum install -y https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-6-x86_64/pgdg-centos10-10-2.noarch.rpm
3 yum list列出可用的postgresql资源
yum list postgresql*
4 安装postgresql-server,其他工具可按需安装
yum install -y postgresql10-server.x86_64
5 数据库初始化
service postgresql-10 initdb
6 启动数据库服务
service postgresql-10 start
chkconfig postgresql-10 on
7 连接psql客户端
[root@cent-1 ~]# su - postgres
-bash-4.1$ psql
psql (10.1)
Type "help" for help.
postgres=# \l