首页 > 其他分享 >pg16编译安装

pg16编译安装

时间:2024-04-12 15:12:38浏览次数:37  
标签:postgresql postgres lib -- pg16 pgsql 编译 var 安装

1、postgresql安装-源代码安装

最新版本是v16.2 https://www.postgresql.org/ftp/source/v16.2/

 

下载源代码包,postgresql-16.2.tar.gz

解压

tar -xzvf postgresql-16.2.tar.gz

安装依赖

yum -y install gcc gcc-c++ make zlib zlib-devel openssl openssl-devel pcre pcre-devel libicudevel.x86_64

编译配置

./configure --prefix=/var/lib/pgsql --without-icu --without-readline

把所有文件装在目录/var/lib/pgsql中

 

编译

make

安装

make install

 

安装后配置环境变量,在/etc/profile文件末尾追加如下内容

LD_LIBRARY_PATH=/var/lib/pgsql/lib

export LD_LIBRARY_PATH

PATH=/var/lib/pgsql/bin:$PATH

export PATH

 

创建程序用户postgres

useradd postgres

 

给目录授权

chown postgres:postgres /var/lib/pgsql

 

初始化

initdb -D /var/lib/pgsql/data

 

启动数据库

切换到postgres用户

pg_ctl -D /var/lib/pgsql/data -l logfile start

关闭数据库

pg_ctl stop -D

 

配置开机启动项

创建postgresql.service

# It's not recommended to modify this file in-place, because it will be

# overwritten during package upgrades. If you want to customize, the # best way is to create a file "/etc/systemd/system/postgresql.service",

# containing

# .include /lib/systemd/system/postgresql.service # ...make your changes here...

# For more info about custom unit files, see

#

http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom _unit_file.3F

# For example, if you want to change the server's port number to 5433, # create a file named "/etc/systemd/system/postgresql.service" containing:

# .include /lib/systemd/system/postgresql.service

# [Service]

# Environment=PGPORT=5433

# This will override the setting appearing below.

# Note: changing PGPORT or PGDATA will typically require adjusting SELinux # configuration as well; see /usr/share/doc/postgresql-*/README.rpm-dist.

# Note: do not use a PGDATA pathname containing spaces, or you will # break postgresql-setup.

# Note: in F-17 and beyond, /usr/lib/... is recommended in the .include line # though /lib/... will still work.

[Unit] Description=PostgreSQL database server After=network.target

[Service]

Type=forking

User=postgres

Group=postgres

# Port number for server to listen on

Environment=PGPORT=5432

# Location of database directory

Environment=PGDATA=/var/lib/pgsql/data

# Where to send early-startup messages from the server (before the logging

# options of postgresql.conf take effect) # This is normally controlled by the global default set by systemd

# StandardOutput=syslog

# Disable OOM kill on the postmaster

OOMScoreAdjust=-1000

#ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA}

ExecStart=/var/lib/pgsql/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t

 

300

ExecStop=/var/lib/pgsql/bin/pg_ctl stop -D ${PGDATA} -s -m fast

ExecReload=/var/lib/pgsql/bin/pg_ctl reload -D ${PGDATA} -s

# Give a reasonable amount of time for the server to start up/shut down

TimeoutSec=300

[Install]

WantedBy=multi-user.target

 

将文件放置在/usr/lib/systemd/system/下

 

重启服务

systemctl restart postgresql

 

异常问题处理:

1、icu编译报错问题

configure: error: ICU library not found

If you have ICU already installed, see config.log for details on the failure. It is possible the compiler isn't looking in the proper directory.

Use --without-icu to disable ICU support.

 

configure: error: readline library not found

If you have readline already installed, see config.log for details on the failure. It is possible the compiler isn't looking in the proper directory.

Use --without-readline to disable readline support.

 

解决办法,yum搜索,需要devel版本的包,安装。 yum search all icu yum install libicu-devel.x86_64

安装后检查头文件是否存在了

ls -l /usr/include/ | grep zlib

 

./configure --without-icu --without-readline

 

