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