一、检查有没安装:rpg -ga | grep postgresqllinux
二、下载 从上述网址获得YUM地址,即在终端输入:yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_64/pgdg-centos11-11-2.noarch.rpmsql
注意:整个YUM必须都是小写的命令,Unix严格区分大小写(经过阿里云远程终端复制粘贴的是大写字母,不可用)数据库
三、安装,终端输入:yum install postgresql11-server postgresql11-libsvim
四、初始化:/usr/pgsql-11/bin/postgresql-11-setup initdb (注意这里必需要输入完整路径...)centos
五、配置服务安全
systemctl enable postgresql-11服务器
systemctl start postgresql-11post
六、配置远程链接:阿里云
vim /var/lib/pgsql/11/data/postgresql.conf 将listen_addresses 修改成 '*'加密
vim /var/lib/pgsql/11/data/pg_hba.conf 添加IP监听(加入一行) host all all 0.0.0.0/0 md5
重启服务:systemctl restart postgresql-11
七、修改数据库密码,以postgres为例:
经过命令切换用户: su - postgres
使用命令更改密码(用MD5加密):alter role postgres with ENCRYPTED password '123456'
能够使用命令查看是否能登陆:psql -h 127.0.0.1 -U postgres -d 123456 -W
八、配置ECS服务器的《安全组》策略
九、最后查看ECS实例公网地址,在外网访问