PostgreSQL源码编译安装

52 阅读22分钟

2.3 源码编译安装PostgreSQL

2.3.1 下载并解压缩源码包

PostgreSQL源码包下载,去“www.postgresql.org/ftp/source”…

t6

图6 下载PostgreSQL源码包

然后下载源码包“postgresql-17.6.tar.gz”。

t7

图7 下载PostgreSQL源码包

1# Rocky、Almalinux、CentOS、AnolisOS、OpenCloudOS、Kylin Server默认没有wget包,需要安装


2yum install -y wget


3


4# openEuler 22.03/24.03 LTS、AnolisOS 23、OpenCloudOS 9没有安装tar包,需要安装


5yum install -y tar


6


7cd /usr/local/src


8


9# 下载解压缩


10wget https://ftp.postgresql.org/pub/source/v17.6/postgresql-17.6.tar.gz 


11tar xf postgresql-17.6.tar.gz

2.3.2 源码编译安装PostgreSQL

编译安装参数解释:

1./configure # 准备PostgreSQL的编译环境


2--prefix # 指定 PostgreSQL 安装目录


3--with-openssl # 启用 OpenSSL 支持


4--with-libxml # 启用 XML 支持


5--with-systemd # 启用 Systemd 支持

2.3.2.1 Rocky 8/9/10、AlmaLinux 8/9/10、CentOS 7、CentOS Stream 8/9/10、OpenCloudOS 8

进入PostgreSQL包解压的目录:

1cd postgresql-17.6

执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: no acceptable C compiler found in $PATH # 提示,在$PATH中找不到可接受的C编译器,需要安装gcc


4See `config.log' for more details

安装gcc包:

1yum install -y gcc

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for icu-uc icu-i18n... no


4configure: error: ICU library not found # 提示,未找到 ICU 库


5If you have ICU already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-icu to disable ICU support.

安装libicu-devel包:

1yum install -y libicu-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for bison... no


4configure: error: bison not found # 提示,未找到bison

安装bison包:

1yum install -y bison

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for flex... no


4configure: error: flex not found # 提示,未找到flex

安装flex包:

1yum install -y flex

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for perl... no


4configure: error: Perl not found # 提示,未找到Perl

安装perl包:

1yum install -y perl

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for library containing readline... no


4configure: error: readline library not found  # 提示,未找到readline库


5If you have readline already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-readline to disable readline support.

安装readline-devel包:

1yum install -y readline-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: zlib library not found # 提示,为找到zlib库


4If you have zlib already installed, see config.log for details on the


5failure.  It is possible the compiler isn't looking in the proper directory.


6Use --without-zlib to disable zlib support.

安装zlib-devel包:

1yum install -y zlib-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for CRYPTO_new_ex_data in -lcrypto... no


4configure: error: library 'crypto' is required for OpenSSL # 提示,需要库 'crypto' 来支持 OpenSSL

安装openssl-devel包:

1yum install -y openssl-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for xmlSaveToBuffer in -lxml2... no


4configure: error: library 'xml2' (version >= 2.6.23) is required for XML support # 提示,需要库 'xml2'(版本 >= 2.6.23)以支持 XML

安装libxml2-devel包:

1yum install -y libxml2-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: header file <systemd/sd-daemon.h> is required for systemd support # 提示,需要头文件  以支持 systemd

安装systemd-devel包:

1yum install -y systemd-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1# 默认 make 不包括文档和其它模块,$(nproc)表示当产主机的CPU核心


2make -j $(nproc) world


3...


4make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/isolation'


5make -C test/perl all


6make[2]: Entering directory '/usr/local/src/postgresql-17.6/src/test/perl'


7make[2]: Nothing to be done for 'all'.


8make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/perl'


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/src'

执行make install:

1# 默认 make install 不包括安装文档


2make install-world


3...


4make[3]: *** [Makefile:72: postgres-full.xml] Error 1


5make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


6make[2]: *** [Makefile:8: install] Error 2


7make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


8make[1]: *** [Makefile:16: install] Error 2


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


10make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

从“www.postgresql.org/docs/curren…

1yum install -y docbook-dtds docbook-style-xsl libxslt

重新执行make install:

1make install-world


2。。。


3/usr/bin/mkdir -p '/apps/pgsql/lib'


4/usr/bin/mkdir -p '/apps/pgsql/share/extension'


5/usr/bin/mkdir -p '/apps/pgsql/share/extension'


6/usr/bin/install -c -m 755  pgxml.so '/apps/pgsql/lib/pgxml.so'


7/usr/bin/install -c -m 644 ./xml2.control '/apps/pgsql/share/extension/'


8/usr/bin/install -c -m 644 ./xml2--1.1.sql ./xml2--1.0--1.1.sql  '/apps/pgsql/share/extension/'


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/xml2'


10make[1]: Leaving directory '/usr/local/src/postgresql-17.6/contrib'

总结编译过程:

1# 安装依赖包


2yum install -y gcc libicu-devel bison flex perl readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel docbook-dtds docbook-style-xsl libxslt


3


4# 进入PostgreSQL包解压的目录:


5cd postgresql-17.6


6


7# 执行configure


8./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


9


10# 执行make


11make -j $(nproc) world


12


13# 执行make install


14make install-world

2.3.2.2 openEuler 22.03/24.03 LTS

进入PostgreSQL包解压的目录:

1cd postgresql-17.6

执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: no acceptable C compiler found in $PATH # 提示,在$PATH中找不到可接受的C编译器,需要安装gcc


4See `config.log' for more details

安装gcc包:

1yum install -y gcc

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for icu-uc icu-i18n... no


4configure: error: ICU library not found # 提示,未找到 ICU 库


5If you have ICU already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-icu to disable ICU support.

安装libicu-devel包:

1yum install -y libicu-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for bison... no


4configure: error: bison not found # 提示,未找到bison

安装bison包:

1yum install -y bison

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for flex... no


4configure: error: flex not found # 提示,未找到flex

安装flex包:

1yum install -y flex

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for library containing readline... no


4configure: error: readline library not found  # 提示,未找到readline库


5If you have readline already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-readline to disable readline support.

安装readline-devel包:

1yum install -y readline-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: zlib library not found # 提示,为找到zlib库


4If you have zlib already installed, see config.log for details on the


5failure.  It is possible the compiler isn't looking in the proper directory.


6Use --without-zlib to disable zlib support.

安装zlib-devel包:

1yum install -y zlib-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for CRYPTO_new_ex_data in -lcrypto... no


4configure: error: library 'crypto' is required for OpenSSL # 提示,需要库 'crypto' 来支持 OpenSSL

安装openssl-devel包:

1yum install -y openssl-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for xmlSaveToBuffer in -lxml2... no


4configure: error: library 'xml2' (version >= 2.6.23) is required for XML support # 提示,需要库 'xml2'(版本 >= 2.6.23)以支持 XML

安装libxml2-devel包:

1yum install -y libxml2-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: header file <systemd/sd-daemon.h> is required for systemd support # 提示,需要头文件  以支持 systemd

安装systemd-devel包:

1yum install -y systemd-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1# 默认 make 不包括文档和其它模块,$(nproc)表示当产主机的CPU核心


