首页 > 数据库 >postgresql14编译安装参考手册(centos)

postgresql14编译安装参考手册(centos)

时间:2023-05-13 22:47:44浏览次数:41  
标签:参考手册 postgres pgsql14.3 -- postgresql14 centos PATH home log

Linux平台编译安装的快捷参考(Centos7.X平台/Pg14beta3为例):

说明:postgres官网源码编译安装操作步骤有一些小坑没更新过来,所以参考官网的安装步骤重新整理了一下,PG12,13部署均可以参考该文档。参考链接:下载页面/Download: 世界上功能最强大的开源数据库...icon-default.png?t=L892http://www.postgres.cn/v2/download

PG官网软件包下载地址:https://www.postgresql.org/ftp/source/v14beta3/

1.上传postgresql14beta3软件包至服务器指定路径下(1~9 root用户执行)

2.tar -xjvf postgresql-14beta3.tar.bz2

3.cd postgresql-14beta3

4../configure --prefix=/home/postgres/pgsql14.3 --with-perl --with-python #拟安装至/home/postgres/pgsql14.3路径下

说明:pg官网没有--with-perl --with-python 这两个,加上改选项才能使用Perl和Python语法的过程语言来编写自定义函数。

5.make world

6.make install-world

7.useradd postgres #创建postgres用户,并修改postgres用户密码

8.mkdir /home/postgres/pgsql14.3/data #创建数据库data目录

9.chown -R postgres:postgres /home/postgres

10.su - postgres #使用postgres帐号操作

11./home/postgres/pgsql14.3/bin/initdb -D /home/postgres/pgsql14.3/data #初始化数据库

12./home/postgres/pgsql14.3/bin/pg_ctl -D /home/postgres/pgsql14.3/data -l logfile start #启动数据库

13./home/postgres/pgsql14.3/bin/psql #连接数据库,默认psql连接postgres库。

至此,数据库部署完成,可以开始学习啦~

补充内容:

一、环境变量配置:

postgres 安装完成后,配置PG环境变量,在.bashrc中我添加如下3个参数(非必要项)

export PATH=/home/postgres/pgsql14.3/bin:$PATH

export LD_LIBRARY_PATH=/home/postgres/pgsql14.3/lib:$LD_LIBRARY_PATH

export PGDATA=/home/postgres/pgsql14.3/data

 

export PATH=/data/pg/bin:$PATH

export LD_LIBRARY_PATH=/data/pg/lib:$LD_LIBRARY_PATH

export PGDATA=/data/pg/pgdata

保存后source .bashrc 生效

二、postgresql数据库参数简单配置

修改pg_hba.conf

host alll all 0/0 md5

--该命令允许任何用户远程连接本数据库,连接是需要密码,走MD5认证。

2. 修改postgresql.conf

listen_addresses = ‘*’ #“*”表示在本地的所有地址上监听

logging_collector = on #打开日志收集

log_directory = ‘pg_log’

只保留最近7天的日志,进行循环覆盖。配置方法如下:

log_filename = ‘postgresql-%a.log’

log_truncate_on_rotation = on

log_rotation_age =1d

log_rotation_size = 0

3.安装contrib目录下的工具

contrib 下有一些工具比较实用,安装步骤如下

cd postgresql-14beta3/contrib/

make

make install

三、编译安装遇到报错:

报错一:

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 install readline readline-devel -y

报错二:

configure: error: zlib library not found

If you have zlib already installed, see config.log for details on the

failure. It is possible the compiler isn't looking in the proper directory.

Use --without-zlib to disable zlib support.

解决方法:

yum install zlib zlib-devel -y

报错三:

configure: error: could not determine flags for linking embedded Perl.

This probably means that ExtUtils::Embed or ExtUtils::MakeMaker is not

installed.

解决方法:

yum install perl-ExtUtils-Embed -y

报错四:

configure: error: header file <Python.h> is required for Python

解决方法:

yum install python python-devel -y

-bash-4.2$问题解决:

原因是在用useradd添加普通用户时,有时会丢失家目录下的环境变量文件,丢失文件如下:
1、.bash_profile
2、.bashrc
以上这些文件是每个用户都必备的文件。
此时可以使用以下命令从主默认文件/etc/skel/下重新拷贝一份配置信息到此用户家目录下

