安装postgresql
登陆网址:https://www.postgresql.org/download/linux/redhat/
选择postgresql版本和操作系统平台等信息,直接复制命令,依次执行
# Install the repository RPM:
sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# Disable the built-in PostgreSQL module:
sudo dnf -qy module disable postgresql
# Install PostgreSQL:
sudo dnf install -y postgresql13-server
# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-13/bin/postgresql-13-setup initdb
sudo systemctl enable postgresql-13
sudo systemctl start postgresql-13
数据安装完成后默认会创建一个名为postgres的linux登录用户,这里进行密码修改
[root@localhost /]# passwd postgres
更改用户 postgres 的密码 。
新的 密码:
修改文件pg_hba.conf
0.0.0.0/0表示任意IP都可以连接数据库
修改文件postgresql.conf
关闭防火墙
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
Removed /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]#
OK,测试远程连接成功
然后复制一个新的虚拟机,
原虚拟机IP为192.168.60.3,
将新虚拟机IP设置为192.168.60.4
过程不再赘述,配置完成如下
至此测试环境搭建完成