postgresql 12 TDE 操作系统准备

所有步骤与 PostgreSQL 操作系统准备 相同

1 开放防火墙端口

systemctl stop firewalld
systemctl disable  firewalld
# 
firewall-cmd --permanent --zone=public --add-port=5432/tcp
firewall-cmd --reload

2 关闭 SElinux

sed -i 's/SELINUX=enforcing/SELINUX=disabled/g'  /etc/selinux/config 

3 创建用户

root>
groupadd postgres
useradd -g postgres postgres
echo postgres|passwd --stdin postgres

4 创建相关目录

root>
mkdir -p  /soft
mkdir -p /usr/local/pgsql
chown postgres:postgres /soft  /usr/local/pgsql

5 配置用户环境变量

su - postgres

cat >> ~/.bash_profile << EOF
export PGPORT=5432
export PGHOME=/usr/local/pgsql
export PATH=\$PGHOME/bin:\$PATH
export PGDATA=\$PGHOME/data
export LD_LIBRARY_PATH=\$PGHOME/lib
export LANG=en_US.UTF-8
EOF
source ~/.bash_profile

6 打开Postgres 用户的资源限制

root# vi /etc/security/limits.conf
postgres soft  nproc   65536
postgres  hard  nproc   65536
postgres  soft  nofile  65536
postgres  hard  nofile  65536
postgres  soft  stack   65536
postgres  hard  stack   65536
postgres soft core unlimited
postgres hard core unlimited

7 配置内核参数

root>
cat >> /etc/sysctl.conf << EOF
kernel.shmmax= 68719476736(默认)#最大共享内存段大小
kernel.shmall= 4294967296(默认)#可以使用的共享内存的总量
kernel.shmmni= 4096#整个系统共享内存段的最大数目
kernel.sem= 50100 64128000 50100 1280 #每个信号对象集的最大信号对象数
fs.file-max = 7672460 #文件句柄的最大数量。
net.ipv4.ip_local_port_range= 9000 65000 #应用程序可使用的IPv4端口范围
net.core.rmem_default= 1048576 #套接字接收缓冲区大小的缺省值
net.core.wmem_default= 262144 #套接字发送缓冲区大小的缺省值
net.core.wmem_max= 1048576 #套接字发送缓冲区大小的最大值
EOF
# 生效内核参数
sysctl -p

8 安装软件依赖包

8.1 最小依赖包

root>
yum install gcc gcc-c++ zlib-devel readline-devel wget psmisc tcl tcl-devel tk-devel -y 

8.2 全部依赖包

root>
yum install gcc gcc-c++ zlib-devel readline-devel wget psmisc perl-ExtUtils-Embed pam-devel libxml2-devel libxslt-devel openldap-devel python39-devel python2-devel openssl-devel cmake  tcl tcl-devel tk-devel libicu-devel bash-completion systemd-devel  bison flex docbook-dtds docbook-style-xsl  libxslt git wget vim -y 

8.4 LLVM JIT 环境配置

想要让postgresql 支持JIT ,请配置 LLVM 环境。

9 配置中文环境(可选)

Linux 语言环境 安装中文语言包

10 源码下载

postgres> 
cd /soft
wget https://download.cybertec-postgresql.com/postgresql-12.3_TDE_1.0.tar.gz
Warning

这里用python2 还是python3 ,官网两种都支持。所以都安装。
快照为:DB_INSTALL_ENV