CentOS 7下安装PostgreSQL 15

一、简介

PostgreSQL是一种特性非常齐全的自由软件的对象-关系型数据库管理系统(ORDBMS),是以加州大学计算机系开发的POSTGRES,4.2版本为基础的对象关系型数据库管理系统。POSTGRES的许多领先概念只是在比较迟的时候才出现在商业网站数据库中。PostgreSQL支持大部分的SQL标准并且提供了很多其他现代特性,如复杂查询、外键、触发器、视图、事务完整性、多版本并发控制等。同样,PostgreSQL也可以用许多方法扩展,例如通过增加新的数据类型、函数、操作符、聚集函数、索引方法、过程语言等。另外,因为许可证的灵活,任何人都可以以任何目的免费使用、修改和分发PostgreSQL。

二、官网

  • 官网地址: https://www.postgresql.org/download/linux/redhat/
  • 安装工具: https://www.pgadmin.org/download/

 三、安装

选择版本: 

PostgreSQL: Linux downloads (Red Hat family)https://www.postgresql.org/download/linux/redhat/

3.1 安装依赖


# 获取所需依赖包
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/libzstd-1.5.2-1.el7.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/llvm5.0-devel-5.0.1-7.el7.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/llvm5.0-5.0.1-7.el7.x86_64.rpm
wget https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/l/llvm5.0-libs-5.0.1-7.el7.x86_64.rpm
 
yum install -y ./libzstd-1.5.2-1.el7.x86_64.rpm 
yum install -y centos-release-scl-rh llvm5*
yum install -y epel-release

3.2 执行安装


# 安装版本库的RPM
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

# 安装 PostgreSQL
sudo yum install -y postgresql15-server postgresql15-devel
报错:找不到源

[root@iZwz946ibli8ikuyqgtc58Z ~]# yum install rh-redis5-redis
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org?arch=x86_64&release=7&repo=sclo-rh error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"


 One of the configured repositories failed (Unknown),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.



     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=<repoid> ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable <repoid>
        or
            subscription-manager repos --disable=<repoid>

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=<repoid>.skip_if_unavailable=true

Cannot find a valid baseurl for repo: centos-sclo-rh/x86_64

--解决如下

进入/etc/yum.repos.d目录,删除目录下面所有的软件包,删除命令如下

sudo rm -rf *

sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

sudo wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

sudo curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

sudo wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

yum clean all 
yum makecache
yum makecache fast
 

3.3 初始化

# 初始化DB
sudo /usr/pgsql-15/bin/postgresql-15-setup initdb

# 开机启动|启动|重启|状态|停止 命令
sudo systemctl enable postgresql-15
sudo systemctl start postgresql-15
sudo systemctl restart postgresql-15
sudo systemctl status postgresql-15
sudo systemctl stop postgresql-15


3.4 配置环境变量

#编辑
vim /etc/profile

#PGSQL_HOME
export PGSQL_HOME=/usr/pgsql-15
export PATH=$PATH:$PGSQL_HOME/bin

#生效配置
source /etc/profile

3.5 创建数据库

# 切换用户
su postgres

psql
# 执行创建
create database test_db -U postgres ;
# 设置密码(自由发挥):postgres
alter user postgres with password 'postgres';


3.6 配置远程


#编辑
vim /var/lib/pgsql/15/data/postgresql.conf
修改参数:
listen_addresses = '*'

# 编辑配置
vim /var/lib/pgsql/15/data/pg_hba.conf

# 添加内容
host    all             all              0.0.0.0/0              md5

#重启
sudo systemctl restart postgresql-15

3.7测试链接

# 格式
psql -h 主机IP -p 端口  -U 用户名 -W -d 数据库

# 示例
psql -h 127.0.0.1 -p 5432  -U postgres -d test_db;

pgadmin 安装

项目首页 - windows:Windows inside a Docker container. - GitCode

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/42219.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

pytorch构建线性回归模型

