首页 > 系统相关 >2、yum安装postgres15.3

2、yum安装postgres15.3

时间:2023-05-23 15:12:25浏览次数:49  
标签:15 postgres sudo sha yum postgresql 安装 postgres15.3

目录

yum安装postgres15.3

1、选择安装的版本1.53

参考官网文档:https://www.postgresql.org/download/linux/redhat/

2、创建postgres用户

root用户执行

groupadd -g 15432 postgres
useradd -u 15432 -g postgres postgres
passwd postgres

3、执行yum安装命令

/usr/pgsql-15/bin/postgresql-15-setup是安装postgres路径

initdb是初始化postgres数据库

systemctl enable是开机启动

systemctl start是启动postgres

执行命令如下:

# 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 postgresql15-server

# Optionally initialize the database and enable automatic start:
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb
sudo systemctl enable postgresql-15
sudo systemctl start postgresql-15

系统会默认创建用户postgres,密码为空

sudo -i -u postgres

执行psql

[postgres@dbServer42 ~]$ psql
psql (15.3)
Type "help" for help.

postgres=# 

说明安装成功。

4、修改配置文件

关闭服务:

sudo systemctl stop postgresql-15

4.1、修改postgresql.conf

vi /var/lib/pgsql/15/data/postgresql.conf

修改配置如下:

/+关键字查询

listen_addresses = '*'
port = 5432
max_connections = 1000
password_encryption = scram-sha-256
log_directory = '/u01/pgdata/log'

:wq保存

4.2、修改pg_hba.conf

vi /var/lib/pgsql/15/data/pg_hba.conf

修改配置如下:

增加0.0.0.0/0 开发对应ip的权限

# 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
host    all             all             0.0.0.0/0               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    replication     all             0.0.0.0/0               scram-sha-256

标签:15,postgres,sudo,sha,yum,postgresql,安装,postgres15.3
From: https://www.cnblogs.com/lgxdev/p/17425248.html

相关文章

  • Ubuntu 18.04 (Bionic) 简单快速的安装mongodb
    按步骤走,不带脑子式安装(注意4.0版本mongodb官方已经不再支持,以下代码中可以修改mongodb版本号安装,目前最新版为6.0,如果懒得改直接用也可以,文章后边第三章第一条代码会直接升级为最新版本mongodb):1.导入包管理系统使用的公钥wget-qO-https://www.mongodb.org/static/pgp/serv......
  • Linux 挂载安装文件
    先安装后挂载1先用./configure--prefix=/usr/local/YOUR_FOLDERmake&&makeinstall安装至指定目录,方便管理2编写可执行程序、库等文件的挂载和卸载脚本SRCDIR="/usr/local/libpng"DSTDIR="/usr/local"BIN_FILE_0=bin/libpng16-configBIN_FILE_1=bin/pngfixBIN_FI......
  • 安装软件
    软件包管理基础软件包管理系统使用数据库来记录下列内容。·Linux系统中已安装的软件包。·每个软件包安装了哪些文件。·每个已安装的软件包的版本。基于Debian的发行版(比如Ubuntu和LinuxMint)使用的是dpkg命令,该命令是其软件包管理系统的底层基础。基于RedHat的发行版(比......
  • vue安装与初始化
    vuenpm使用验证安装安装vue npminstall--globalvue-clivue版本 vue-V其他版本 node-v npm-v查询当前镜像地址 npmgetregistry修改镜像地址 npmconfigsetregistryhttp://registry.npm.taobao.org/taobao镜像设置并使用cnpm呼唤 npminstall-......
  • Linux下安装MySQL
    安装环境:虚拟机virtualbox,Ubuntu20.04系统;命令行下输入:sudoaptupdatesudoapt-getinstallmysql-server等待安装完成后,输入命令进行配置;sudomysql_secure_installation是否对密码验证组件进行配置?y密码强度?0root新密码?your_password 是否继续?y 遇到这个问......
  • Mysql简易安装介绍
    1.建议压缩包安装解压到对应文件,配置环境变量到path:D:\mysql-5.7.19-winx64\bin2.新建mysql配置文件my.ini在mysql根安装目录下新建mysql配置文件my.ini,文件内容如下:[mysqld]basedir=D:\mysql-5.7.19-winx64\datadir=D:\mysql-5.7.19-winx64\data\port=3306skip-gran......
  • Git的下载安装配置
     git教程 1.版本管理工具概念我在大学毕业写论文的时候的时候碰到过如下的现象```<<毕业论文第一版.doc>><<毕业论文第二版.doc>><<毕业论文第三版.doc>><<毕业论文最终版.doc>><<毕业论文最终版2.doc>>```在这种情况下如果不能查看修改之前的代码,查找问题是非常困难的......
  • Mac Git安装
    如何安装Git到MACOSX一,使用Gitcommand-line这里先介绍下使用Command-line。1,下载Gitinstaller,地址;http://git-scm.com/downloads2,下载之后打开,双击.pkg安装3,打开终端,使用git--version命令查看安装版本,有就是安装成功了......
  • nginx安装配置博客总结列表
    1)进入编辑配置文件:sudovim/etc/nginx/nginx.conf2)配置文件添加内容:3)重启nginxsudoservicenginxrestart//或者sudonginx-sreloadnginx相同域名转发不同路径:nginx域名监听转发:nginx转发同一域名的不同项目-多tomcat:......
  • 安装MySQLdb for centos 7--小白教程
    1.MySQLdb下载地址:https://pypi.python.org/pypi/MySQL-python/1.2.5 2.unzipMySQL-python-1.2.5; 3.cdMySQL-python-1.2.5; pythonsetup.pyinstall;此时报错:Traceback(mostrecentcalllast): File"setup.py",line17,in<module>   metadat......