Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2969973
  • 博文数量: 412
  • 博客积分: 3010
  • 博客等级: 中校
  • 技术积分: 7374
  • 用 户 组: 普通用户
  • 注册时间: 2009-04-25 15:15
个人简介

学习是一种信仰。

文章分类

全部博文(412)

文章存档

2014年(108)

2013年(250)

2010年(11)

2009年(43)

我的朋友

分类: Mysql/postgreSQL

2013-04-01 14:02:24

OS:suselinux11(64bit)
PostgreSQL:PostgreSQL9.1(64bit)
1、建用户及目录

linux:/home # groupadd postgres
linux:/home # useradd postgres -g postgres
linux:/home # mkdir /home/postgres
linux:/home # chown postgres:postgres /home/postgres
linux:/home # passwd postgres
2、用root运行安装(不能以postgres运行安装)
linux:/opt # mkdir /opt/PostgreSQL
linux:/opt # chown postgres:postgres /opt/PostgreSQL
linux:/opt/PostgreSQL # chmod +x postgresql-9.1.1-1-linux-x64.bin
linux:/opt/PostgreSQL # ./postgresql-9.1.1-1-linux-x64.bin
----------------------------------------------------------------------------
Welcome to the PostgreSQL Setup Wizard.
----------------------------------------------------------------------------
Please specify the directory where PostgreSQL will be installed.
Installation Directory [/opt/PostgreSQL/9.1]:
----------------------------------------------------------------------------
Please select a directory under which to store your data.
Data Directory [/opt/PostgreSQL/9.1/data]:
----------------------------------------------------------------------------
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]:
----------------------------------------------------------------------------
Advanced Options
Select the locale to be used by the new database cluster.
Locale
[1] [Default locale]
[2] C
[3] POSIX
...
[441] zu_ZA
[442] zu_ZA.utf8
Please choose an option [1] :
----------------------------------------------------------------------------
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.
3、相关配置
(1)环境变量
:~> vi .profile(new file)
export PGSQL_HOME=/opt/PostgreSQL/9.1
export PATH=$PGSQL_HOME/bin:$PATH
#export PGDATAS=$PGSQL_HOME/datas
export PGDATA=$PGSQL_HOME/data
export PGDATABASE=postgres
export PGUSER=postgres
#export PGPORT=1234
export PGLOCALEDIR=$PGSQL_HOME/share/locale
export MANPATH=$MANPATH:$PGSQL_HOME/share/man
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PGSQL_HOME/lib
:~> . .profile
配置如上环境表里之后,可以使用psql连接数据库:
> psql
Password:
psql.bin (9.1.1)
Type "help" for help.
postgres=# help
You are using psql, the command-line interface to PostgreSQL.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit
postgres=#
(2)网络配置
加网络信任关系:
----详细信息请参考PostgreSQL document,20.1. pg_hba.conf 文件
vi /opt/PostgreSQL/9.1/data/pg_hba.conf
添加一行:host    all         all                           trust
重启数据库:
:~> pg_ctl restart
waiting for server to shut down.... done
server stopped
server starting
此时可以用PgAdmin远程登录postgres用户了,此时只有一个库postgres。
阅读(2868) | 评论(0) | 转发(5) |
给主人留下些什么吧!~~