微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

postgresql源码安装

1、创建用户和组

groupadd postgres

useradd -g postgres postgres

[root@test1 /]# groupadd postgres
[root@test1 /]# useradd -g postgres postgres

2、创建postfresql的安装目录

[root@test1 tmp]# mkdir -p /postgresql/2.6
[root@test1 tmp]# chown -R postgres:postgres /postgresql

3、编译

认安装在/usr/local/pgsql目录下,可以通过--prefix指定安装目录

./configure --prefix=/postgres/12.6

[postgres@test1 postgresql-12.6]$ ./configure --prefix=/postgres/12.6
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
。。。。。。
configure: using CPPFLAGS= -D_GNU_SOURCE 
configure: using LDFLAGS=  -Wl,--as-needed
configure: creating ./config.status
config.status: creating GNUmakefile
config.status: creating src/Makefile.global
config.status: creating src/include/pg_config.h
config.status: creating src/include/pg_config_ext.h
config.status: creating src/interfaces/ecpg/include/ecpg_config.h
config.status: linking src/backend/port/tas/dummy.s to src/backend/port/tas.s
config.status: linking src/backend/port/posix_sema.c to src/backend/port/pg_sema.c
config.status: linking src/backend/port/sysv_shmem.c to src/backend/port/pg_shmem.c
config.status: linking src/include/port/linux.h to src/include/pg_config_os.h
config.status: linking src/makefiles/Makefile.linux to src/Makefile.port

注,在编译过程中,有报错,提示没有安装readline,但是readline缺失已经安装了,后来安装readline-devel后不报错。

报错信息如下:

checking for library containing readline... no
configure: error: readline library not found
If you have readline already installed, see config.log for details on the
failure.  It is possible the compiler isn't looking in the proper directory.
Use --without-readline to disable readline support.

4、make

make all

[postgres@test1 postgresql-12.6]$ make all
make -C ./src/backend generated-headers
make[1]: Entering directory `/tmp/postgresql-12.6/src/backend'
make -C catalog distprep generated-header-symlinks
make[2]: Entering directory `/tmp/postgresql-12.6/src/backend/catalog'
make[2]: nothing to be done for `distprep'.
。。。。。。
make -C config all
make[1]: Entering directory `/tmp/postgresql-12.6/config'
make[1]: nothing to be done for `all'.
make[1]: Leaving directory `/tmp/postgresql-12.6/config'
All of Postgresql successfully made. Ready to install.
[postgres@test1 postgresql-12.6]$ 

5、make install

make install

[postgres@test1 postgresql-12.6]$ make install
make -C ./src/backend generated-headers
make[1]: Entering directory `/tmp/postgresql-12.6/src/backend'
make -C catalog distprep generated-header-symlinks
make[2]: Entering directory `/tmp/postgresql-12.6/src/backend/catalog'
make[2]: nothing to be done for `distprep'.
。。。。。。
make[1]: Entering directory `/tmp/postgresql-12.6/config'
/bin/mkdir -p '/postgres/12.6/lib/pgxs/config'
/bin/install -c -m 755 ./install-sh '/postgres/12.6/lib/pgxs/config/install-sh'
/bin/install -c -m 755 ./missing '/postgres/12.6/lib/pgxs/config/missing'
make[1]: Leaving directory `/tmp/postgresql-12.6/config'
Postgresql installation complete.
[postgres@test1 postgresql-12.6]$ 

安装完成。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