标签:postgresql,postgres,lib,--,pg16,pgsql,编译,var,安装
From: https://www.cnblogs.com/jbjlogs/p/18131270

相关文章

  • Uipath下载安装202401
    在网上找了一圈,发现没更新uipath的下载方法。一起来下载玩玩吧~1、用浏览器搜索“uipath”,进入官网  2、点击官网右上角的“tryuipathfree”  3、用邮箱注册个uipath账号  4、自用选社区版本,邮箱注册账户后,会收到验证邮件,输入验证码后即注册成功   5......
  • MySQL数据库下载及安装教程
    MySQL数据库下载及安装教程(最最新版)一、下载mysql数据库二、安装Mysql三、验证是否安装成功(一)、命令提示符cmd窗口验证(二)、MySQL控制台验证一、下载mysql数据库进入MySQL官方网站(https://www.mysql.com/downloads/),按下图顺序点击进入下载页面。 注意:这里MSIInstal......
  • vmware虚拟机安装CentOS 7.9
    为.net6在CentOS7上面做准备,先在vmware虚拟机安装CentOS7.9新建CentOS764位的系统因为CentOS8不更新了,所以安装7;简单就一笔带过了  选择下载好的操作系统的iso文件,下载地址https://mirrors.aliyun.com/centos/7.9.2009/isos/x86_64/?spm=a2c6h.25603864.0.0.1f90f5adDfcZ......
  • Linux安装Apollo配置中心
    apollo官网链接:https://www.apolloconfig.com/#/zh/READMEApollo组件简介ApolloConfigService是一个分布式的配置中心,主要负责应用的配置信息存储、推送和管理。ConfigService支持多种存储方式,例如本地文件系统、Git存储和数据库存储等,同时也提供基于轮询和通知两种方......
  • server2008安装.netcore api
    一、先写个简单点的.netcoreapi1publicclassProgram2{3publicstaticvoidMain(string[]args)4{5varbuilder=WebApplication.CreateBuilder(args);67//Addservicestothecontainer.89......
  • Linux安装Nacos
    1,先安装jdk,nacos需要依赖于jdk2,官网前往GitHub下载安装包官网:https://nacos.io/zh-cn/官方文档:https://nacos.io/docs/v2/what-is-nacos/GitHub:https://github.com/alibaba/nacoscd/usr/localwgethttps://github.com/alibaba/nacos/releases/download/2.2.3/nacos-serve......
  • kubectl windows安装
     kubectlwindows安装在Windows上安装kubectl通常涉及以下步骤:下载kubectl可执行文件。将kubectl可执行文件放置在系统路径中。以下是在Windows上安装kubectl的步骤: 访问KubernetesGitHub发布页面:https://github.com/kubernetes/kubernetes/blob/......
  • vmware安装macos提示客户机操作系统已禁用 CPU。请关闭或重置虚拟机
    客户机操作系统已禁用CPU。请关闭或重置虚拟机。这是AMD电脑的VMware安装macOS出现的错误我们需要在虚拟机运行之前打开虚拟机安装目录自动生成的macOSxxxx(你选择安装的版本号).vmx只需要在末尾添加:smc.version="0"cpuid.0.eax="0000:0000:0000:0000:0000:0000:0000:......
  • 服务器确保已安装了 EPEL 软件源,依然无法安装 supervisor
    如果你已经安装了EPEL软件源但仍无法安装Supervisor,可能是因为Supervisor并不在EPEL软件源中。在这种情况下,你可以尝试通过Python的包管理工具pip来安装Supervisor。请按照以下步骤操作:确保已安装Python和pip。如果尚未安装,可以使用以下命令安装:sudoyuminstall......
  • linux 安装node
    安装参考地址:https://www.cnblogs.com/shining-feifan/p/17425518.htmlhttps://www.jianshu.com/p/900525215647 node官网下载地址https://registry.npmmirror.com/binary.html?path=node/latest-v14.x/ 一、下载安装包到本地1wget https://cdn.npmmirror.c......