合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
[TOC] ## 安装 ## window 安装包 安装好后,出现` 用户 "postgres" Password 认证失败 `, 寻找data文件夹下面的`pg_hba.conf` 将最下面的 `scram-sha-256` 加密方式修改为` trust` 原 ``` # "local" is for Unix domain socket connections only local all all scram-sha-256 # IPv4 local connections: host all all 127.0.0.1/32 scram-sha-256 # IPv6 local connections: host all all ::1/128 scram-sha-256 ``` 改 ``` # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust ``` ### window choco 安装 `choco install postgresql --params '/Password:123456' --params-global` ## docker ``` docker run -p 5432:5432 --name some-postgres -e POSTGRES_PASSWORD=123456 -d postgres ``` ## ubuntu 最新安装方式查看 官网 ``` sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - sudo apt-get update sudo apt-get -y install postgresql ``` ## RedHat 系列 最新安装方式查看 官网 ``` sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm sudo yum install -y postgresql15-server sudo /usr/pgsql-15/bin/postgresql-15-setup initdb sudo systemctl enable postgresql-15 sudo systemctl start postgresql-15 ``` 设置 postgres 密码 ``` > su - postgres > psql -U postgres postgres=# \password ``` ### 配置远程连接 /var/lib/pgsql/15/data/pg_hba.conf 添加一行 ``` host all all 0.0.0.0/0 md5 ``` /var/lib/pgsql/15/data/postgresql.conf ``` # - 配置文件:连接设置 - listen_addresses = '*' # 监听地址,重启数据库软件服务生效; port = 5432 # 监听端口,重启数据库软件服务生效; ```