1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| # root groupadd postgres useradd -g postgres -m postgres passwd postgres
yum install perl-ExtUtils-Embed pam-devel libxml2-devel libxslt-devel openldap-devel python39-devel openssl-devel cmake readline-devel gcc -y mkdir /usr/local/pg14 -p mkdir /usr/local/pg14/data -p chown -R postgres:postgres /usr/local/pg14
# postgres su - postgres mkdir downloads cd downloads
# wget http://file.yangtiancheng.cn/pg/postgresql-14.2.tar.gz - 或者手动移入 wget https://ftp.postgresql.org/pub/source/v14.2/postgresql-14.2.tar.gz --no-check-certificate tar -zxvf postgresql-14.2.tar.gz chown -R postgres:postgres postgresql-14.2 && cd postgresql-14.2
# 运行 ./configure --prefix=/usr/local/pg14
# 编译 make -j8 world && make install-world make contrib -j8 && make install # 编译插件 或 make -j8 && make install
# 设置环境变量 vim ~/.bash_profile
export PATH=/usr/local/pg14/bin:$PATH export PGHOME=/usr/local/pg14 export PGDATA=$PGHOME/data export PGUSER=postgres # export PGPORT=5432
source ~/.bash_profile
# 创建出具库集簇 initdb
|