在 Aliyun Linux 2 里安装 PostgreSQL 9.5
环境:阿里云ECS实例,4GB内存,Aliyun Linux 2 系统。
过程:
- cat /etc/redhat-release # 查看系统版本 Aliyun Linux release 2.1903 (Hunting Beagle)
- rpm -ivh https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm # 安装postgresql的yum安装源
- yum install postgresql95 postgresql95-server postgresql95-libs postgresql95-contrib postgresql95-devel # 安装 postgresql95
- vi /etc/yum.repos.d/pgdg-redhat-all.repo # 查看或编辑里边的源地址,如果 $releasever 错误识别为 7-6.1810.2.el7.centos,可直接将$releasever替换为7.6
- /usr/pgsql-9.5/bin/postgresql95-setup initdb # 初始化数据库
- systemctl start postgresql-9.5 # 启动postgresql
- yum install postgis2_95 postgis2_95-client # 安装 postgis
参考:
- https://yum.postgresql.org/repopackages.php
- http://postgis.net/install/
- http://www.postgresonline.com/journal/archives/362-An-almost-idiots-guide-to-install-PostgreSQL-9.5,-PostGIS-2.2-and-pgRouting-2.1.0-with-Yum.html