广告
返回顶部
首页 > 资讯 > 数据库 >postgres安装
  • 232
分享到

postgres安装

postgres安装 2018-10-22 15:10:44 232人浏览 无得
摘要

软件下载地址 Http://www.postgres.cn/v2/download 软件安装参考文档 http://www.postgres.cn/docs 安装过程 将安装包解压到opt/postgresql-12.2目录中 # cd

postgres安装

软件下载地址

Http://www.postgres.cn/v2/download

软件安装参考文档

http://www.postgres.cn/docs

安装过程

将安装包解压到opt/postgresql-12.2目录中

# cd postgresql-12.2

 检查安装环境信息

# ./configure

 需要额外安装的包

# yum -y install GCc
# yum -y install gcc-c++
# yum -y install python
# yum -y install Python-devel
# yum -y install readline-devel
# yum -y install bison
# yum -y install flex

 开始编译

make
make all
make world
检查编译内容
make check
make install
安装文档,可以不选
make install-docs
make install-world

设置环境变量

# vi /etc/profile
i

PATH=/usr/local/pgsql/bin:$PATH export PATH LD_LIBRARY_PATH=/usr/local/pgsql/lib export LD_LIBRARY_PATH MANPATH=/usr/local/pgsql/share/man:$MANPATH export MANPATH

:wq
# source /etc/profile

#echo $LD_LIBRARY_PATH
#echo $MANPATH
#echo $PATH

 创建文件目录

# cd /usr/local/pgsql
# mkdir data
# adduser postgres
# passwd postgres # chown postgres
/usr/local/pgsql/data # su - postgres # initdb -D /usr/local/pgsql/data # pg_ctl -D /usr/local/pgsql/data -l logfile start # createdb test # psql test

 设置超级管理员密码

initdb的-W、--pwprompt或--pwfile选项之一给数据库超级用户赋予一个口令
还可以指定-A md5或-A passWord,这样就不会使用默认的trust身份认证
或者在执行initdb之后、第一次启动服务器之前修改生成的pg_hba.conf文件

 连接数据库

推荐连接工具pgAdmin,腾讯镜像下载地址:https://mirrors.cloud.tencent.com/postgresql/pgadmin/pgadmin4/v5.5/windows/

查看本地linux开放端口,如果5431默认监听是127.0.0.0需要修改/usr/local/pgsql/data/postgresql.conf的监听地址

# netstat -aptn

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1060/sshd
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 64877/postgres
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1293/master
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 683/rpcbind
tcp 0 0 192.168.100.16:22 192.168.100.15:57600 ESTABLISHED 65741/sshd: root@no
tcp 0 0 192.168.100.16:22 192.168.100.15:54835 ESTABLISHED 65573/sshd: root@no
tcp 0 52 192.168.100.16:22 192.168.100.15:57635 ESTABLISHED 65768/sshd: root@pt
tcp6 0 0 :::22 :::* LISTEN 1060/sshd
tcp6 0 0 ::1:5432 :::* LISTEN 64877/postgres
tcp6 0 0 ::1:25 :::* LISTEN 1293/master
tcp6 0 0 :::111 :::* LISTEN 683/rpcbind

修改/usr/local/pgsql/data/postgresql.conf文件,设置成*表示监听所有ip的连接请求,也可以换成固定的IP。

listen_addresses = "*"

修改完成后再查看,5432端口号变成了0.0.0.0:5432,在这一步的时候我使用的是关闭数据库后启动来更改配置文件,不清楚直接reload会不会生效。

# netstat -aptn

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1060/sshd
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 66104/postgres
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1293/master
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 683/rpcbind
tcp 0 0 192.168.100.16:22 192.168.100.15:57600 ESTABLISHED 65741/sshd: root@no
tcp 0 0 192.168.100.16:22 192.168.100.15:54835 ESTABLISHED 65573/sshd: root@no
tcp 0 52 192.168.100.16:22 192.168.100.15:5763

修改/usr/local/pgsql/data/pg_hba.conf的# IPv4 local connections:,添加白名单

host all all 127.0.0.1/32 trust
host all all 192.168.100.15/32 trust

重新加载配置文件

# pg_ctl -D ../data reload

如果还不能访问,可以尝试关闭防火墙

检查防火墙状态
# systemctl status firewalld
# service  iptables status
临时关闭防火墙
# systemctl stop firewalld
# service  iptables stop
永久关闭防火墙
# systemctl disable firewalld
# chkconfig iptables off
重启防火墙
# systemctl enable firewalld
# service iptables restart

 

 

 

您可能感兴趣的文档:

--结束END--

本文标题: postgres安装