2make -j $(nproc) world


3...


4make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/isolation'


5make -C test/perl all


6make[2]: Entering directory '/usr/local/src/postgresql-17.6/src/test/perl'


7make[2]: Nothing to be done for 'all'.


8make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/perl'


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/src'

执行make install:

1# 默认 make install 不包括安装文档


2make install-world


3...


4make[3]: *** [Makefile:72: postgres-full.xml] Error 1


5make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


6make[2]: *** [Makefile:8: install] Error 2


7make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


8make[1]: *** [Makefile:16: install] Error 2


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


10make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

从“www.postgresql.org/docs/curren…

1yum install -y docbook-dtds docbook-style-xsl libxslt

重新执行make install:

1make install-world


2...


3ERROR: `xsltproc' is missing on your system.


4***


5make[3]: *** [Makefile:130: html-stamp] Error 1


6make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


7make[2]: *** [Makefile:8: install] Error 2


8make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


9make[1]: *** [Makefile:16: install] Error 2


10make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


11make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

重新执行configure:

1# 再次执行make之前先清理之前的操作


2make clean


3


4./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1make -j $(nproc) world

重新执行make install:

1make install-world


2。。。


3make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/sslinfo'


4make -C xml2 install


5make[2]: Entering directory '/usr/local/src/postgresql-17.6/contrib/xml2'


6/usr/bin/mkdir -p '/apps/pgsql/lib'


7/usr/bin/mkdir -p '/apps/pgsql/share/extension'


8/usr/bin/mkdir -p '/apps/pgsql/share/extension'


9/usr/bin/install -c -m 755  pgxml.so '/apps/pgsql/lib/pgxml.so'


10/usr/bin/install -c -m 644 ./xml2.control '/apps/pgsql/share/extension/'


11/usr/bin/install -c -m 644 ./xml2--1.1.sql ./xml2--1.0--1.1.sql  '/apps/pgsql/share/extension/'


12make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/xml2'


13make[1]: Leaving directory '/usr/local/src/postgresql-17.6/contrib'

总结编译过程:

1# 安装依赖包


2yum install -y gcc libicu-devel bison flex readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel docbook-dtds docbook-style-xsl libxslt


3


4# 进入PostgreSQL包解压的目录:


5cd postgresql-17.6


6


7# 执行configure


8./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


9


10# 执行make


11make -j $(nproc) world


12


13# 执行make install


14make install-world

2.3.2.3 AnolisOS 23

进入PostgreSQL包解压的目录:

1cd postgresql-17.6

执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: no acceptable C compiler found in $PATH # 提示,在$PATH中找不到可接受的C编译器,需要安装gcc


4See `config.log' for more details

安装gcc包:

1yum install -y gcc

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for icu-uc icu-i18n... no


4configure: error: ICU library not found # 提示,未找到 ICU 库


5If you have ICU already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-icu to disable ICU support.

安装libicu-devel包:

1yum install -y libicu-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for bison... no


4configure: error: bison not found # 提示,未找到bison

安装bison包:

1yum install -y bison

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for flex... no


4configure: error: flex not found # 提示,未找到flex

安装flex包:

1yum install -y flex

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for library containing readline... no


4configure: error: readline library not found  # 提示,未找到readline库


5If you have readline already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-readline to disable readline support.

安装readline-devel包:

1yum install -y readline-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: zlib library not found # 提示,为找到zlib库


4If you have zlib already installed, see config.log for details on the


5failure.  It is possible the compiler isn't looking in the proper directory.


6Use --without-zlib to disable zlib support.

安装zlib-devel包:

1yum install -y zlib-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for CRYPTO_new_ex_data in -lcrypto... no


4configure: error: library 'crypto' is required for OpenSSL # 提示,需要库 'crypto' 来支持 OpenSSL

安装openssl-devel包:

1yum install -y openssl-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for xmlSaveToBuffer in -lxml2... no


4configure: error: library 'xml2' (version >= 2.6.23) is required for XML support # 提示,需要库 'xml2'(版本 >= 2.6.23)以支持 XML

安装libxml2-devel包:

1yum install -y libxml2-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: header file <systemd/sd-daemon.h> is required for systemd support # 提示,需要头文件  以支持 systemd

安装systemd-devel包:

1yum install -y systemd-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1# 默认 make 不包括文档和其它模块,$(nproc)表示当产主机的CPU核心


2make -j $(nproc) world


3...


4Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC contains: /usr/local/lib64/perl5/5.36 /usr/local/share/perl5/5.36 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at gen_node_support.pl line 24. # 提示,perl缺少FindBin.pm模块


5BEGIN failed--compilation aborted at gen_node_support.pl line 24.


6Can't locate FindBin.pm in @INC (you may need to install the FindBin module) (@INC contains: /usr/local/lib64/perl5/5.36 /usr/local/share/perl5/5.36 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5) at ../../../src/backend/catalog/genbki.pl line 20.


7BEGIN failed--compilation aborted at ../../../src/backend/catalog/genbki.pl line 20.


8make[2]: *** [Makefile:141: bki-stamp] Error 2


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/include/catalog'


10make[1]: *** [Makefile:121: submake-catalog-headers] Error 2


11make[1]: *** Waiting for unfinished jobs....


12make[2]: *** [Makefile:78: node-support-stamp] Error 2


13make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/backend/nodes'


14make[1]: *** [Makefile:125: submake-nodes-headers] Error 2


15make[1]: Leaving directory '/usr/local/src/postgresql-17.6/src/backend'


16make: *** [src/Makefile.global:384: submake-generated-headers] Error 2

安装perl-FindBin和perl-core包:

1yum install -y perl-FindBin perl-core

执行make:

1make -j $(nproc) world

执行make install:

1# 默认 make install 不包括安装文档


2make install-world


3...


4make[3]: *** [Makefile:72: postgres-full.xml] Error 1


5make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


6make[2]: *** [Makefile:8: install] Error 2


7make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


8make[1]: *** [Makefile:16: install] Error 2


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


10make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

从“www.postgresql.org/docs/curren…

1yum install -y docbook-dtds docbook-style-xsl libxslt

重新执行configure:

1# 再次执行make之前先清理之前的操作


2make clean


3


4./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1make -j $(nproc) world

重新执行make install:

1make install-world


2。。。


3/usr/bin/mkdir -p '/apps/pgsql/lib'


4/usr/bin/mkdir -p '/apps/pgsql/share/extension'


5/usr/bin/mkdir -p '/apps/pgsql/share/extension'


6/usr/bin/install -c -m 755  pgxml.so '/apps/pgsql/lib/pgxml.so'


7/usr/bin/install -c -m 644 ./xml2.control '/apps/pgsql/share/extension/'


8/usr/bin/install -c -m 644 ./xml2--1.1.sql ./xml2--1.0--1.1.sql  '/apps/pgsql/share/extension/'


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/xml2'


10make[1]: Leaving directory '/usr/local/src/postgresql-17.6/contrib'

总结编译过程:

1# 安装依赖包


2yum install -y gcc libicu-devel bison flex readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel perl-FindBin perl-core docbook-dtds docbook-style-xsl libxslt


3


4# 进入PostgreSQL包解压的目录:


5cd postgresql-17.6


6


7# 执行configure


8./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


9


10# 执行make


11make -j $(nproc) world


12


13# 执行make install


14make install-world

2.3.2.4 AnolisOS 8

进入PostgreSQL包解压的目录:

1cd postgresql-17.6

执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: no acceptable C compiler found in $PATH # 提示,在$PATH中找不到可接受的C编译器,需要安装gcc


4See `config.log' for more details

安装gcc包:

1yum install -y gcc

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for icu-uc icu-i18n... no


4configure: error: ICU library not found # 提示,未找到 ICU 库


5If you have ICU already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-icu to disable ICU support.

安装libicu-devel包:

1yum install -y libicu-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for bison... no


4configure: error: bison not found # 提示,未找到bison

安装bison包:

1yum install -y bison

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for flex... no


4configure: error: flex not found # 提示,未找到flex

安装flex包:

1yum install -y flex

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for library containing readline... no


4configure: error: readline library not found  # 提示,未找到readline库


5If you have readline already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-readline to disable readline support.

安装readline-devel包:

1yum install -y readline-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: zlib library not found # 提示,为找到zlib库


4If you have zlib already installed, see config.log for details on the


5failure.  It is possible the compiler isn't looking in the proper directory.


6Use --without-zlib to disable zlib support.

安装zlib-devel包:

1yum install -y zlib-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for CRYPTO_new_ex_data in -lcrypto... no


4configure: error: library 'crypto' is required for OpenSSL # 提示,需要库 'crypto' 来支持 OpenSSL

安装openssl-devel包:

1yum install -y openssl-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for xmlSaveToBuffer in -lxml2... no


4configure: error: library 'xml2' (version >= 2.6.23) is required for XML support # 提示,需要库 'xml2'(版本 >= 2.6.23)以支持 XML

安装libxml2-devel包:

1yum install -y libxml2-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: header file <systemd/sd-daemon.h> is required for systemd support # 提示,需要头文件  以支持 systemd

安装systemd-devel包:

1yum install -y systemd-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1yum install -y make


2


3# 默认 make 不包括文档和其它模块,$(nproc)表示当产主机的CPU核心


4make -j $(nproc) world


5...


6make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/isolation'


7make -C test/perl all


8make[2]: Entering directory '/usr/local/src/postgresql-17.6/src/test/perl'


9make[2]: Nothing to be done for 'all'.


10make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/perl'


11make[1]: Leaving directory '/usr/local/src/postgresql-17.6/src'

执行make install:

1# 默认 make install 不包括安装文档


2make install-world


3...


4make[3]: *** [Makefile:72: postgres-full.xml] Error 1


5make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


6make[2]: *** [Makefile:8: install] Error 2


7make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


8make[1]: *** [Makefile:16: install] Error 2


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


10make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

从“www.postgresql.org/docs/curren…

1yum install -y docbook-dtds docbook-style-xsl libxslt

重新执行make install:

1make install-world


2。。。


3/usr/bin/mkdir -p '/apps/pgsql/lib'


4/usr/bin/mkdir -p '/apps/pgsql/share/extension'


5/usr/bin/mkdir -p '/apps/pgsql/share/extension'


6/usr/bin/install -c -m 755  pgxml.so '/apps/pgsql/lib/pgxml.so'


7/usr/bin/install -c -m 644 ./xml2.control '/apps/pgsql/share/extension/'


8/usr/bin/install -c -m 644 ./xml2--1.1.sql ./xml2--1.0--1.1.sql  '/apps/pgsql/share/extension/'


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/xml2'


10make[1]: Leaving directory '/usr/local/src/postgresql-17.6/contrib'

总结编译过程:

1# 安装依赖包


2yum install -y gcc libicu-devel bison flex readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel make docbook-dtds docbook-style-xsl libxslt


3


4# 进入PostgreSQL包解压的目录:


5cd postgresql-17.6


6


7# 执行configure


8./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


9


10# 执行make


11make -j $(nproc) world


12


13# 执行make install


14make install-world

2.3.2.5 OpenCloudOS 9、Kylin Server V10/V11

进入PostgreSQL包解压的目录:

1cd postgresql-17.6

执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: no acceptable C compiler found in $PATH # 提示,在$PATH中找不到可接受的C编译器,需要安装gcc


4See `config.log' for more details

安装gcc包:

1yum install -y gcc

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for icu-uc icu-i18n... no


4configure: error: ICU library not found # 提示,未找到 ICU 库


5If you have ICU already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-icu to disable ICU support.

安装libicu-devel包:

1yum install -y libicu-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for bison... no


4configure: error: bison not found # 提示,未找到bison

安装bison包:

1yum install -y bison

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for flex... no


4configure: error: flex not found # 提示,未找到flex

安装flex包:

1yum install -y flex

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for perl... no


4configure: error: Perl not found # 提示,未找到Perl

安装perl包:

1yum install -y perl

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for library containing readline... no


4configure: error: readline library not found  # 提示,未找到readline库


5If you have readline already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-readline to disable readline support.

安装readline-devel包:

1yum install -y readline-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: zlib library not found # 提示,为找到zlib库


4If you have zlib already installed, see config.log for details on the


5failure.  It is possible the compiler isn't looking in the proper directory.


6Use --without-zlib to disable zlib support.

安装zlib-devel包:

1yum install -y zlib-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for CRYPTO_new_ex_data in -lcrypto... no


4configure: error: library 'crypto' is required for OpenSSL # 提示,需要库 'crypto' 来支持 OpenSSL

安装openssl-devel包:

1yum install -y openssl-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for xmlSaveToBuffer in -lxml2... no


4configure: error: library 'xml2' (version >= 2.6.23) is required for XML support # 提示,需要库 'xml2'(版本 >= 2.6.23)以支持 XML

安装libxml2-devel包:

1yum install -y libxml2-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: header file <systemd/sd-daemon.h> is required for systemd support # 提示,需要头文件  以支持 systemd

安装systemd-devel包:

1yum install -y systemd-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1# 默认 make 不包括文档和其它模块,$(nproc)表示当产主机的CPU核心


2make -j $(nproc) world


3...


4make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/isolation'


5make -C test/perl all


6make[2]: Entering directory '/usr/local/src/postgresql-17.6/src/test/perl'


7make[2]: Nothing to be done for 'all'.


8make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/perl'


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/src'

执行make install:

1# 默认 make install 不包括安装文档


2make install-world


3...


4make[3]: *** [Makefile:72: postgres-full.xml] Error 1


5make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


6make[2]: *** [Makefile:8: install] Error 2


7make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


8make[1]: *** [Makefile:16: install] Error 2


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


10make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

从“www.postgresql.org/docs/curren…

1yum install -y docbook-dtds docbook-style-xsl libxslt

重新执行make install:

make install-world
...
ERROR: `xsltproc' is missing on your system.
***
make[3]: *** [Makefile:130: html-stamp] Error 1
make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'
make[2]: *** [Makefile:8: install] Error 2
make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'
make[1]: *** [Makefile:16: install] Error 2
make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'
make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

重新执行configure:

1# 再次执行make之前先清理之前的操作


2make clean


3


4./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1make -j $(nproc) world

重新执行make install:

1make install-world


2。。。


3make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/sslinfo'


4make -C xml2 install


5make[2]: Entering directory '/usr/local/src/postgresql-17.6/contrib/xml2'


6/usr/bin/mkdir -p '/apps/pgsql/lib'


7/usr/bin/mkdir -p '/apps/pgsql/share/extension'


8/usr/bin/mkdir -p '/apps/pgsql/share/extension'


9/usr/bin/install -c -m 755  pgxml.so '/apps/pgsql/lib/pgxml.so'


10/usr/bin/install -c -m 644 ./xml2.control '/apps/pgsql/share/extension/'


11/usr/bin/install -c -m 644 ./xml2--1.1.sql ./xml2--1.0--1.1.sql  '/apps/pgsql/share/extension/'


12make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/xml2'


13make[1]: Leaving directory '/usr/local/src/postgresql-17.6/contrib'

总结编译过程:

1# 安装依赖包


2yum install -y gcc libicu-devel bison flex perl readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel docbook-dtds docbook-style-xsl libxslt


3


4# 进入PostgreSQL包解压的目录:


5cd postgresql-17.6


6


7# 执行configure


8./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


9


10# 执行make


11make -j $(nproc) world


12


13# 执行make install


14make install-world

2.3.2.6 UOS Server V20

进入PostgreSQL包解压的目录:

1cd postgresql-17.6

执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for icu-uc icu-i18n... no


4configure: error: ICU library not found # 提示,未找到 ICU 库


5If you have ICU already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-icu to disable ICU support.

安装libicu-devel包:

1yum install -y libicu-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for bison... no


4configure: error: bison not found # 提示,未找到bison

安装bison包:

1yum install -y bison

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for flex... no


4configure: error: flex not found # 提示,未找到flex

安装flex包:

1yum install -y flex

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for library containing readline... no


4configure: error: readline library not found  # 提示,未找到readline库


5If you have readline already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-readline to disable readline support.

安装readline-devel包:

1yum install -y readline-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: header file <systemd/sd-daemon.h> is required for systemd support # 提示,需要头文件  以支持 systemd

安装systemd-devel包:

1yum install -y systemd-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1# 默认 make 不包括文档和其它模块,$(nproc)表示当产主机的CPU核心


2make -j $(nproc) world


3...


4make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/isolation'


5make -C test/perl all


6make[2]: Entering directory '/usr/local/src/postgresql-17.6/src/test/perl'


7make[2]: Nothing to be done for 'all'.


8make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/perl'


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/src'

执行make install:

1# 默认 make install 不包括安装文档


2make install-world


3...


4make[3]: *** [Makefile:72: postgres-full.xml] Error 1


5make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


6make[2]: *** [Makefile:8: install] Error 2


7make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


8make[1]: *** [Makefile:16: install] Error 2


9make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


10make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

从“www.postgresql.org/docs/curren…

1yum install -y docbook-dtds docbook-style-xsl libxslt

重新执行make install:

1make install-world


2。。。


3/usr/bin/mkdir -p '/apps/pgsql/lib'


4/usr/bin/mkdir -p '/apps/pgsql/share/extension'


5/usr/bin/mkdir -p '/apps/pgsql/share/extension'


6/usr/bin/install -c -m 755  pgxml.so '/apps/pgsql/lib/pgxml.so'


7/usr/bin/install -c -m 644 ./xml2.control '/apps/pgsql/share/extension/'


8/usr/bin/install -c -m 644 ./xml2--1.1.sql ./xml2--1.0--1.1.sql  '/apps/pgsql/share/extension/'


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/xml2'


10make[1]: Leaving directory '/usr/local/src/postgresql-17.6/contrib'

总结编译过程:

1# 安装依赖包


2yum install -y libicu-devel bison flex perl readline-devel systemd-devel docbook-dtds docbook-style-xsl libxslt


3


4# 进入PostgreSQL包解压的目录:


5cd postgresql-17.6


6


7# 执行configure


8./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


9


10# 执行make


11make -j $(nproc) world


12


13# 执行make install


14make install-world

2.3.2.7 openSUSE 15

进入PostgreSQL包解压的目录:

1cd postgresql-17.6

执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: no acceptable C compiler found in $PATH # 提示,在$PATH中找不到可接受的C编译器,需要安装gcc


4See `config.log' for more details

安装gcc包:

1zypper install -y gcc

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for icu-uc icu-i18n... no


4configure: error: ICU library not found # 提示,未找到 ICU 库


5If you have ICU already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-icu to disable ICU support.

安装libicu-devel包:

1zypper install -y libicu-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for bison... no


4configure: error: bison not found # 提示,未找到bison

安装bison包:

1zypper install -y bison

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for flex... no


4configure: error: flex not found # 提示,未找到flex

安装flex包:

1zypper install -y flex

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for library containing readline... no


4configure: error: readline library not found  # 提示,未找到readline库


5If you have readline already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-readline to disable readline support.

安装readline-devel包:

1zypper install -y readline-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: zlib library not found # 提示,为找到zlib库


4If you have zlib already installed, see config.log for details on the


5failure.  It is possible the compiler isn't looking in the proper directory.


6Use --without-zlib to disable zlib support.

安装zlib-devel包:

1zypper install -y zlib-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for CRYPTO_new_ex_data in -lcrypto... no


4configure: error: library 'crypto' is required for OpenSSL # 提示,需要库 'crypto' 来支持 OpenSSL

安装openssl-devel包:

1zypper install -y openssl-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for xmlSaveToBuffer in -lxml2... no


4configure: error: library 'xml2' (version >= 2.6.23) is required for XML support # 提示,需要库 'xml2'(版本 >= 2.6.23)以支持 XML

安装libxml2-devel包:

1zypper install -y libxml2-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: header file <systemd/sd-daemon.h> is required for systemd support # 提示,需要头文件  以支持 systemd

安装systemd-devel包:

1zypper install -y systemd-devel

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1zypper install -y make


2


3# 默认 make 不包括文档和其它模块,$(nproc)表示当产主机的CPU核心


4make -j $(nproc) world


5...


6make[3]: *** [Makefile:72: postgres-full.xml] Error 1


7make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


8make[2]: *** [Makefile:8: all] Error 2


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


10make[1]: *** [Makefile:16: all] Error 2


11make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


12make: *** [GNUmakefile:16: world-doc-recurse] Error 2

从“www.postgresql.org/docs/curren…

1zypper install -y docbook-xsl-stylesheets

重新执行configure:

1# 再次执行make之前先清理之前的操作


2make clean


3


4./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

重新执行make:

1make -j $(nproc) world

执行make install:

1# 默认 make install 不包括安装文档


2make install-world


3。。。


4/usr/bin/mkdir -p '/apps/pgsql/lib'


5/usr/bin/mkdir -p '/apps/pgsql/share/extension'


6/usr/bin/mkdir -p '/apps/pgsql/share/extension'


7/usr/bin/install -c -m 755  pgxml.so '/apps/pgsql/lib/pgxml.so'


8/usr/bin/install -c -m 644 ./xml2.control '/apps/pgsql/share/extension/'