仅仅用于自己记录pytorch学习记录 线性回归模型 &#xff08;1&#xff09;准备数据集 数据&#xff1a;三个数据x[x1,x2,x3] y[y1,y2,y3] import torch #线性回归&#xff0c;我们使用三组数据&#xff0c;分别是&#xff08;1,2&#xff09;&#xff0c;&#xff08;2,4&a…

Pytorch学习笔记(十二)Learning PyTorch - NLP from Scratch

这篇博客瞄准的是 pytorch 官方教程中 Learning PyTorch 章节的 NLP from Scratch 部分。 官网链接&#xff1a;https://pytorch.org/tutorials/intermediate/nlp_from_scratch_index.html 完整网盘链接: https://pan.baidu.com/s/1L9PVZ-KRDGVER-AJnXOvlQ?pwdaa2m 提取码: …

mysql--socket报错

错误原因分析 MySQL 服务未运行&#xff08;最常见原因&#xff09; 错误中的 (2) 表示 “No such file or directory”&#xff0c;即 /tmp/mysql.sock 不存在这通常意味着 MySQL 服务器根本没有启动 socket 文件路径不匹配 客户端尝试连接 /tmp/mysql.sock但 MySQL 服务器可…

进军场景智能体,云迹机器人又快了一步

&#xff08;图片来源&#xff1a;Pixels&#xff09; 2025年&#xff0c;AI和机器人行业都发生了巨大改变。 数科星球原创 作者丨苑晶 编辑丨大兔 2025年&#xff0c;酒店行业正掀起一股批量采购具备AI功能的软硬一体解决方案的热潮。 在DeepSeek、Manus等国产AI软件的推动…

WPS宏开发手册——JSA语法练习

目录 系列文章3、JSA语法练习3.1、运算练习3.2、比较练习3.3、if else练习3.4、for 练习3.5、字符串、数组方法练习3.6、语义转编程练习题 系列文章 使用、工程、模块介绍 JSA语法 JSA语法练习题 第四篇EXCEL常用API&#xff0c;持续更新中… 3、JSA语法练习 3.1…

ENSP学习day11

NAT地址转换&#xff08;二&#xff09;NAPT与easy ip 一&#xff1a;NAPT是Network Address Port Translation的缩写&#xff0c;也称为PAT&#xff08;Port Address Translation&#xff09;。NAPT是一种网络转换技术&#xff0c;用于在私有网络和公共网络之间进行地址转换以…

当Kafka化身抽水马桶:论组件并发提升与系统可用性的量子纠缠关系

《当Kafka化身抽水马桶&#xff1a;论组件并发提升与系统可用性的量子纠缠关系》 引言&#xff1a;一场OOM引发的血案 某个月黑风高的夜晚&#xff0c;监控系统突然发出刺耳的警报——我们的数据发现流水线集体扑街。事后复盘发现&#xff1a;Kafka集群、Gateway、Discovery服…

Web纯前端实现在线打开编辑保存PPT幻灯片

很多项目中有时会需要在线打开PPT并编辑保存到服务器。猿大师办公助手可以完美调用本地office在线打开ppt文件&#xff0c;跟本地打开效果一样。还可以在线打开word、excel、pdf等文件&#xff0c;支持本机OFFICE完整嵌入模式&#xff0c;本机OFFICE所有功能基本都可以在网页上…

java版嘎嘎快充玉阳软件互联互通中电联云快充协议充电桩铁塔协议汽车单车一体充电系统源码uniapp

演示&#xff1a; 微信小程序&#xff1a;嘎嘎快充 http://server.s34.cn:1888/ 系统特色&#xff1a; 多商户、汽车单车一体、互联互通、移动管理端&#xff08;开发中&#xff09; 另外有PHP版源码&#xff1a;小程序搜索 河南玉阳软件 成熟线上运营中。可定制代理分销分账…

【Linux加餐-验证UDP:TCP】-windows作为client访问Linux

一、验证UDP-windows作为client访问Linux UDP client样例代码 #include <iostream> #include <cstdio> #include <thread> #include <string> #include <cstdlib> #include <WinSock2.h> #include <Windows.h>#pragma warning(dis…

