Postgres使用小结---安装
近期研究了一下PostgreSQL,就安装作个小结。
PostgreSQL及Berkeley DB都是University of California Berkeley 分校的研究成果,是Linux下的比较流行的数据库软件,而且都是Open Source(为此,深感Berkeley分校确是研究性的世界一流大学, 想继续深造的朋友不妨选择该校)。
Downloading and install
1 download websit: www.postgresql.org
2 extract
tar -zxvf postgresql-8.2.4.tar.gz
this will create the directory postgresql-8.2.4, which contain all of the source code to compile.
3 run configure command
change to postgresql-8.2.4 directory to run the configure command:
./configure
4 run gmake command
gmake
5 run gmake install as the root user
gmake install
6 add new user named postgres
adduser postgres
7 create a new dircectory named data under the /usr/local/pgsql :
mkdir /usr/local/pgsql/data
8 give postgress user privilege to access the new directory data
chown postgres /usr/local/pgsql/data
9 change as postgres user
su postgres
10 initialize the default postgreSQL database called postgres in /usr/local/pgsql/data, we can start the PostgreSQL server using pg_ctl as postgres user:
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
11 if we want to build programs, me must add the lib directory to /etc/ld.so.conf file, and then run ldconfig as root user
add new line with /usr/local/pgsql/lib to the /etc/ld.so.conf file.