9/usr/bin/install -c -m 644 ./xml2--1.1.sql ./xml2--1.0--1.1.sql  '/apps/pgsql/share/extension/'


10make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/xml2'


11make[1]: Leaving directory '/usr/local/src/postgresql-17.6/contrib'

总结编译过程:

1# 安装依赖包


2zypper install -y gcc libicu-devel bison flex readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel make docbook-xsl-stylesheets


3


4# 进入PostgreSQL包解压的目录:


5cd postgresql-17.6


6


7# 执行configure


8./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


9


10# 执行make


11make -j $(nproc) world


12


13# 执行make install


14make install-world

2.3.2.8 Ubuntu Server 20.04/22.04/24.04 LTS、Debian 11/12/13

进入PostgreSQL包解压的目录:

1cd postgresql-17.6

执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: no acceptable C compiler found in $PATH # 提示,在$PATH中找不到可接受的C编译器,需要安装gcc


4See `config.log' for more details

安装gcc包:

1apt install -y gcc

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for pkg-config... no # 没有检测到pkg-config,要安装pkg-config,否则还会出现报错


4checking whether to build with ICU support... yes


5checking for icu-uc icu-i18n... no


6configure: error: ICU library not found # 提示,未找到 ICU 库


7If you have ICU already installed, see config.log for details on the


8failure.  It is possible the compiler isn't looking in the proper directory.


9Use --without-icu to disable ICU support.

安装pkg-config和libicu-dev包:

1apt install -y pkg-config libicu-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for bison... no


4configure: error: bison not found # 提示,未找到bison

安装bison包:

1apt install -y bison

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for flex... no


4configure: error: flex not found # 提示,未找到flex

安装flex包:

1apt install -y flex

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for library containing readline... no


4configure: error: readline library not found  # 提示,未找到readline库


5If you have readline already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-readline to disable readline support.

安装libreadline-dev包:

1apt install -y libreadline-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: zlib library not found # 提示,为找到zlib库


4If you have zlib already installed, see config.log for details on the


5failure.  It is possible the compiler isn't looking in the proper directory.


6Use --without-zlib to disable zlib support.

安装zlib1g-dev包:

1apt install -y zlib1g-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for CRYPTO_new_ex_data in -lcrypto... no


4configure: error: library 'crypto' is required for OpenSSL # 提示,需要库 'crypto' 来支持 OpenSSL

安装libssl-dev包:

1apt install -y libssl-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for xmlSaveToBuffer in -lxml2... no


4configure: error: library 'xml2' (version >= 2.6.23) is required for XML support # 提示,需要库 'xml2'(版本 >= 2.6.23)以支持 XML

安装libxml2-dev包:

1apt install -y libxml2-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: header file <systemd/sd-daemon.h> is required for systemd support # 提示,需要头文件  以支持 systemd

安装libsystemd-dev包:

1apt install -y libsystemd-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1apt install -y make


2


3# 默认 make 不包括文档和其它模块,$(nproc)表示当产主机的CPU核心


4make -j $(nproc) world


5...


6make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/isolation'


7make -C test/perl all


8make[2]: Entering directory '/usr/local/src/postgresql-17.6/src/test/perl'


9make[2]: Nothing to be done for 'all'.


10make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/perl'


11make[1]: Leaving directory '/usr/local/src/postgresql-17.6/src'

执行make install:

1# 默认 make install 不包括安装文档


2make install-world


3...


4ERROR: `xmllint' is missing on your system.


5***


6make[3]: *** [Makefile:72: postgres-full.xml] Error 1


7make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


8make[2]: *** [Makefile:8: install] Error 2


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


10make[1]: *** [Makefile:16: install] Error 2


11make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


12make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

从“www.postgresql.org/docs/curren…

1apt install -y docbook-xml docbook-xsl libxml2-utils xsltproc fop

重新执行make install:

1make install-world


2...


3ERROR: `xmllint' is missing on your system.


4***


5make[3]: *** [Makefile:72: postgres-full.xml] Error 1


6make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


7make[2]: *** [Makefile:8: install] Error 2


8make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


9make[1]: *** [Makefile:16: install] Error 2


10make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


11make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

重新执行configure:

1# 再次执行make之前先清理之前的操作


2make clean


3


4./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

重新执行make:

1make -j $(nproc) world

重新执行make install:

1make install-world


2。。。


3/usr/bin/mkdir -p '/apps/pgsql/lib'


4/usr/bin/mkdir -p '/apps/pgsql/share/extension'


5/usr/bin/mkdir -p '/apps/pgsql/share/extension'


6/usr/bin/install -c -m 755  pgxml.so '/apps/pgsql/lib/pgxml.so'


7/usr/bin/install -c -m 644 ./xml2.control '/apps/pgsql/share/extension/'


8/usr/bin/install -c -m 644 ./xml2--1.1.sql ./xml2--1.0--1.1.sql  '/apps/pgsql/share/extension/'


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/xml2'


10make[1]: Leaving directory '/usr/local/src/postgresql-17.6/contrib'

总结编译过程:

1# 安装依赖包


2apt update


3apt install -y gcc pkg-config libicu-dev bison flex libreadline-dev zlib1g-dev libssl-dev libxml2-dev libsystemd-dev make docbook-xml docbook-xsl libxml2-utils xsltproc fop


4


5# 进入PostgreSQL包解压的目录:


6cd postgresql-17.6


7


8# 执行configure


9./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


10


11# 执行make


12make -j $(nproc) world


13


14# 执行make install


15make install-world

2.3.2.9 Ubuntu Server 18.04 LTS

进入PostgreSQL包解压的目录:

1cd postgresql-17.6

执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: no acceptable C compiler found in $PATH # 提示,在$PATH中找不到可接受的C编译器,需要安装gcc


4See `config.log' for more details

安装gcc包:

1apt install -y gcc

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for pkg-config... no # 没有检测到pkg-config,要安装pkg-config,否则还会出现报错


4checking whether to build with ICU support... yes


5checking for icu-uc icu-i18n... no


6configure: error: ICU library not found # 提示,未找到 ICU 库


7If you have ICU already installed, see config.log for details on the


8failure.  It is possible the compiler isn't looking in the proper directory.


9Use --without-icu to disable ICU support.

安装pkg-config和libicu-dev包:

1apt install -y pkg-config libicu-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for bison... no


4configure: error: bison not found # 提示,未找到bison

安装bison包:

1apt install -y bison

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for flex... no


4configure: error: flex not found # 提示,未找到flex

安装flex包:

1apt install -y flex

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for library containing readline... no


4configure: error: readline library not found  # 提示,未找到readline库


5If you have readline already installed, see config.log for details on the


6failure.  It is possible the compiler isn't looking in the proper directory.


7Use --without-readline to disable readline support.

安装libreadline-dev包:

1apt install -y libreadline-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for CRYPTO_new_ex_data in -lcrypto... no


4configure: error: library 'crypto' is required for OpenSSL # 提示,需要库 'crypto' 来支持 OpenSSL

安装libssl-dev包:

1apt install -y libssl-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3checking for xmlSaveToBuffer in -lxml2... no


4configure: error: library 'xml2' (version >= 2.6.23) is required for XML support # 提示,需要库 'xml2'(版本 >= 2.6.23)以支持 XML