linux input子系统深度剖析

input 就是输入的意思&#xff0c;因此 input 子系统就是管理输入的子系统&#xff0c;和 pinctrl 、 gpio 子系统 一样&#xff0c;都是 Linux 内核针对某一类设备而创建的框架。比如按键输入、键盘、鼠标、触摸屏等 等这些都属于输入设备&#xff0c;不同的输入设备…

leetcode40-组合总和II

leetcode 40 思路 在做本题之前可以参考之前的文章&#xff1a;组合总和和组合总和III 本题的关键点是&#xff1a;每个元素只能使用一次&#xff0c;另外本题给的数组是无序的&#xff0c;并且元素之间可能存在重复项&#xff0c;举个例子&#xff0c;candidates [1,2,1,1…

CentOS 7 源码安装libjsoncpp-1.9.5库

安装依赖工具 sudo yum install cmake make gcc cmake 需要升级至 3.8.0 以上可参考&#xff1a;CentOS安装CMakegcc 需要升级至9.0 以上可参考&#xff1a;CentOS 7升级gcc版本 下载源码 wget https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.…

本地部署Stable Diffusion生成爆火的AI图片

直接上代码 Mapping("/send") Post public Object send(Body String promptBody) { JSONObject postSend new JSONObject(); System.out.println(promptBody); JSONObject body JSONObject.parseObject(promptBody); List<S…

知识就是力量——物联网应用技术

基础知识篇 一、常用电子元器件1——USB Type C 接口引脚详解特点接口定义作用主从设备关于6P引脚的简介 2——常用通信芯片CH343P概述特点引脚定义 CH340概述特点封装 3——蜂鸣器概述类型驱动电路原文链接 二、常用封装介绍贴片电阻电容封装介绍封装尺寸与功率关系&#xff1…

.Net SSO 单点登录方式

SSO单点登录目的 之前一般来讲系统简单&#xff0c;登录后 本地 cookie 加服务器 session 存储用户身份信息&#xff0c;以此为依据来判断用户再次登录时免验证 但随着互联网发展&#xff0c;很多应用 部署在不同的服务器上&#xff0c;而用户体系是一套&#xff0c;那么按照原…

MyBatis-Flex、MyBatis-Plus 与 Fluent-Mybatis 的比较分析

MyBatis-Flex、MyBatis-Plus 与 Fluent-Mybatis 的比较分析 在日常开发中&#xff0c;很多项目会选择 MyBatis 作为 ORM&#xff08;对象关系映射&#xff09;框架&#xff0c;而为了减少样板代码和提升开发效率&#xff0c;各种扩展库层出不穷。其中&#xff0c;MyBatis-Flex…

LVS NAT模式实现三台RS的轮询访问

节点规划: 配置RS&#xff1a; RS1-RS3的网关配置均为 192.168.163.8 配置RS1&#xff1a; [rootlocalhost ~]# hostnamectl hostname rs1 [rootlocalhost ~]# nmcli c modify ens160 ipv4.method manual ipv4.addresses 192.168.163.7/24 ipv4.gateway 192.168.163.8 conne…

软考中级-软件设计师 23种设计模式(内含详细解析)

23种设计模式 &#x1f3af; 创建型设计模式&#x1f4cc; 抽象工厂&#xff08;Abstract Factory&#xff09; 设计模式&#x1f4cc; 工厂方法&#xff08;Factory Method&#xff09;设计模式&#x1f4cc; 单例&#xff08;Singleton&#xff09;设计模式&#x1f4cc; 生成…

子数组 之 logTrick算法,求解或,与,LCM,GCD

文章目录 gcd的问题最大公约数 求解子数组的&,|,lcm,gcd的最值or计数问题&#xff0c;如果采用暴力的做法&#xff0c;那么时间复杂度会来到o(n^2),其实在求解的过程中&#xff0c;会出现很多的结果不变的情况&#xff0c;所以我们就可以提前结束 存在一定的单调性&#x…