PostgreSQL源码编译
环境: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源码编译的更多相关文章
- Linux环境PostgreSQL源码编译安装
Linux环境PostgreSQL源码编译安装 Linux版本: Red Hat 6.4 PostgreSQL版本: postgresql-9.3.2.tar.gz 数据存放目录: /var/post ...
- postgresql源码编译安装(centos)
centos6.8安装postgresql-9.6.8 一.环境 centos6.8 postgresql-9.6.8 二.准备工作 虚拟机可以连接外网 三.先安装make,gcc,gcc-c++,r ...
- ubuntu 14.04 源码编译postgresql
环境 ubuntu 14.04 桌面版 postgresql 源码下载链接,本教程是使用postgresql 9.3.4 进行编译的 http://www.postgresql.org/ftp/sou ...
- Linux CentOS 7 安装PostgreSQL 9.5.17 (源码编译)
近日需要将PostgreSQL数据库从Windows中迁移到Linux中,Linux CentOS 7 安装PostgreSQL 9.5.17 安装过程 特此记录. 安装环境: 数据库:Postgre ...
- [原创]在Windows和Linux中搭建PostgreSQL源码调试环境
张文升http://ode.cnblogs.comEmail:wensheng.zhang#foxmail.com 配图太多,完整pdf下载请点这里 本文使用Xming.Putty和VMWare几款工 ...
- 跟我一起读postgresql源码(十)——Executor(查询执行模块之——Scan节点(下))
接前文跟我一起读postgresql源码(九)--Executor(查询执行模块之--Scan节点(上)) ,本篇把剩下的七个Scan节点结束掉. T_SubqueryScanState, T_Fun ...
- Linux 从源码编译安装 OpenSSH
https://blog.csdn.net/bytxl/article/details/46639073 Linux 从源码编译安装 OpenSSH以及各问题解决 2015年06月25日 17:37: ...
- [转]PostgreSQL源码结构
PostgreSQL采用C/S(客户机/服务器)模式结构.应用层通过INET或者Unix Socket利用既定的协议与数据库服务器进行通信. 另外,还有一种‘Standalone Backend’使用 ...
- php源码编译常见错误解决方案大全
php源码编译常见错误解决方案大全http://www.cnlvzi.com/index.php/Index/article/id/143 在CentOS编译PHP5的时候有时会遇到以下的一些错误信息 ...
随机推荐
- 1198 - Karate Competition
1198 - Karate Competition PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 ...
- 【死磕Java并发】-----Java内存模型之重排序
在执行程序时,为了提供性能,处理器和编译器常常会对指令进行重排序,但是不能随意重排序,不是你想怎么排序就怎么排序,它需要满足以下两个条件: 在单线程环境下不能改变程序运行的结果: 存在数据依赖关系的不 ...
- JVM 内存布局
JVM 内存布局规定了 Java 在运行过程中内存申请.分配.管理的策略,保证了 JVM 的高效稳定运行. 线程是否共享 Heap (堆区) 堆是 OOM 故障最主要的发生区域.它是内存区域中最大的一 ...
- 第九个知识点:香农(Shannon)定义的熵和信息是什么?
第九个知识点:香农(Shannon)定义的熵和信息是什么 这是计算机理论的最后一篇.我们讨论信息理论的基础概念,什么是香农定义的熵和信息. 信息论在1948年被Claude E.Shannon建立.信 ...
- Proximal Algorithms 6 Evaluating Proximal Operators
目录 一般方法 二次函数 平滑函数 标量函数 一般的标量函数 多边形 对偶 仿射集合 半平面 Box Simplex Cones 二阶锥 半正定锥 指数锥 Pointwise maximum and ...
- 详解Kalman Filter
中心思想 现有: 已知上一刻状态,预测下一刻状态的方法,能得到一个"预测值".(当然这个估计值是有误差的) 某种测量方法,可以测量出系统状态的"测量值".(当然 ...
- 想看Vue文档,cn放错位置,误入xx网站...
昨晚,DD在微信群(点击加入)里看到有小伙伴说,想去Vue官网看中文文档,不当心把cn写错了位置,结果进入了xx网站... 老司机们应该都知道,Vue官网的中文文档地址是:https://cn.vue ...
- python uwsgi 配置
启动:uwsgi --ini xxx.ini 重启:uwsgi --reload xxx.pid 停止:uwsgi --stop xxx.pid ini 文件 [uwsgi] chdir = /vag ...
- hisql 新功能 支持一套sql在不同数据库执行
目前流行的ORM框架如果需要动态的拼接查询语句,只能用原生的sql进行拼接,无法跨不同数据库执行.hisql推出新的语法一套语句可以在不同的数据库执行 传统ORM框架最大的弊端就是完全要依赖于实体用l ...
- STC8H开发(二): 在Linux VSCode中配置和使用FwLib_STC8封装库(图文详解)
目录 STC8H开发(一): 在Keil5中配置和使用FwLib_STC8封装库(图文详解) STC8H开发(二): 在Linux VSCode中配置和使用FwLib_STC8封装库(图文详解) 前面 ...