linux 安装 postgreSQL
yum 安装
bash
# 安装yum源
yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
# 安装postgreSQL服务
yum -y install postgresql14-server.x86_64
# 初始化数据库
cd /usr/bin
postgresql-14-setup initdb
# 启动数据库
systemctl start postgresql-14.service
#安装插件
yum -y install postgresql14-contrib.x86_64
# 配置远程连接
cd /var/lib/pgsql/14/data/
vim pg_hba.conf
>>
# IPv4 local connections:
host all all 192.168.152.0/24 trust
<<
vim postgresql.conf
>>
listen_addresses = '*' # what IP address(es) to listen on;
<<
# 修改日志参数
vim postgresql.conf
>>
log_destination = 'csvlog' # Valid values are combinations of
<<
select pg_reload_conf()
#修改密码
ALTER USER postgres WITH PASSWORD 'postgres';
#连接
psql -Upostgres -h127.0.0.1 -p5432 -dpostgres