linux 安装org2pg_linux 下怎么看postgresql安装到哪个目录了

本文介绍了在Suse Linux 11上安装PostgreSQL 9.1的步骤,包括创建用户和目录、以root权限运行安装程序、设置数据库超级用户的密码和端口,以及配置环境变量和网络信任关系。
摘要由CSDN通过智能技术生成

匿名用户

1级

2016-04-11 回答

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)环境变量

postgres@campost:~> 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

postgres@campost:~> . .profile

配置如上环境表里之后,可以使用psql连接数据库:

postgres@campost:/opt/PostgreSQL/9.1/data> 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

重启数据库:

postgres@campost:~> pg_ctl restart

waiting for server to shut down.... done

server stopped

server starting

此时可以用PgAdmin远程登录postgres用户了,此时只有一个库postgres。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值