1.下载安装包
https://ftp.postgresql.org/pub/source/v10beta2/postgresql-10beta2.tar.gz
2.解压编译
tar zxvf postgresql-10beta2.tar.gz
configure
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/dynloader/linux.c to src/backend/port/dynloader.c
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/backend/port/dynloader/linux.h to src/include/dynloader.h
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
make
cp ../../../contrib/spi/refint.so refint.so
cp ../../../contrib/spi/autoinc.so autoinc.so
make[2]: Leaving directory `/usr/etc/postgresql-10beta2/src/test/regress'
make -C test/perl all
make[2]: Entering directory `/usr/etc/postgresql-10beta2/src/test/perl'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/usr/etc/postgresql-10beta2/src/test/perl'
make[1]: Leaving directory `/usr/etc/postgresql-10beta2/src'
make -C config all
make[1]: Entering directory `/usr/etc/postgresql-10beta2/config'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/etc/postgresql-10beta2/config'
All of PostgreSQL successfully made. Ready to install.
make install
make[2]: Leaving directory `/usr/etc/postgresql-10beta2/src/test/regress'
make -C test/perl install
make[2]: Entering directory `/usr/etc/postgresql-10beta2/src/test/perl'
make[2]: Nothing to be done for `install'.
make[2]: Leaving directory `/usr/etc/postgresql-10beta2/src/test/perl'
/usr/bin/mkdir -p '/usr/local/pgsql/lib/pgxs/src'
/usr/bin/install -c -m 644 Makefile.global '/usr/local/pgsql/lib/pgxs/src/Makefile.global'
/usr/bin/install -c -m 644 Makefile.port '/usr/local/pgsql/lib/pgxs/src/Makefile.port'
/usr/bin/install -c -m 644 ./Makefile.shlib '/usr/local/pgsql/lib/pgxs/src/Makefile.shlib'
/usr/bin/install -c -m 644 ./nls-global.mk '/usr/local/pgsql/lib/pgxs/src/nls-global.mk'
make[1]: Leaving directory `/usr/etc/postgresql-10beta2/src'
make -C config install
make[1]: Entering directory `/usr/etc/postgresql-10beta2/config'
/usr/bin/mkdir -p '/usr/local/pgsql/lib/pgxs/config'
/usr/bin/install -c -m 755 ./install-sh '/usr/local/pgsql/lib/pgxs/config/install-sh'
/usr/bin/install -c -m 755 ./missing '/usr/local/pgsql/lib/pgxs/config/missing'
make[1]: Leaving directory `/usr/etc/postgresql-10beta2/config'
PostgreSQL installation complete.
3.生成postgres组和用户
[root@localhost usr]# groupadd postgres
[root@localhost usr]# useradd -g postgres postgres
[root@localhost usr]# passwd postgres
4.建立数据文件目录
[root@localhost bin]# mkdir /usr/pgdata
[root@localhost bin]# chown -R postgres:postgres /usr/pgdata
[root@localhost bin]# chmod 700 /usr/pgdata
5.初始化数据库
[postgres@localhost bin]$ ./initdb -D /usr/pgdata/
6.修改postgresql.conf
listen_addresses = '*'
port = 5432
7.修改pg_hba.conf
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 0.0.0.0/0 trust
8.启动数据库
[postgres@localhost bin]$ ./pg_ctl start -D /usr/pgdata/
9.验证
[postgres@localhost bin]$ ./psql
psql (10beta2)
Type "help" for help.
postgres=# select version();
version
-----------------------------------------------------------------------------------------------------------
PostgreSQL 10beta2 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4), 64-bit
(1 row)
postgres=# \q