postgreSQL入门(上)
postgreSQL环境选择
postgreSQL支持centos、麒麟、openEuler等linux发行版,本文选择使用openEuler22.03LTS,内核版本为linux5.10。使用该发行版的原因是本人曾参与过openEuler开发,最近研发的新特性如IO数据预取算法、etmem内存交换技术等可以有效提升数据库相关性能指标。
postSQL编译安装
- 下载源码,本文以postgresql13.8为例:https://www.postgresql.org/ftp/source/v13.8/
- 配置postsql所需环境变量,为方便复用,将其写入脚本env.sh:
PGHOME=/root/postgresql-13.8/target-debug
export PGDATA=127.0.0.1
export PGHOST=$PGDATA
export PGPORT=5432
export LD_LIBRARY_PATH=$PGHOME/lib
export PATH=$PGHOME/bin:$PATH
- 将构建流程写入脚本compile.sh:
#!/bin/bash
make distclean
./configure --prefix=$PGHOME \
--enable-debug \
CCFLAG="-g -O0" CC='gcc'
make -j 64 world
make install-world
cd ..
echo 'Run Sucessful.'
- 开始编译安装:
source env.sh
source compile.sh
目录内即为编译安装后的输出