环境:Ubuntu 16.04+PostgresQL13.2

1、指定安装路径

./configure --prefix=/opt/postgresql

2、编译安装

sudo make
sudo make install

3、添加用户和用户组

 sudo groupadd postgres
sudo useradd -g postgres postgres

4、创建数据库文件目录

sudo mkdir /opt/postgresql/data

5、用户文件访问权限变更

sudo chown postgres /opt/postgresql/data/
sudo chgrp postgres /opt/postgresql/data/

6、数据库初始化

sudo su postgres
/opt/postgresql/bin/initdb -D /opt/postgresql/data/

初始化成功后,如下图所示:

7、配置

配置允许访问的IP(所有IP都可以访问则对应为0.0.0.0/0)。

vim /opt/postgresql/data/pg_hba.conf

添加如下内容

配置监听地址和端口号:

vim /opt/postgresql/postgresql.conf

内容:

listen_addresses = '*'
port = 5433

8、启动数据库

/opt/postgresql/bin/pg_ctl -D /opt/postgresql/data -l /opt/postgresql/data/logfile start

9、登录数据库

 ./psql postgres -p 5433

10、创建开机启动服务

进入系统目录:

cd /etc/systemd/system/

创建postgresql.service文件:

[Unit]
Description=postgresql 13.2
After=network.target auditd.service [Service]
User=postgres
Type=forking
PIDFile=/opt/postgresql/data/postmaster.pid
ExecStart=/usr/local/pgsql/bin/pg_ctl -D /opt/postgresql/data -l /opt/postgresql/data/logfile start
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255 [Install]
WantedBy=multi-user.target

or

[Unit]
Description=postgresql 13.2
After=network.target auditd.service [Service]
User=postgres
ExecStart=/opt/postgresql/bin/pg_ctl -D /opt/postgresql/data -l /opt/postgresql/data/logfile start
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartPreventExitStatus=255
Type=notify [Install]
WantedBy=multi-user.target

最后启动服务即可。

11、开放防火墙

sudo iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 5433 -j ACCEPT

PostgreSQL源码编译的更多相关文章

  1. Linux环境PostgreSQL源码编译安装

    Linux环境PostgreSQL源码编译安装 Linux版本: Red Hat 6.4 PostgreSQL版本: postgresql-9.3.2.tar.gz 数据存放目录: /var/post ...

  2. postgresql源码编译安装(centos)

    centos6.8安装postgresql-9.6.8 一.环境 centos6.8 postgresql-9.6.8 二.准备工作 虚拟机可以连接外网 三.先安装make,gcc,gcc-c++,r ...

  3. ubuntu 14.04 源码编译postgresql

    环境 ubuntu 14.04 桌面版 postgresql 源码下载链接,本教程是使用postgresql 9.3.4 进行编译的 http://www.postgresql.org/ftp/sou ...

  4. Linux CentOS 7 安装PostgreSQL 9.5.17 (源码编译)

    近日需要将PostgreSQL数据库从Windows中迁移到Linux中,Linux CentOS 7 安装PostgreSQL 9.5.17 安装过程 特此记录. 安装环境: 数据库:Postgre ...

  5. [原创]在Windows和Linux中搭建PostgreSQL源码调试环境

    张文升http://ode.cnblogs.comEmail:wensheng.zhang#foxmail.com 配图太多,完整pdf下载请点这里 本文使用Xming.Putty和VMWare几款工 ...

  6. 跟我一起读postgresql源码(十)——Executor(查询执行模块之——Scan节点(下))

    接前文跟我一起读postgresql源码(九)--Executor(查询执行模块之--Scan节点(上)) ,本篇把剩下的七个Scan节点结束掉. T_SubqueryScanState, T_Fun ...

  7. Linux 从源码编译安装 OpenSSH

    https://blog.csdn.net/bytxl/article/details/46639073 Linux 从源码编译安装 OpenSSH以及各问题解决 2015年06月25日 17:37: ...

  8. [转]PostgreSQL源码结构

    PostgreSQL采用C/S(客户机/服务器)模式结构.应用层通过INET或者Unix Socket利用既定的协议与数据库服务器进行通信. 另外,还有一种‘Standalone Backend’使用 ...

  9. php源码编译常见错误解决方案大全

    php源码编译常见错误解决方案大全http://www.cnlvzi.com/index.php/Index/article/id/143 在CentOS编译PHP5的时候有时会遇到以下的一些错误信息 ...

随机推荐

  1. 蓝桥杯练习 Day6 题解

    蓝桥杯练习 Day6 题解 A 题意:给你一个等式ax+by = c,问你x,y是否有整数解. 思路:gcd(a,b) = t,如果方程有解,那么\((a/t)*x + (b/t)*y = c/t\) ...

  2. 基于MCRA-OMLSA的语音降噪(二):实现

    上篇文章(基于MCRA-OMLSA的语音降噪(一):原理)讲了基于MCRA-OMLSA降噪的原理,本篇讲怎么做软件实现.软件实现有多种方式.单纯看降噪效果可用python,因为python有丰富的库可 ...

  3. 洛谷——P1980 [NOIP2013 普及组] 计数问题

    题目描述 试计算在区间 11 到 nn的所有整数中,数字x(0 ≤ x ≤ 9)x(0≤x≤9)共出现了多少次?例如,在 11到1111中,即在 1,2,3,4,5,6,7,8,9,10,111,2, ...

  4. Exploring Architectural Ingredients of Adversarially Robust Deep Neural Networks

    目录 概 主要内容 深度 宽度 代码 Huang H., Wang Y., Erfani S., Gu Q., Bailey J. and Ma X. Exploring architectural ...

  5. Sufficient Statistic (充分统计量)

    目录 定义 充分统计量的判定 最小统计量 例子 Poisson Normal 指数分布 Gamma Sufficient statistic - Wikipedia Sufficient statis ...

  6. 【2021/12/31】uniapp之安卓原生插件开发教程

    uniapp之安卓原生插件开发教程 准备 hbuilderX,下载 app离线SDK,下载 Andorid Studio,安卓官方或中文社区 证书(可以自己准备,也可以使用android Studio ...

  7. 替代瑞昱RTD2166|pin对pin替代RTD2166|CS5202芯片

    替代瑞昱RTD2166,pin对pin替代RTD2166,外围器件少,设计版框尺寸小,整套方案成本BOM更低. 一. CS5202功能概述  CS5202是一款DP端口到VGA转换器,它结合了DP输入 ...

  8. Linux常用命令,新手可以看看

    最近在温习了一些linux的命令,这里总结一下,博主使用的系统是Ubuntu,版本如下: 由于博主是做开发的,所有linux只会一些常用的命令,跟那些专业linux大牛当前没的比,为什么Ubuntu而 ...

  9. 怎样安装python的 模块、 包、 库方法总结

    pip install 模块,这种输入命令回车后 1.pip install six 回车,安装成功后显示sucess 2.pip install lxml 回车,显示正在下载中的,可将这个下载地址复 ...

  10. pip list 精确查找某一模块的方法

    1. 今天搜资料的时候get一项技能: pip list精确查找某一模块 命令如下: pip list | findstr "win32" (此处win32可以替换成任意想查找的模 ...