安装PostgreSQL 64 笔记
下载地址:
32位源代码
ftp://ftp.postgresql.org/pub/source/
64位官方下载
http://www.enterprisedb.com/downloads/postgres-postgresql-downloads
########################################
上传到/opt目录
选择文本安装
./postgresql-9.1.1-1-linux-x64.bin --mode text
##############################################################
Please provide a password for the database superuser (postgres). A locked Unix user account (postgres) will be created if not present.
Password :[ 输入密码]
Retype password :[ 重复]
—————————————————————————-
Please select the port number the server should listen on.
Port [5432]:[ 默认端口,就回车]
[628] zu_ZA.iso88591
[629] zu_ZA.utf8
Please choose an option [1] : [ 默认字符集]
Install pl/pgsql in template1 database? [Y/n]: n [是否安装模板库]
—————————————————————————-
Setup is now ready to begin installing PostgreSQL on your computer.
Do you want to continue? [Y/n]: y[ 是否继续安装]
—————————————————————————-
Please wait while Setup installs PostgreSQL on your computer.
Installing
0% ______________ 50% ______________ 100%
##############################################################
—————————————————————————-
Setup has finished installing PostgreSQL on your computer.
Launch Stack Builder at exit?
Stack Builder may be used to download and install additional tools, drivers and applications to complement your PostgreSQL installation. [Y/n]: y
创建用户:
# useradd postgre
(权限)
# chown -R postgre.postgre /opt/PostgreSQL
配置用户环境变量
vi /home/postgre/.bash_profile
PGLIB=/PostgreSQL/9.1/lib/
PGDATA=$HOME/data
PATH=$PATH:/PostgreSQL/9.1/bin
MANPATH=$MANPATH:/PostgreSQL/9.1/man
export PGLIB PGDATA PATH MANPATH
###################################################################
以 postgres 用户登录,
# su - postgre
建立数据库目录:
$ mkdir data
启动数据库引擎:
$ initdb
[postgre@www postgre]$ initdb
.....
Loading pg_description.
Vacuuming database.
Success. You can now start the database server using:
#######################################################################
启动数据库
$pg_ctl -D /home/postgre/data start
$ postmaster -i -D ~/data &
建立数据库
$createdb mydb
PostgreSQL 会返回 “ CREATED DATABASE”的信息,表明数据库建立完成。
$psql mydb
进入交互 psql 工具
###########################################################################
psql.bin (9.1.1)
Type "help" for help.
mydb=#