首页 > 数据库 >CentOS7安装PostgreSQL15以及PostGIS3.3

CentOS7安装PostgreSQL15以及PostGIS3.3

时间:2024-05-28 10:56:07浏览次数:34  
标签:connections postgresql postgres PostgreSQL15 CentOS7 restart PostGIS3.3 requires

 

安装Postgresql

yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
yum install -y https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libzstd-1.5.5-1.el7.x86_64.rpm
yum -y install postgresql15-server

安装postgis

yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install postgis33_15

初始化数据库

/usr/pgsql-15/bin/postgresql-15-setup initdb

启动数据库

systemctl enable postgresql-15
systemctl start postgresql-15

PostgreSQL配置与管理

(1)修改用户名密码

[root@VM-16-10-centos ~]# su - postgres
Last login: Mon Dec 25 10:53:16 CST 2023 on pts/0
-bash-4.2$ psql -U postgres
psql (15.5)
Type "help" for help.

postgres=# ALTER USER postgres WITH PASSWORD 'postgres';

(2)配置postgresql.conf,将listen_addresses = '*'。(注意前面的#要取消)

[root@VM-16-10-centos data]# cd /var/lib/pgsql/15/data
[root@VM-16-10-centos data]# vim postgresql.conf
# - Connection Settings -
 
listen_addresses = '*'          # what IP address(es) to listen on;
                                        # comma-separated list of addresses;
                                        # defaults to 'localhost'; use '*' for all
                                        # (change requires restart)
#port = 5432                            # (change requires restart)
max_connections = 100                   # (change requires restart)
#superuser_reserved_connections = 3     # (change requires restart)
#unix_socket_directories = '/var/run/postgresql, /tmp'  # comma-separated list of directories
                                        # (change requires restart)
#unix_socket_group = ''                 # (change requires restart)
#unix_socket_permissions = 0777         # begin with 0 to use octal notation
                                        # (change requires restart)
#bonjour = off                          # advertise server via Bonjour
                                        # (change requires restart)
#bonjour_name = ''                      # defaults to the computer name
                                        # (change requires restart)

(3)配置pg_hba.conf,后面新增两行远程连接配置。配置完成之后需要重启postgres。

[root@VM-16-10-centos data]# vim pg_hba.conf
# TYPE  DATABASE        USER            ADDRESS                 METHOD
 
# "local" is for Unix domain socket connections only
local   all             all                                     peer
# 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
# Allow replication connections from localhost, by a user with the
# replication privilege.
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            scram-sha-256
host    replication     all             ::1/128                 scram-sha-256
host    all             all             127.0.0.1/32            ident
host    all             all             0.0.0.0/0               md5

连接验证

 

参考链接:https://blog.csdn.net/mxy2572185/article/details/135155930

标签:connections,postgresql,postgres,PostgreSQL15,CentOS7,restart,PostGIS3.3,requires
From: https://www.cnblogs.com/libin2015/p/18217421

相关文章

  • 轻松配置NFS服务:CentOS7服务器与客户端自动挂载指南
    目录NFS服务端配置NFS客户端配置 在CentOS7中配置NFS服务并设置客户端自动挂载的步骤如下:回到顶部NFS服务端配置安装NFS服务:首先,你需要在CentOS7服务器上安装NFS服务。你可以使用yum命令来安装:yuminstallnfs-utils创建共享目录:创建一个你希望共享的......
  • centos7.9安装openrestry
    简介:openrestry是一个与lua脚本结合的高性能服务器一:根据官网下载安装包https://openresty.org/cn/linux-packages.html二..配置环境exportPATH=/usr/local/openresty/nginx/sbin:$PATH默认安装后的80端口会被开放,查看并杀死netstat-lnpt|grep80kill-9pid 三.简......
  • centos7下安装中文字体
    1.安装fontconfigyum-yinstallfontconfig 2.创建chinesem目录/usr/shared/fonts目录下新建一个目录chinese#cd/usr/share/fonts#mkdirchinese 3.上传如下两个文件到目录/usr/share/fonts/chinesesimhei.ttfsimsun.ttc宋体和黑体这两个文件在windows下的C:\Windows\fon......
  • centos7.9简单的jar包的部署脚本
    #!/bin/bash#应用程序的名字APP_NAME="wecom"BASE_PATH="/home/cy/soft/wecom/"#JAR文件的新版本路径JAR_PATH="${BASE_PATH}${APP_NAME}.jar"#PID文件的路径PID_PATH="${BASE_PATH}${APP_NAME}.pid"#上传jar文件的位置JAR_BAK_PATH="......
  • FTP服务的拓展知识——基于centos7
     FTP(文件传输协议)是应用非常广泛的服务,配置简单,功能强大。在开始拓展知识的介绍之前先来简单的了解一下FTP的工作模式。FTP拥有两种连接方式管理接连模式:控制ftp服务(客户端使用随机高位端口,服务端使用21端口)数据连接模式:由客户端决定pas(关闭被动模式)在输入就启用——pa......
  • centos7.9 宝塔环境安装dotnet8
    官方下载二进制文件,https://dotnet.microsoft.com/zh-cn/download/dotnet/8.0选择对应linux然后上传到到目录,这边是随意的home/dotnet8然后执行下面的命令,提示没有文件或者文件夹,就对应创建下文件夹目录就可以。可以使用linux命令:mkdir-p/home/dotnet8mkdir-p/usr......
  • centos7安装postgresql-15
    摘要:本文将提供一个详细的教程,介绍如何在CentOS7操作系统上安装最新版本的PostgreSQL15。您将学习到如何添加PostgreSQL官方软件仓库,并使用yum命令进行安装和配置。1.引言PostgreSQL是一个功能强大的开源关系型数据库管理系统,被广泛用于企业级应用和数据存储。安装最新版......
  • centos7 更换阿里源
    一、环境准备你需要准备一台干净的CentOS7的环境,且可以ping的通外网~尤其是mirrors.aliyun.com。简单测试一下,如果通的话,再执行以下步骤完成设置。pingmirrors.aliyun.com二、手动配置阿里云源备份官方的原yum源的配置mv/etc/yum.repos.d/CentOS-Base.repo/etc/yum.re......
  • 网络监控专题之二Centos7部署Grafana
    Grafana官方下载指引:https://grafana.com/grafana/download?pg=get&plcmt=selfmanaged-box1-cta1  #官方地址[root@localhost~]#wgethttps://dl.grafana.com/enterprise/release/grafana-enterprise-9.3.0-1.x86_64.rpm[root@localhost~]#sudoyuminstallgraf......
  • 【转】centos7.9源码安装mysql5.7.44
    原文:https://blog.csdn.net/SeeYouGoodBye/article/details/1352314511、环境介绍centos7.9mysql5.7.44boost1.59.0注意:这里的编译版本mysql5.7.44和boost1.59.0是有依赖的,建议使用相同版本2、安装编译要用的依赖软件yuminstall-ygccgcc-c++cmakelibaio-develncu......