[root@tjtestrac1 postgreSQL]# cd postgresql-10.0[root@tjtestrac1 postgresql-10.0]# ./configure --help
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local/pgsql]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in`/usr/local/pgsql/bin', `/usr/local/pgsql/lib' etc. You can specify
an installation prefix other than `/usr/local/pgsql' using `--prefix',
for instance `--prefix=$HOME'.
...
[root@tjtestrac1 postgresql-10.0]# ./configure --prefix=/u02/postgreSQL/pg10 --with-pgport=1985 --with-segsize=16 --with-wal-segsize=256
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... 1985
checking for block size... 8kB
checking for segment size... 16GB
checking for WAL block size... 8kB
checking for WAL segment size... 256MB
checking for gcc... gcc
checking whether the C compiler works... yes
......
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
编译安装
[root@tjtestrac1 postgresql-10.0]# gmake............
gmake -C config all
gmake[1]: Entering directory `/u02/postgreSQL/postgresql-10.0/config'
gmake[1]: Nothing to be done for `all'.
gmake[1]: Leaving directory `/u02/postgreSQL/postgresql-10.0/config'
All of PostgreSQL successfully made. Ready to install.
[root@tjtestrac1 postgreSQL]# su - postgres[postgres@tjtestrac1 ~]$ /u02/postgreSQL/pg10/bin/initdb --help
initdb initializes a PostgreSQL database cluster.
Usage:
initdb [OPTION]... [DATADIR]
Options:
-A, --auth=METHOD default authentication method for local connections
--auth-host=METHOD default authentication method for local TCP/IP connections
--auth-local=METHOD default authentication method for local-socket connections
[-D, --pgdata=]DATADIR location for this database cluster
-E, --encoding=ENCODING set default encoding for new databases
--locale=LOCALE set default locale for new databases
--lc-collate=, --lc-ctype=, --lc-messages=LOCALE
--lc-monetary=, --lc-numeric=, --lc-time=LOCALE
set default locale in the respective category for
new databases (default taken from environment)
--no-locale equivalent to --locale=C
--pwfile=FILE read password for the new superuser from file
-T, --text-search-config=CFG
default text search configuration
-U, --username=NAME database superuser name
-W, --pwprompt prompt for a password for the new superuser
-X, --waldir=WALDIR location for the write-ahead log directory
Less commonly used options:
-d, --debug generate lots of debugging output
-k, --data-checksums use data page checksums
-L DIRECTORY where to find the input files
-n, --no-clean do not clean up after errors
-N, --no-sync do not waitfor changes to be written safely to disk
-s, --show show internal settings
-S, --sync-only only sync data directory
Other options:
-V, --version output version information, thenexit
-?, --help show this help, thenexit
help 里面列出了具体参数的详情解释,这里就不赘述了
[postgres@tjtestrac1 ~]$ /u02/postgreSQL/pg10/bin/initdb -D /u02/postgreSQL/db10/data/ -W
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
Enter new superuser password:
Enter it again:
fixing permissions on existing directory /u02/postgreSQL/db10/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
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.
Success. You can now start the database server using:
/u02/postgreSQL/pg10/bin/pg_ctl -D /u02/postgreSQL/db10/data/ -l logfile start
启动数据库
[postgres@tjtestrac1 ~]$ /u02/postgreSQL/pg10/bin/pg_ctl -D /u02/postgreSQL/db10/data/ -l logfile start
waiting for server to start................. done
server started
查看数据库状态
[postgres@tjtestrac1 ~]$ /u02/postgreSQL/pg10/bin/pg_ctl -D /u02/postgreSQL/db10/data/ status
pg_ctl: server is running (PID: 27289)
/u02/postgreSQL/pg10/bin/postgres "-D""/u02/postgreSQL/db10/data"
关闭数据库
[postgres@tjtestrac1 ~]$ /u02/postgreSQL/pg10/bin/pg_ctl -D /u02/postgreSQL/db10/data/ -ms stop
waiting for server to shut down....done
server stopped