1. 作業系統資訊:Red Hat
Enterprise Linux 4
2. 下載PostgreSQL源碼:http://www.postgresql.org/ftp/source,現在已經更新到了9.1beta版本了,不過安裝過程基本一致,我之前下載的是8.4.2,所以以8.4.2進行描述。
3.上傳下載到的postgresql-8.4.2.tar.gz到/opt目錄下。
4. 創建postgres用戶及dba組,並切換到postgres用戶。
1. #useradd -g dba postgres
5.將postgresql-8.4.2.tar.gz的屬主改為postgres,並解壓。
1. [root@localhost ~]# cd /opt
2. [root@localhost ~]# #chown postgres postgresql-8.4.2
1. [root@localhost ~]# #su - postgres
1. [postgres@localhost opt]$$ cd /opt
1. [postgres@localhost opt]$$tar -zxvf postgresql-8.4.2.tar.gz
2. [postgres@localhost opt]$$ ll
3. 總用量 32
4. drwxr-xr-x
2 root root 4096 3月 28 19:49 gcc_test
5. drwxr-xr-x
8 postgres root 4096 7月 9 09:44 postgresql
6. <span style="color:#3333ff;">drwxrwxrwx 6 postgres
258 4096 7月 9 09:40 postgresql-8.4.2</span>
7. drwxr-xr-x
2 root root 4096 4月 2 19:20
testbool
6. 進入postgresql-8.4.2目錄,進行配置
1. [postgres@localhost opt]$ cd postgresql-8.4.2/
2. [postgres@localhost postgresql-8.4.2]$./configure
--prefix=/opt/postgresql --enable-profiling --with-blocksize=8 --with-wal-blocksize=8
注,各配置項意義見備後文備註。
7.編譯,大約需要5分鐘,如過程中有失敗,請確認系統上是否有make, gcc等工具,以及目錄許可權問題。
1. [postgres@localhost postgresql-8.4.2]$make
8.安裝,執行2分鐘左右,螢幕列印“PostgreSQL installation
complete”表示安裝完成。
1. [postgres@localhost postgresql-8.4.2]$make install
9.初始化資料庫。
1. [postgres@localhost postgresql-8.4.2]$ cd /opt/postgresql/bin/
2. [postgres@localhost bin]$./initdb --encoding=utf8
-D /opt/postgresql/data
初始化完成後螢幕列印如下資訊:
Success. You can
now start the database server using:
./postgres -D /opt/postgresql/data
or
./pg_ctl -D /opt/postgresql/data -l logfile start
or
./pg_ctl -D /opt/postgresql/data -l logfile start
10. 啟動資料庫
1. [postgres@localhost bin]$./postgres -D /opt/postgresql/data
當然,可以通過日誌重寫向,將啟動資訊寫入日誌,例如:
1. [postgres@localhost bin]$ ./pg_ctl -D /opt/postgresql/data/
-l /opt/postgresql/log/pg_server.log start
將日誌資訊記錄在檔/opt/postgresql/log/pg_server.log中,當然,在執行前,請先創建這個檔,且屬主為postgres。
11.安裝完畢。
備註:編譯配置項各參數說明,可根據實際情況選擇使用:
1. [postgres@localhost postgresql-8.4.2]$ ./configure
-help
2. `configure' configures PostgreSQL 8.4.2 to adapt
to many kinds of systems.
3.
4. Usage: ./configure [OPTION]... [VAR=VALUE]...
5.
6. To assign environment variables (e.g., CC, CFLAGS...),
specify them as
7. VAR=VALUE. See below
for descriptions of some of the useful variables.
8.
9. Defaults for the options are specified in brackets.
10.
11. Configuration:
12. -h, --help display this help and exit
13. --help=short
display options specific to this package
14. --help=recursive display
the short help of all the included packages
15. -V, --version display version information and exit
16. -q, --quiet,
--silent do not print `checking...' messages
17. --cache-file=FILE cache
test results in FILE [disabled]
18. -C, --config-cache alias for `--cache-file=config.cache'
19. -n, --no-create do not create output files
20. --srcdir=DIR
find the sources in DIR [configure dir or `..']
21.
22. Installation directories:
23. --prefix=PREFIX
install architecture-independent files in PREFIX
24. [/usr/local/pgsql]
25. --exec-prefix=EPREFIX install
architecture-dependent files in EPREFIX
26. [PREFIX]
27.
28. By default, `make install' will install all the
files in
29. `/usr/local/pgsql/bin', `/usr/local/pgsql/lib'
etc. You can specify
30. an installation prefix other than `/usr/local/pgsql'
using `--prefix',
31. for instance `--prefix=$HOME'.
32.
33. For better control, use the options below.
34.
35. Fine tuning of the installation directories:
36. --bindir=DIR
user executables [EPREFIX/bin]
37. --sbindir=DIR
system admin executables [EPREFIX/sbin]
38. --libexecdir=DIR program
executables [EPREFIX/libexec]
39. --sysconfdir=DIR read-only
single-machine data [PREFIX/etc]
40. --sharedstatedir=DIR modifiable
architecture-independent data [PREFIX/com]
41. --localstatedir=DIR modifiable
single-machine data [PREFIX/var]
42. --libdir=DIR
object code libraries [EPREFIX/lib]
43. --includedir=DIR C
header files [PREFIX/include]
44. --oldincludedir=DIR C header
files for non-gcc [/usr/include]
45. --datarootdir=DIR read-only
arch.-independent data root [PREFIX/share]
46. --datadir=DIR
read-only architecture-independent data [DATAROOTDIR]
47. --infodir=DIR
info documentation [DATAROOTDIR/info]
48. --localedir=DIR
locale-dependent data [DATAROOTDIR/locale]
49. --mandir=DIR
man documentation [DATAROOTDIR/man]
50. --docdir=DIR
documentation root [DATAROOTDIR/doc/postgresql]
51. --htmldir=DIR
html documentation [DOCDIR]
52. --dvidir=DIR
dvi documentation [DOCDIR]
53. --pdfdir=DIR
pdf documentation [DOCDIR]
54. --psdir=DIR
ps documentation [DOCDIR]
55.
56. System types:
57. --build=BUILD configure
for building on BUILD [guessed]
58. --host=HOST cross-compile
to build programs to run on HOST [BUILD]
59.
60. Optional Features:
61. --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
62. --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
63. --disable-integer-datetimes
64. disable 64-bit integer date/time
support
65. --enable-nls[=LANGUAGES]
66. enable Native Language
Support
67. --disable-shared do not build shared libraries
68. --disable-rpath do not embed shared library search path
in
69. executables
70. --disable-spinlocks do not use spinlocks
71. --enable-debug build with debugging symbols (-g)
72. --enable-profiling build with profiling enabled
73. --enable-coverage build with coverage testing instrumentation
74. --enable-dtrace build with DTrace support
75. --enable-depend turn on automatic dependency tracking
76. --enable-cassert enable assertion checks (for debugging)
77. --enable-thread-safety make client libraries thread-safe
78. --enable-thread-safety-force
79. force thread-safety despite thread
test failure
80. --disable-float4-byval disable float4 passed by value
81. --disable-float8-byval disable float8 passed by value
82. --disable-largefile omit support for large files
83.
84. Optional Packages:
85. --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
86. --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
87. --with-template=NAME override
operating system template
88. --with-includes=DIRS look
for additional header files in DIRS
89. --with-libraries=DIRS look
for additional libraries in DIRS
90. --with-libs=DIRS
alternative spelling of --with-libraries
91. --with-pgport=PORTNUM set default
port number [5432]
92. --with-blocksize=BLOCKSIZE
93. set table block size in
kB [8]
94. --with-segsize=SEGSIZE set table
segment size in GB [1]
95. --with-wal-blocksize=BLOCKSIZE
96. set WAL block size in
kB [8]
97. --with-wal-segsize=SEGSIZE
98. set WAL segment size in MB [16]
99. --with-CC=CMD
set compiler (deprecated)
100. --with-tcl build Tcl modules (PL/Tcl)
101. --with-tclconfig=DIR tclConfig.sh
is in DIR
102. --with-perl build Perl modules (PL/Perl)
103. --with-python build Python modules (PL/Python)
104. --with-gssapi build with GSSAPI support
105. --with-krb5 build with Kerberos 5 support
106. --with-krb-srvnam=NAME default
service principal name in Kerberos
107. [postgres]
108. --with-pam build with PAM support
109. --with-ldap build with LDAP support
110. --with-bonjour build with Bonjour support
111. --with-openssl build with OpenSSL support
112. --without-readline do not use GNU Readline nor BSD Libedit for
editing
113. --with-libedit-preferred
114. prefer BSD Libedit over
GNU Readline
115. --with-ossp-uuid use OSSP UUID library when building
116. contrib/uuid-ossp
117. --with-libxml build with XML support
118. --with-libxslt use XSLT support when building contrib/xml2
119. --with-system-tzdata=DIR
120. use system time zone data
in DIR
121. --without-zlib do not use Zlib
122. --with-gnu-ld assume the C compiler uses GNU ld [default=no]
123.
124. Some influential environment variables:
125. CC C compiler command
126. CFLAGS C compiler flags
127. LDFLAGS
linker flags, e.g. -L<lib dir> if you have libraries in a
128. nonstandard directory <lib dir>
129. LIBS libraries to pass to the linker, e.g. -l<library>
130. CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
131. you have headers in a nonstandard
directory <include dir>
132. CPP C preprocessor
133. LDFLAGS_SL linker flags for shared library linking
134. DOCBOOKSTYLE
135. location of DocBook stylesheets
136.
137. Use these variables to override the choices made
by `configure' or to help
138. it to find libraries and programs with nonstandard
names/locations.
139.
140. Report bugs to <pgsql-bugs@postgresql.org>.
141. [postgres@localhost postgresql-8.4.2]$
沒有留言:
張貼留言