1、rpm -q readline readline-devel zlib zlib-devel gettext gettext-devel openssl openssl-devel pam pam-devel libxml2 libxml2-devel libxslt libxslt-devel perl perl-devel tcl-devel uuid-devel gcc gcc-c++ make flex bison perl-ExtUtils-Embed.noarch python-devel openldap-devel systemd-devel libicu libicu-devel numactl cracklib-devel cracklib-python
[root@C07VS3090 ~]# rpm -q readline readline-devel zlib zlib-devel gettext gettext-devel openssl openssl-devel pam pam-devel libxml2 libxml2-devel libxslt libxslt-devel perl perl-devel tcl-devel uuid-devel gcc gcc-c++ make flex bison perl-ExtUtils-Embed.noarch python-devel openldap-devel systemd-devel libicu libicu-devel numactl cracklib-devel cracklib-python
readline-7.0-10.el8.x86_64
readline-7.0-10.el8.i686
package readline-devel is not installed
zlib-1.2.11-26.el8.x86_64
zlib-devel-1.2.11-26.el8.x86_64
gettext-0.19.8.1-17.el8.x86_64
package gettext-devel is not installed
openssl-1.1.1k-14.el8_10.x86_64
package openssl-devel is not installed
pam-1.3.1-38.el8_10.x86_64
package pam-devel is not installed
libxml2-2.9.7-21.el8_10.3.x86_64
package libxml2-devel is not installed
libxslt-1.1.32-6.3.el8_10.x86_64
package libxslt-devel is not installed
perl-5.26.3-423.el8_10.x86_64
perl-devel-5.26.3-423.el8_10.x86_64
package tcl-devel is not installed
package uuid-devel is not installed
gcc-8.5.0-28.el8_10.x86_64
gcc-c+±8.5.0-28.el8_10.x86_64
make-4.2.1-11.el8.x86_64
package flex is not installed
package bison is not installed
perl-ExtUtils-Embed-1.34-423.el8_10.noarch
package python-devel is not installed
package openldap-devel is not installed
package systemd-devel is not installed
libicu-60.3-2.el8_1.x86_64
package libicu-devel is not installed
package numactl is not installed
package cracklib-devel is not installed
package cracklib-python is not installed
2、
yum install -y readline-devel.x86_64
yum install -y zlib-devel.x86_64
yum install -y gettext-devel.x86_64
yum list openssl*
yum install -y openssl-devel.x86_64
yum list libxml2*
yum install -y libxml2-devel.x86_64
yum list libxslt*
yum install -y libxslt.x86_64 libxslt-devel.x86_64
yum install -y perl.x86_64 perl-devel.x86_64
yum list tcl*
yum install -y tcl.x86_64 tcl-devel.x86_64
yum list uuid* -y
yum install -y uuid.x86_64
yum list gcc*
yum install -y gcc.x86_64 gcc-c++.x86_64
yum install -y bison.x86_64 flex.x86_64
yum install -y openldap-devel
yum install -y systemd.x86_64 systemd-devel.x86_64
yum install -y libicu.x86_64 libicu-devel.x86_64
yum install -y python36 python36-devel python3-pip.noarch
3、 创建操作系统用户和组
groupadd -g 2000 postgres
useradd -u 2000 -g postgres postgres
echo “E7dq92Hx”|passwd --stdin postgres
mkdir /data
chown -R postgres:postgres /data
su - postgres
mkdir -p /data/pg15.14/pgdata
mkdir -p /data/pg15.14/pgarch
mkdir -p /data/pg15.14/backup
chmod -R 700 /data/pg15.14
4、从官网下载源码安装包postgresql-15.14.tar.bz2
tar -jxvf postgresql-15.14.tar.bz2
cd postgresql-15.14
./configure --prefix=/data/pg15.14/ --with-pgport=5432 --with-perl --with-python --with-tcl --with-tclconfig= --with-gssapi --with-icu --with-openssl --with-pam --with-ldap --with-systemd --with-readline --with-libxml --with-libxslt --with-segsize=1 --with-blocksize=8 --with-wal-blocksize=8 --with-zlib
make world -j4
make install-world -j4
5、下载passwordkcheck-enhance-for-postgresql-main.zip并存放到安装介质的postgresql-15.14/contrib/目录下
cp passwordkcheck-enhance-for-postgresql-main.zip postgresql-15.14/contrib/
cd postgresql-15.14/contrib/
ls -l passwordkcheck-enhance-for-postgresql-main.zip
unzip passwordkcheck-enhance-for-postgresql-main.zip
cd passwordkcheck-enhance-for-postgresql-main
make
make install
6、设置环境变量
su - postgres
vi .bash_profile
export PGHOME=/data/pg15.14
export PGDATA=/data/pg15.14/pgdata
export PGPORT=5432
export PATH=$PGHOME/bin:$PATH
export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH
立即生效
source /home/postgres/.bash_profile
7、初始化数据库
chmod 755 -R /data/pg15.14
su - postgres
initdb -D /data/pg15.14/pgdata -E UTF8 --locale=C -U postgres -W
ls -l /usr/lib/systemd/system/
vi /usr/lib/systemd/system/postgresqld.service
将以下这段内容复制到/usr/lib/systemd/system/postgresqld.service中
[Unit]
Description=PostgreSQL database server
Documentation=man:postgres(1)
[Service]
Type=notify
User=postgres
ExecStart=/data/pg15.14/bin/postgres -D /data/pg15.14/pgdata
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable postgresqld.service
systemctl start postgresqld.service
systemctl status postgresqld.service
539

被折叠的 条评论
为什么被折叠?



