Linux平台下源码方式安装PostgreSQL


(1) 创建数据库用户及 权限设置

mkdir /postgresql/log

mkdir /postgresql/app

mkdir /postgresql/soft

# mkdir /postgresql/archive

groupadd -g 80000 postgresql

useradd -u 80000 -g postgresql postgresql

echo "postgresql" |passwd --stdin postgresql

chown -R postgresql:postgresql /postgresql

chmod -R 775 /postgresql


(2) 编译安装

chmod -R 775 /postgresql

cd /postgresql/soft

tar -zxvf postgresql-15.3.tar.gz

cd postgresql-15.3
  • # 编译
./configure --prefix=/postgresql/app/postgresql \
--with-icu \
--with-perl \
--with-python \
--with-tcl \
--with-tclconfig=/usr/lib64 \
--with-openssl \
--with-includes=/usr/include/openssl \
--with-readline \
--with-pam \
--with-gssapi \
--with-libraries=/usr/lib64 \
--enable-nls \
--enable-dtrace \
--with-uuid=e2fs \
--with-libxml \
--with-libxslt \
--with-ldap \
--with-selinux \
--with-systemd \
--with-system-tzdata=/usr/share/zoneinfo \
--with-lz4 \
--with-zstd


make -j 4 world

make install world

  • # 检查
cd /postgresql/app/postgresql/bin/

ldd postgres


(4) 用户环境变量配置

su - postgresql

## vi ~/.bash_profile

cat >> ~/.bash_profile <<-OFFFFFFFFFFFFF
export TZ='Asia/Shanghai'
export LANG=en_US.UTF8
export PS1="[`whoami`@`hostname`:"'$PWD]$'
export PGPORT=5432
export PGDATA=/postgresql/data
export PGHOME=/postgresql/app/postgresql
export LD_LIBRARY_PATH=$PGHOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/lib:/usr/lib:/usr/local/lib:$LD_LIB RARY_PATH
export PATH=$PGHOME/bin:$PATH:.
export DATE=`date +"%Y%m%d%H%M"`
export MANPATH=$PGHOME/share/man:$MANPATH
export PGHOST=$PGDATA
export PGUSER=postgres
export PGDATABASE=postgres
export PATH="$PGHOME/bin:$PATH";export PATH

OFFFFFFFFFFFFF


source ~/.bash_profile


(5) 初始化数据库

/postgresql/app/postgresql/bin/initdb -D /postgresql/data -E UTF8 --lc-collate=C --lc-ctype=en_US.utf8 -U postgres


(6) 编译遇到问题
1) error: Package requirements (liblz4) were not met

dnf -y install lz4-devel

2) error: could not find function 'gss_init_sec_context' required for GSSAPI

dnf -y install  krb5-devel

3) error: library 'uuid' is required for E2FS UUID

dnf -y install libuuid 

dnf -y install libuuid-devel


 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

の正在缓存99%

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值