安装libxml2-dev包:

1apt install -y libxml2-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


2...


3configure: error: header file <systemd/sd-daemon.h> is required for systemd support # 提示,需要头文件  以支持 systemd

安装libsystemd-dev包:

1apt install -y libsystemd-dev

继续执行configure:

1./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

执行make:

1apt install -y make


2


3# 默认 make 不包括文档和其它模块,$(nproc)表示当产主机的CPU核心


4make -j $(nproc) world


5...


6make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/isolation'


7make -C test/perl all


8make[2]: Entering directory '/usr/local/src/postgresql-17.6/src/test/perl'


9make[2]: Nothing to be done for 'all'.


10make[2]: Leaving directory '/usr/local/src/postgresql-17.6/src/test/perl'


11make[1]: Leaving directory '/usr/local/src/postgresql-17.6/src'

执行make install:

1# 默认 make install 不包括安装文档


2make install-world


3...


4ERROR: `xmllint' is missing on your system.


5***


6make[3]: *** [Makefile:72: postgres-full.xml] Error 1


7make[3]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src/sgml'


8make[2]: *** [Makefile:8: install] Error 2


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/doc/src'


10make[1]: *** [Makefile:16: install] Error 2


11make[1]: Leaving directory '/usr/local/src/postgresql-17.6/doc'


12make: *** [GNUmakefile:32: install-world-doc-recurse] Error 2

从“www.postgresql.org/docs/curren…

1apt install -y docbook-xml docbook-xsl libxml2-utils xsltproc fop

重新执行configure:

1# 再次执行make之前先清理之前的操作


2make clean


3


4./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd

重新执行make:

1make -j $(nproc) world

重新执行make install:

1make install-world


2。。。


3/usr/bin/mkdir -p '/apps/pgsql/lib'


4/usr/bin/mkdir -p '/apps/pgsql/share/extension'


5/usr/bin/mkdir -p '/apps/pgsql/share/extension'


6/usr/bin/install -c -m 755  pgxml.so '/apps/pgsql/lib/pgxml.so'


7/usr/bin/install -c -m 644 ./xml2.control '/apps/pgsql/share/extension/'


8/usr/bin/install -c -m 644 ./xml2--1.1.sql ./xml2--1.0--1.1.sql  '/apps/pgsql/share/extension/'


9make[2]: Leaving directory '/usr/local/src/postgresql-17.6/contrib/xml2'


10make[1]: Leaving directory '/usr/local/src/postgresql-17.6/contrib'

总结编译过程:

1# 安装依赖包


2apt update


3apt install -y gcc pkg-config libicu-dev bison flex libreadline-dev libssl-dev libxml2-dev libsystemd-dev make docbook-xml docbook-xsl libxml2-utils xsltproc fop


4


5# 进入PostgreSQL包解压的目录:


6cd postgresql-17.6


7


8# 执行configure


9./configure --prefix=/apps/pgsql --with-openssl --with-libxml --with-systemd


10


11# 执行make


12make -j $(nproc) world


13


14# 执行make install


15make install-world

2.3.3 创建数据库用户和组

PostgreSQL默认不支持 以root 身份启动服务,虽然也可修改源码实现root启动,但基于安全考虑不建议,因此必须创建一个用于启动PostgrepSQL的普通用户

1# 创建数据库用户和组,注意此用户需要可以交互登录


2# Rocky、Almalinux、CentOS、openEuler、AnolisOS、OpenCloudOS、 Kylin Server、UOS Server、Ubuntu、Debian


3useradd -s /bin/bash -m -d /home/postgres postgres


4


5# openSUSE


6groupadd postgres


7useradd -s /bin/bash -m -d /home/postgres -g postgres postgres


8


9# 修改postgres密码


10echo postgres:123456|chpasswd

2.3.4 创建数据目录并授权

1mkdir -p /data/pgsql/


2chown -R postgres:postgres /data/pgsql/

2.3.5 设置环境变量

1cat > /etc/profile.d/pgsql.sh <<EOF


2export PGHOME=/apps/pgsql


3export PATH=$PGHOME/bin/:$PATH


4export PGDATA=/data/pgsql


5export PGUSER=postgres


6export MANPATH=$PGHOME/share/man


7EOF


8


9. /etc/profile.d/pgsql.sh

2.3.6 初始化数据库

1[root@rocky10 postgresql-17.6]# su - postgres -c '/apps/pgsql/bin/initdb  -D /data/pgsql'


2The files belonging to this database system will be owned by user "postgres".


3This user must also own the server process.


4


5The database cluster will be initialized with locale "en_US.UTF-8".


6The default database encoding has accordingly been set to "UTF8".


7The default text search configuration will be set to "english".


8


9Data page checksums are disabled.


10


11fixing permissions on existing directory /data/pgsql ... ok


12creating subdirectories ... ok


13selecting dynamic shared memory implementation ... posix


14selecting default "max_connections" ... 100


15selecting default "shared_buffers" ... 128MB


16selecting default time zone ... Asia/Shanghai


17creating configuration files ... ok


18running bootstrap script ... ok


19performing post-bootstrap initialization ... ok


20syncing data to disk ... ok


21


22initdb: warning: enabling "trust" authentication for local connections


23initdb: hint: You can change this by editing pg_hba.conf or using the option -A, or --auth-local and --auth-host, the next time you run initdb.


24


25Success. You can now start the database server using:


26


27    pg_ctl -D /data/pgsql -l logfile start

2.3.7 准备启动脚本并启动服务

1# Rocky、Almalinux、CentOS、openEuler、AnolisOS、OpenCloudOS、 Kylin Server、UOS Server、openSUSE


2cat > /usr/lib/systemd/system/postgresql.service <<EOF 


3[Unit]


4Description=PostgreSQL database server


5After=network.target


6


7[Service]


8User=postgres


9Group=postgres


10ExecStart=/apps/pgsql/bin/postgres -D /data/pgsql


11ExecReload=/bin/kill -HUP $MAINPID


12


13[Install]


14WantedBy=multi-user.target


15EOF


16


17# Ubuntu和Debian


18cat > /lib/systemd/system/postgresql.service <<EOF 


19[Unit]


20Description=PostgreSQL database server


21After=network.target


22


23[Service]


24User=postgres


25Group=postgres


26ExecStart=/apps/pgsql/bin/postgres -D /data/pgsql


27ExecReload=/bin/kill -HUP


28


29[Install]


30WantedBy=multi-user.target


31EOF


32


33systemctl daemon-reload && systemctl enable --now postgresql

2.3.8 登录测试

1[root@rocky10 postgresql-17.6]# sudo -u postgres /apps/pgsql/bin/psql -c "SELECT version();"


2                                                version                                                


3-------------------------------------------------------------------------------------------------------


4 PostgreSQL 17.6 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0, 64-bit


5(1 row)


6


7[root@rocky10 postgresql-17.6]# su - postgres


8Last login: Mon Sep  8 16:47:39 CST 2025 on pts/0


9[postgres@rocky10 ~]$ psql


10psql (17.6)


11Type "help" for help.


12


13postgres=# help


14You are using psql, the command-line interface to PostgreSQL.


15Type:  \copyright for distribution terms


16       \h for help with SQL commands


17       ? for help with psql commands


18       \g or terminate with semicolon to execute query


19       \q to quit


20postgres=# \q

2.3.9 一键安装PostgreSQL源码编译的脚本

Shell脚本源码地址:

Gitee:gitee.com/raymond9/sh…

Github:github.com/raymond9999…

可以去上面的Gitee或Github代码仓库拉取脚本。

1[root@rocky10 ~]# cat install_postgresql_source.sh


2#!/bin/bash


3#


4#**********************************************************************************


5#Author:        Raymond


6#QQ:            88563128


7#MP:            Raymond运维


8#Date:          2025-09-22


9#FileName:      install_postgresql_source.sh


10#URL:           https://wx.zsxq.com/group/15555885545422


11#Description:   The postgresql source script install supports 


12#               “Rocky Linux 8, 9 and 10, AlmaLinux 8, 9 and 10, CentOS 7, 


13#               CentOS Stream 8, 9 and 10, openEuler 22.03 and 24.03 LTS, 


14#               AnolisOS 8 and 23, OpenCloudOS 8 and 9, Kylin Server v10 and v11, 


15#               UOS Server v20, Ubuntu Server 18.04, 20.04, 22.04 and 24.04 LTS,  


16#               Debian 11 , 12 and 13, openSUSE Leap 15“ operating systems.


17#Copyright (C): 2025 All rights reserved


18#**********************************************************************************


19COLOR="echo -e \033[01;31m"


20END='\033[0m'


21


22os(){


23    . /etc/os-release


24    MAIN_NAME=`sed -rn '/^NAME=/s@.*="([[:alpha:]]+).*"$@\1@p' /etc/os-release`


25    if [ ${MAIN_NAME} == "Kylin" ];then


26        MAIN_VERSION_ID=`sed -rn '/^VERSION_ID=/s@.*="([[:alpha:]]+)(.*)"$@\2@p' /etc/os-release`


27    else


28        MAIN_VERSION_ID=`sed -rn '/^VERSION_ID=/s@.*="?([0-9]+).?.*"?@\1@p' /etc/os-release`


29    fi


30    if [ ${MAIN_NAME} == "Ubuntu" -o ${MAIN_NAME} == "Debian" ];then


31        FULL_NAME="${PRETTY_NAME}"


32    elif [ ${MAIN_NAME} == "UOS" ];then


33        FULL_NAME="${NAME}"


34    else


35        FULL_NAME="${NAME} ${VERSION_ID}"


36    fi


37}


38


39os


40SRC_DIR=/usr/local/src


41INSTALL_DIR=/apps/pgsql


42DATA_DIR=/data/pgsql


43DB_USER=postgres


44POSTGRESQL_VERSION=17.6


45POSTGRESQL_URL="https://ftp.postgresql.org/pub/source/v${POSTGRESQL_VERSION}/"


46POSTGRESQL_FILE="postgresql-${POSTGRESQL_VERSION}.tar.gz"


47DB_USER_PASSWORD=123456


48


49check_file(){


50    cd  ${SRC_DIR}


51    if [ ${MAIN_NAME} == "Rocky" -o ${MAIN_NAME} == "AlmaLinux" -o ${MAIN_NAME} == "CentOS" -o ${MAIN_NAME} == "Anolis" -o ${MAIN_NAME} == "OpenCloudOS" -o ${MAIN_NAME} == "Kylin" ];then


52        rpm -q wget &> /dev/null || { ${COLOR}"安装wget工具,请稍等......"${END};yum -y install wget &> /dev/null; }


53    fi


54    if [ ! -e ${POSTGRESQL_FILE} ];then


55        ${COLOR}"缺少${POSTGRESQL_FILE}文件!"${END}


56        ${COLOR}'开始下载PostgreSQL源码包......'${END}


57        wget ${POSTGRESQL_URL}${POSTGRESQL_FILE} || { ${COLOR}"PostgreSQL源码包下载失败!"${END}; exit; }


58    else


59        ${COLOR}"${POSTGRESQL_FILE}文件已准备好!"${END}


60    fi


61}


62


63install_postgresql(){


64    [ -d ${INSTALL_DIR} ] && { ${COLOR}"PostgreSQL数据库已存在,安装失败!"${END};exit; }


65    ${COLOR}"开始安装PostgreSQL数据库......"${END}


66    ${COLOR}'开始安装PostgreSQL依赖包,请稍等......'${END}


67    if [ ${MAIN_NAME} == "Rocky" -o ${MAIN_NAME} == "AlmaLinux" -o ${MAIN_NAME} == "CentOS" -o ${MAIN_NAME} == "OpenCloudOS" ];then


68        yum install -y gcc libicu-devel bison flex perl readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel docbook-dtds docbook-style-xsl libxslt &> /dev/null


69    fi


70    if [ ${MAIN_NAME} == "openEuler" ];then


71        yum install -y gcc libicu-devel bison flex readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel docbook-dtds docbook-style-xsl libxslt &> /dev/null


72    fi


73    if [ ${MAIN_NAME} == "Anolis" ];then


74        if [ ${MAIN_VERSION_ID} == 8 ];then


75            yum install -y gcc libicu-devel bison flex readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel make docbook-dtds docbook-style-xsl libxslt &> /dev/null


76        else


77            yum install -y gcc libicu-devel bison flex readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel perl-FindBin perl-core docbook-dtds docbook-style-xsl libxslt &> /dev/null


78        fi


79    fi


80    if [ ${MAIN_NAME} == "Kylin" ];then


81        yum install -y gcc libicu-devel bison flex perl readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel docbook-dtds docbook-style-xsl libxslt &> /dev/null


82    fi


83    if [ ${MAIN_NAME} == "UOS" ];then


84        if [ ${MAIN_VERSION_ID} == 20 ];then


85            yum install -y libicu-devel bison flex perl readline-devel systemd-devel docbook-dtds docbook-style-xsl libxslt &> /dev/null


86        fi


87    fi


88    if [ ${MAIN_NAME} == "openSUSE" ];then


89        if [ ${MAIN_VERSION_ID} == 15 ];then


90            zypper install -y gcc libicu-devel bison flex readline-devel zlib-devel openssl-devel libxml2-devel systemd-devel make docbook-xsl-stylesheets &> /dev/null


91        fi


92    fi


93    if [ ${MAIN_NAME} == "Ubuntu" ];then


94        if [ ${MAIN_VERSION_ID} == 18 ];then


95            apt update && apt install -y gcc pkg-config libicu-dev bison flex libreadline-dev libssl-dev libxml2-dev libsystemd-dev make docbook-xml docbook-xsl libxml2-utils xsltproc fop


96        else


97            apt update && apt install -y gcc pkg-config libicu-dev bison flex libreadline-dev zlib1g-dev libssl-dev libxml2-dev libsystemd-dev make docbook-xml docbook-xsl libxml2-utils xsltproc fop


98        fi


99    fi


100    if [ ${MAIN_NAME} == 'Debian' ];then


101        apt update && apt install -y gcc pkg-config libicu-dev bison flex libreadline-dev zlib1g-dev libssl-dev libxml2-dev libsystemd-dev make docbook-xml docbook-xsl libxml2-utils xsltproc fop


102    fi


103    ${COLOR}'开始编译安装PostgreSQL,请稍等......'${END}


104    cd  ${SRC_DIR}


105    if [ ${MAIN_NAME} == "openEuler" ];then


106        if [ ${MAIN_VERSION_ID} == 22 -o ${MAIN_VERSION_ID} == 24 ];then


107            yum install -y tar &> /dev/null


108        fi


109    fi


110    if [ ${MAIN_NAME} == "Anolis" ];then


111        if [ ${MAIN_VERSION_ID} == 23 ];then


112            yum install -y tar &> /dev/null


113        fi


114    fi


115    if [ ${MAIN_NAME} == "OpenCloudOS" ];then


116        if [ ${MAIN_VERSION_ID} == 9 ];then


117            yum install -y tar &> /dev/null


118        fi


119    fi


120    tar xf ${POSTGRESQL_FILE}


121    POSTGRESQL_DIR=`echo ${POSTGRESQL_FILE}| sed -nr 's/^(.*[0-9]).*/\1/p'`


122    cd ${POSTGRESQL_DIR}


123    ./configure --prefix=${INSTALL_DIR} --with-openssl --with-libxml --with-systemd


124    make -j $(nproc) world


125    make install-world


126    [ $? -eq 0 ] && ${COLOR}"PostgreSQL编译安装成功!"${END} ||  { ${COLOR}"PostgreSQL编译安装失败,退出!"${END};exit; }


127    if [ ${MAIN_NAME} == "openSUSE" ];then


128        id ${DB_USER} &> /dev/null || { groupadd ${DB_USER} && useradd -s /bin/bash -m -d /home/${DB_USER} -g ${DB_USER} ${DB_USER}; ${COLOR}"成功创建${DB_USER}用户!"${END}; }


129    else


130        id ${DB_USER} &> /dev/null || { useradd -s /bin/bash -m -d /home/${DB_USER} ${DB_USER} ; ${COLOR}"成功创建${DB_USER}用户!"${END}; }


131    fi


132    echo ${DB_USER}:${DB_USER_PASSWORD}|chpasswd


133    [ -d ${DATA_DIR} ] || mkdir -p ${DATA_DIR}/


134    chown -R ${DB_USER}:${DB_USER} ${DATA_DIR}/   


135    cat > /etc/profile.d/pgsql.sh <<EOF


136export PGHOME=${INSTALL_DIR}


137export PATH=${INSTALL_DIR}/bin/:$PATH


138export PGDATA=${DATA_DIR}


139export PGUSER=${DB_USER}


140export MANPATH=${INSTALL_DIR}/share/man


141


142alias pgstart="pg_ctl -D ${DATA_DIR} start"


143alias pgstop="pg_ctl -D ${DATA_DIR} stop"


144alias pgrestart="pg_ctl -D ${DATA_DIR} restart"


145alias pgstatus="pg_ctl -D ${DATA_DIR} status"


146EOF


147    su - ${DB_USER} -c "${INSTALL_DIR}/bin/initdb -D ${DATA_DIR}"


148    if [ ${MAIN_NAME} == "Ubuntu" -o ${MAIN_NAME} == "Debian" ];then


149        cat > /lib/systemd/system/postgresql.service <<EOF


150[Unit]


151Description=PostgreSQL database server


152After=network.target


153


154[Service]


155User=${DB_USER}


156Group=${DB_USER}


157ExecStart=${INSTALL_DIR}/bin/postgres -D ${DATA_DIR}


158ExecReload=/bin/kill -HUP $MAINPID


159


160[Install]


161WantedBy=multi-user.target


162EOF


163    else


164        cat > /usr/lib/systemd/system/postgresql.service <<EOF


165[Unit]


166Description=PostgreSQL database server


167After=network.target


168


169[Service]


170User=${DB_USER}


171Group=${DB_USER}


172ExecStart=${INSTALL_DIR}/bin/postgres -D ${DATA_DIR}


173ExecReload=/bin/kill -HUP $MAINPID


174


175[Install]


176WantedBy=multi-user.target


177EOF


178    fi


179    systemctl daemon-reload && systemctl enable --now postgresql &> /dev/null


180    [ $? -ne 0 ] && { ${COLOR}"数据库启动失败,退出!"${END};exit; }


181    ${COLOR}"${FULL_NAME}操作系统,PostgreSQL数据库安装完成!"${END}


182}


183


184main(){


185    check_file


186    install_postgresql


187}


188


189if [ ${MAIN_NAME} == "Rocky" ];then


190    if [ ${MAIN_VERSION_ID} == 8 -o ${MAIN_VERSION_ID} == 9 -o ${MAIN_VERSION_ID} == 10 ];then


191        main


192    fi


193elif [ ${MAIN_NAME} == "AlmaLinux" ];then


194    if [ ${MAIN_VERSION_ID} == 8 -o ${MAIN_VERSION_ID} == 9 -o ${MAIN_VERSION_ID} == 10 ];then


195        main


196    fi


197elif [ ${MAIN_NAME} == "CentOS" ];then


198    if [ ${MAIN_VERSION_ID} == 7 -o ${MAIN_VERSION_ID} == 8 -o ${MAIN_VERSION_ID} == 9 -o ${MAIN_VERSION_ID} == 10 ];then


199        main


200    fi


201elif [ ${MAIN_NAME} == "openEuler" ];then


202    if [ ${MAIN_VERSION_ID} == 22 -o ${MAIN_VERSION_ID} == 24 ];then


203        main


204    fi


205elif [ ${MAIN_NAME} == "Anolis" ];then


206    if [ ${MAIN_VERSION_ID} == 8 -o ${MAIN_VERSION_ID} == 23 ];then


207        main


208    fi


209elif [ ${MAIN_NAME} == 'OpenCloudOS' ];then


210    if [ ${MAIN_VERSION_ID} == 8 -o ${MAIN_VERSION_ID} == 9 ];then


211        main


212    fi


213elif [ ${MAIN_NAME} == "Kylin" ];then


214    if [ ${MAIN_VERSION_ID} == 10 ];then


215        main


216    fi


217elif [ ${MAIN_NAME} == "UOS" ];then


218    if [ ${MAIN_VERSION_ID} == 20 ];then


219        main


220    fi


221elif [ ${MAIN_NAME} == "openSUSE" ];then


222    if [ ${MAIN_VERSION_ID} == 15 ];then


223        main


224    fi


225elif [ ${MAIN_NAME} == "Ubuntu" ];then


226    if [ ${MAIN_VERSION_ID} == 18 -o ${MAIN_VERSION_ID} == 20 -o ${MAIN_VERSION_ID} == 22 -o ${MAIN_VERSION_ID} == 24 ];then


227        main


228    fi


229elif [ ${MAIN_NAME} == 'Debian' ];then


230    if [ ${MAIN_VERSION_ID} == 11 -o ${MAIN_VERSION_ID} == 12 -o ${MAIN_VERSION_ID} == 13 ];then


231        main


232    fi


233else


234    ${COLOR}"此脚本不支持${FULL_NAME}操作系统!"${END}


235fi