暂无图片
源码安装PG16
我来答
分享
Thomas
2024-04-15
源码安装PG16

OS是ORACLE LINUX 9,下载源码并解压,先运行./configure, 提示如下:

[root@localhost postgresql-16.2]# ./configure
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking which template to use... linux
checking whether NLS is wanted... no
checking for default port number... 5432
checking for block size... 8kB
checking for segment size... 1GB
checking for WAL block size... 8kB
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for gcc option to accept ISO C99... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gawk... gawk
checking whether gcc supports -Wdeclaration-after-statement, for CFLAGS... yes
checking whether gcc supports -Werror=vla, for CFLAGS... yes
checking whether gcc supports -Werror=unguarded-availability-new, for CFLAGS... no
checking whether g++ supports -Werror=unguarded-availability-new, for CXXFLAGS... no
checking whether gcc supports -Wendif-labels, for CFLAGS... yes
checking whether g++ supports -Wendif-labels, for CXXFLAGS... yes
checking whether gcc supports -Wmissing-format-attribute, for CFLAGS... yes
checking whether g++ supports -Wmissing-format-attribute, for CXXFLAGS... yes
checking whether gcc supports -Wimplicit-fallthrough=3, for CFLAGS... yes
checking whether g++ supports -Wimplicit-fallthrough=3, for CXXFLAGS... yes
checking whether gcc supports -Wcast-function-type, for CFLAGS... yes
checking whether g++ supports -Wcast-function-type, for CXXFLAGS... yes
checking whether gcc supports -Wshadow=compatible-local, for CFLAGS... yes
checking whether g++ supports -Wshadow=compatible-local, for CXXFLAGS... yes
checking whether gcc supports -Wformat-security, for CFLAGS... yes
checking whether g++ supports -Wformat-security, for CXXFLAGS... yes
checking whether gcc supports -fno-strict-aliasing, for CFLAGS... yes
checking whether g++ supports -fno-strict-aliasing, for CXXFLAGS... yes
checking whether gcc supports -fwrapv, for CFLAGS... yes
checking whether g++ supports -fwrapv, for CXXFLAGS... yes
checking whether gcc supports -fexcess-precision=standard, for CFLAGS... yes
checking whether g++ supports -fexcess-precision=standard, for CXXFLAGS... no
checking whether gcc supports -funroll-loops, for CFLAGS_UNROLL_LOOPS... yes
checking whether gcc supports -ftree-vectorize, for CFLAGS_VECTORIZE... yes
checking whether gcc supports -Wunused-command-line-argument, for NOT_THE_CFLAGS... no
checking whether gcc supports -Wcompound-token-split-by-macro, for NOT_THE_CFLAGS... no
checking whether gcc supports -Wformat-truncation, for NOT_THE_CFLAGS... yes
checking whether gcc supports -Wstringop-truncation, for NOT_THE_CFLAGS... yes
checking whether gcc supports -Wcast-function-type-strict, for NOT_THE_CFLAGS... no
checking whether gcc supports -fvisibility=hidden, for CFLAGS_SL_MODULE... yes
checking whether g++ supports -fvisibility=hidden, for CXXFLAGS_SL_MODULE... yes
checking whether g++ supports -fvisibility-inlines-hidden, for CXXFLAGS_SL_MODULE... yes
checking whether the C compiler still works... yes
checking how to run the C preprocessor... gcc -E
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking allow thread-safe client libraries... yes
checking whether to build with ICU support... yes
checking for icu-uc icu-i18n... no
configure: error: ICU library not found
If you have ICU already installed, see config.log for details on the
failure. It is possible the compiler isn't looking in the proper directory.
Use --without-icu to disable ICU support.

感觉可以继续吧。于是运行make, 报错如下:

[root@localhost postgresql-16.2]# make
You need to run the 'configure' program first. See the file
'INSTALL' for installation instructions, or visit:
<https://www.postgresql.org/docs/devel/installation.html>
make: *** [Makefile:19: all] Error 1

打开Makefile看,头几句如下:

  @if [ ! -f GNUmakefile ] ; then \
if [ -f INSTALL ] ; then \
INSTRUCTIONS="INSTALL"; \
else \
INSTRUCTIONS="README.git"; \
fi; \
echo "You need to run the 'configure' program first. See the file"; \
echo "'$$INSTRUCTIONS' for installation instructions, or visit: " ; \
echo "<https://www.postgresql.org/docs/devel/installation.html>" ; \
false ; \

似乎再判断时,走到了echo "You need to run the 'configure' program first. See the file"; \  判断的意思时是否有Makefile吧?不是有吗,怎会走到这一步?求PG高手解答

我来答
添加附件
收藏
分享
问题补充
7条回答
默认
最新
小满未满、

要是不想折腾的话 不用这个功能 编译configure时 就加上这个–without-icu 忽略掉这个

./configure --without-icu 
复制

要是需要ICU功能(一般是用来排序)的话 就查查看怎么在你现有的操作系统环境下安装这个libicu 就先把icu依赖先装好
比如说centos系统

yum install libicu-devel
复制

