安装
# Install the repository RPM:
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Install PostgreSQL:
sudo yum install -y postgresql11-server
启动
# Optionally initialize the database and enable automatic start:
初始化:sudo /usr/pgsql-11/bin/postgresql-11-setup initdb sudo systemctl enable postgresql-11
sudo systemctl start postgresql-11
修改密码:
安装完PostgreSQL数据库以后,默认会创建一个名为postgres的Linux登录用户名,这里需要进行密码修改
注意:这里修改的是Linux系统登录的账号密码,不是PostgreSQL数据库的密码,后面会修改PostgreSQL数据库的密码。
使用下面的命令修改postgres用户的登录密码:
passwd postgres
设置允许远程连接:
cd /var/lib/pgsql/11/data
vim postgresql.conf