-bash-4.2$ cp /etc/skel/.bashrc .

-bash-4.2$ cp /etc/skel/.bash_profile .
————————————————
版权声明:本文为CSDN博主「杨小龙0110」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/XL_711/article/details/120386088

标签:参考手册,postgres,pgsql14.3,--,postgresql14,centos,PATH,home,log
From: https://www.cnblogs.com/chuangsi/p/17398397.html

相关文章

  • CentOS7 虚拟机安装后,网络失败 connect network is unreachable 解决方法
    0001.CentOS7虚拟机安装后,网络失败connectnetworkisunreachable解决方法1590阅读0评论2点赞 connect network is unreachable  一般是网上设置问题,需要进行如下修改:一、虚拟机修改网络配置:1、一般测试虚拟机,建议设置网络为桥接模式,这样跟开发机或......
  • CentOS5.7 下mysql5.7自动备份数据脚本
    mysql5.7自动备份数据库脚本1.root用户下用cd命令进入到想要的位置创建一个脚文文件://创建脚本命令vimbackup.shvim脚本名.sh#!/bin/bashsource/etc/profile#加载系统环境变量source~/.bash_profile#加载用户环境变量set-onounset......
  • centos7断电重启后docker无法启动的其中一种情况
    一、发现问题在一个很久没用docker的虚拟机上想跑一个docker容器,然后发现没启动,通过systemctlstartdocker启动直接报错:Jobfordocker.servicefailedbecausethecontrolprocessexitedwitherrorcode.See"systemctlstatusdocker.service"and"journalctl-xe"for......
  • CentOS7 中 semanage命令的安装(SELinux安全子系统)
    SELinux安全子系统SELinux(Security-EnhancedLinux)是美国国家安全局在Linux开源社区的帮助下开发的一个强制访问控制(MAC,MandatoryAccessControl)的安全子系统。RHEL7系统使用SELinux技术的目的是为了让各个服务进程都受到约束,使其仅获取到本应获取的资源。SELinux服务有三种配......
  • centos7 如何修改ssh端口号
    要修改CentOS7上的SSH端口号,可以按照以下步骤进行:使用SSH登录到服务器。打开SSH配置文件/etc/ssh/sshd_config,可以使用文本编辑器(如vi或nano)进行编辑。sudovi/etc/ssh/sshd_config找到#Port22这一行(可能会因版本而异),去掉行首的注释符号#,并将22修改为......
  • centos8 IP配置的修改
    CentOS已经更新到8.2了,整个系统也发生了许多的改变,比如:重启网卡的命令,万万刚拿到CentOS8的时候,配置完ip后款练的systemctlrestartnetwork,显示无服务,Unitnetwork.servicenotfound那么新命令是什么呢?nmclinmcliconnectionreload--重载网卡         ......
  • CentOS 6 EOL如何切换源
    CentOS6EOL如何切换源原文链接:https://help.aliyun.com/document_detail/193569.htm?spm=a2c4g.151226.0.0.231356b5095MIf CentOS6操作系统版本结束了生命周期(EOL),Linux社区已不再维护该操作系统版本。建议您升级操作系统至CentOS7及以上,如果您的业务过渡期仍需要使用Cent......
  • [Linux] 如何查看Centos用户登陆记录?[转载]
    0序言首先简单介绍一下Centos中记录登陆信息的日志有关当前登录用户的信息记录在文件utmp中;登录进入和退出纪录在文件wtmp中;最后一次登录文件可以用lastlog命令察看。数据交换、关机和重起也记录在wtmp文件中。所有的纪录都包含时间戳。每次有一个用户登录时,login程序在文件......
  • CentOS7编译安装OpenSSL3.1
    CentOS7编译安装OpenSSL3.11.下载Openssl源码包官网:https://www.openssl.org/ [root@localhost~]#wgethttps://www.openssl.org/source/openssl-3.1.0.tar.gz 2.解压安装[root@localhost~]#tar-xvfopenssl-3.1.0.tar.gz-C/usr/local/[root@localhost~]#cd......
  • CentOS7端口被占用的解决办法
    1、根据端口号得到其占用的进程的详细信息netstat-tlnp|grep80tcp       0     0192.168.33.10:80           0.0.0.0:*                  LISTEN     5014/httpdtcp       0     00.0.0.0:48054    ......