1、创建用户
useradd postgres
2、安装依赖包:
yum groupinstall -y "Development Tools" "Legacy UNIX Compatibility"
yum install -y bison flex readline* zlib-devel gcc* gmake
3、创建目录并授权
mkdir -p /usr/local/pg12
mkdir -p /pgdata/12/data
chown -R postgresql. /pgdata
chown -R postgresql. /usr/local/pg12
chmod -R 700 /pgdata/12/data
4、系统参数优化
vi /etc/sysctl.conf
kernel.shmmax = 68719476736
kernel.shmall=4294967296
kernel.sem = 50100 64128000 50100 12800
fs.file-max = 7672460
net.ipv4.ip_local_port_range = 9000 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
vi /etc/security/limits.conf
* soft nofile 131072
* hard nofile 131072
* soft nproc 131072
* hard nproc 131072
* soft core unlimited