然后跑configure 等configure编译过了之后 再跑

 make && make install 
复制
暂无图片 评论
暂无图片 有用 1
打赏 0
暂无图片
subverter

./configure--prefix=自定义路径 --with-pgport=自定义端口,然后使用  install 或者 make install-world 进行安装 $ make install-world

暂无图片 评论
暂无图片 有用 0
打赏 0
Thomas

./configure--prefix=/postgres

执行正常,之后运行以下两命令均报错

[root@localhost postgresql-16.2]# make install-world
You need to run the 'configure' program first. See the file
'INSTALL' for installation instructions, or visit:
<https://www.postgresql.org/docs/devel/installation.html>
make: *** [Makefile:19: install-world] Error 1
[root@localhost postgresql-16.2]# make install
You need to run the 'configure' program first. See the file
'INSTALL' for installation instructions, or visit:
<https://www.postgresql.org/docs/devel/installation.html>
make: *** [Makefile:19: install] Error 1

暂无图片 评论
暂无图片 有用 0
打赏 0
subverter
2024-04-15
从上面你运行configure的日志看,缺少ICU的包,然后在重新configure,直到一点错误也没有才可以编译。
Thomas

缺ICU包和后面的make报错无关吧?

暂无图片 评论
暂无图片 有用 0
打赏 0
小满未满、
2024-04-15
configure没成功编译的话 执行后面的make没有意义
Thomas

谢谢两位答主,现在configure不报错了。但是make时,有如下错误:

gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wcast-function-type -Wshadow=compatible-local -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 clusterdb.o common.o -L../../../src/port -L../../../src/common -L../../../src/fe_utils -lpgfeutils -L../../../src/common -lpgcommon -L../../../src/port -lpgport -L../../../src/interfaces/libpq -lpq -Wl,--as-needed -Wl,-rpath,'/pg/lib',--enable-new-dtags -lpgcommon -lpgport -lz -lreadline -lm -o clusterdb

不知如何解决

暂无图片 评论
暂无图片 有用 0
打赏 0
小满未满、
2024-04-16
错误信息有吗 贴的这块好像没看见
小满未满、
2024-04-16
贴的这个不是错误 这个就是一个gcc完整的编译命令
Thomas

现在好歹算是装上了,也init db了。启动成功,但再主机上无法psql

[postgres@localhost data]$ pg_ctl -D /pg/data -l logfile start
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.
[postgres@localhost data]$ psql
psql: error: connection to server on socket "/pg/data/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?

暂无图片 评论
暂无图片 有用 0
打赏 0
nick_liu
2024-04-19
检查下/pg/data/ 的权限吧
小满未满、

启动失败了

pg_ctl: could not start server
复制
暂无图片 评论
暂无图片 有用 0
打赏 0
回答交流
Markdown


请输入正文
提交
相关推荐
pgbackrest 编译安装出错
回答 1
需要安裝依賴,如centos下:yuminstallzlibdevel
EXISTS谓语和IN运算符在性能方面有什么区别?
回答 4
https://blog.csdn.net/weixin39540651/article/details/104990653?opsrequestmisc%257B%2522request%255Fi
pg中如何处理hashjoin的连接条件上的数据不均匀,如何处理?
回答 1
pg中也有直方图的统计信息,可以看下pgstats,pg基于这些信息生成执行计划。
第一次用postgreSQL,想装主从,用的12.7 tar.gz版本。安装好后没在 share目录下找到样例配置recovery.conf.sample,是安装方式不对,还是路径不对?
回答 1
网支链接:https://blog.csdn.net/dazuiba008/article/details/103769890希望对你有所帮助若对答案满意,请点击采纳按钮哦!
虚拟机蓝屏进不去了,数据库没来得及备份,还能把虚拟机的磁盘映射出来,能直接拿pg文件夹里的数据文件直接复制出来,移到别的虚拟机新的postgreSQL里面去吗?
回答 2
1
postgresql 导出500G左右的数据,有没有快速导出的方式?
回答 1
pgdumpa
greenplum 故障 提示 could not open file “pg_distributedlog/03B8”
回答 1
可能的原因分析文件丢失或损坏:最直接的原因可能是文件“pgdistributedlog/03B8”确实丢失了。这可能是由于存储介质故障、意外删除或者文件系统错误导致的。例如,存储Greenplum数据
在运维过程中,有用户反应postgresql很慢,这时应该查哪里?干什么?
回答 1
已采纳
当然少不了&nbsp;pgstatstatements&nbsp;插件了,可以装上系统看看有哪些慢SQL;具体的慢SQL优化,可以参考下&nbsp;PostgreSQL性能优化指南&nbsp;
timestamp后面那个时区时间怎么去掉?
回答 1
已采纳
SQL要求只写timestamp等效于timestampwithouttimezone,并且PostgreSQL鼓励这种行为。可以尝试:selectcurrenttimestamp(0)::times
惰性冻结对应的啥命令?
回答 1
已采纳
惰性冻结:仅清理死元组,可冻结部分事务ID。VACUUMtabname;&nbsp;