本文链接: https://www.lsjlt.com/news/8666.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • postgres安装
    软件下载地址 http://www.postgres.cn/v2/download 软件安装参考文档 http://www.postgres.cn/docs 安装过程 将安装包解压到opt/postgresql-12.2目录中 # cd...
    99+
    2018-10-22
    postgres安装
  • postgres篇---docker安装postgres,python连接postgres数据库
    postgres篇---docker安装postgres,python连接postgres数据库 一、docker安装postgres1.1 安装Docker:1.2 从Docker Hub获...
    99+
    2023-09-23
    docker 数据库 python
  • postgres 在liunx上安装步骤
    #postgres useradd postgres chown -R postgres:postgres /media su postgres mkdir -p /media/Data1/postgresql mkdir -p ...
    99+
    2020-02-19
    postgres 在liunx上安装步骤
  • postgres安装中文分词插件
    [root@node181 hongcq]# tar -xvf scws-1.2.3.tar.bz2 [root@node181 hongcq]# cd scws-1.2.3/ [root@node181 scws-1.2.3]# ./co...
    99+
    2018-06-23
    postgres安装中文分词插件
  • 如何在本地Docker安装Postgres 12 + pgadmin
    这篇文章给大家分享的是有关如何在本地Docker安装Postgres 12 + pgadmin的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。介绍项目最近要升级Posgres数据库, 从9.6升级到12+。为了做一...
    99+
    2023-06-14
  • 如何在一台树莓派上安装Postgres数据库
    这篇文章将为大家详细讲解有关如何在一台树莓派上安装Postgres数据库,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。在你的下一个树莓派项目上安装和配置流行的开源数据库 ...
    99+
    2022-10-18
  • 本地Docker安装Postgres 12 + pgadmin的方法 (支持Apple M1)
    目录介绍支持 Intel CPU支持 Apple M1测试介绍 项目最近要升级Posgres数据库, 从9.6升级到12+。为了做一些migration测试,我本地要安装几个版本的P...
    99+
    2022-11-11
  • Introducing PMDK into PostgreS
    将PMDK引入PostgreSQL持久性内存(PMEM)具有快速、非易失和可字节访问的特性,能够通过load/store指令被CPU直接访问。现在已有供应商提供这种产品。相对于HSS或者SSD,数据库管理系...
    99+
    2022-10-18
  • Postgres 11.4 pg_basebackup P
    报错截图: pg_basebackup: could not get write-ahead log end position from server: ERROR: could not open...
    99+
    2022-10-18
  • postgres递归语句
    with RECURSIVE cte AS ( select a.id,a.parent_id from org_t a where a.ID=1 UNION ALL selec&#...
    99+
    2022-01-30
    postgres递归语句
  • postgres学习笔记
    将一个标识符变得受限同时也使它变成大小写敏感的,反之非受限名称总是被转换成小写形 式。例如,标识符FOO、foo和"foo"在PostgreSQL中被认为是相同的,而"Foo"和"FOO"则互 不相同且也不同于前面三个标识符(Postgr...
    99+
    2018-01-09
    postgres学习笔记
  • postgres initdb 初始化
    语法说明: initdb [option...] [ --pgdata | -D ] directory 参数解析: -A authmethod --auth=authmethod 这个选项为本地用户指定在pg_hba.conf中使用的默...
    99+
    2014-11-18
    postgres initdb 初始化
  • Postgres杀掉进程
    SELECT  *  FROM pg_stat_activity WHERE datname="energy_monitor" and application_name = "Navicat"; SELECT pg_te...
    99+
    2016-06-19
    Postgres杀掉进程
  • 002-postgres initdb 初始化
    语法说明: initdb [option...] [ --pgdata | -D ] directory 参数解析: -A authmethod --auth=authmethod 这个选项为本地用户指定在pg_hba.conf中使用的默...
    99+
    2016-12-11
    002-postgres initdb 初始化
  • postgres 开启wal归档
    1.postgres 开启wal归档: a.修改wal_level参数:alter system set wal_level= 'replica'; postgres=# alter system set ...
    99+
    2022-10-18
  • 数据库postgres index vaccum学习
    VoicePortal=# create table testindex (no serial primary key, value integer);NOTICE: CREATE TABLE will ...
    99+
    2022-10-18
  • postgres 9.6.5 重建控制文件
    新版本的pg_resetlog 的参数发生了变化,在网上之前找了一下德哥的文章看了一下重建控制文件的方法,之后根据实际的变化参数对比让大家更容易解决问题。postgresql9.2Options:-l TL...
    99+
    2022-10-18
  • postgres数据库启动参数
    SIGTERM   不再允许新的连接,但是允许所有活跃的会话正常完成他们的工作,只有在所有会话都结束任务后才关闭。这是智能关闭。    ...
    99+
    2022-10-18
  • 记一次Postgres CPU爆满故障
    问题描述 公司项目测试环境调用某些接口的时候,服务器立即崩溃,并一定时间内无法提供服务。 问题排查 服务器配置不够 第一反应是服务器需要升配啦,花钱解决一切!毕竟测试服务器配置确实不高,2CPU + 4Gib,能干啥?不过问题是今...
    99+
    2020-03-22
    记一次Postgres CPU爆满故障
  • Postgres-XL更新的示例分析
    本篇文章为大家展示了Postgres-XL更新的示例分析,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。2018年10月25日2ndQuadrant发布了Postgr...
    99+
    2022-10-19
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作