0: login as root
1:wget
2:安装
rpm -ivh pgdg-centos-9.0-2.noarch.rpm
3: vi /etc/yum.repos.d/CentOS-Base.repo
[base] and [updates] sections. add
exclude=postgresql*
4: 安装 postgresql
yum check postgres*
yum install postgresql90-libs.x86_64
yum install postgresql90.x86_64
yum install postgresql90-devel.x86_64
yum install postgresql-server
5: 设置数据库
service postgresql-9.0 initdb
service postgresql-9.0 start
su - postgres
vi .bash_profile
添加
export PATH=/usr/pgsql-9.0/bin:$PATH
exit
su - postgres
cd $PGDATA
vi postgresql.conf
修改 listen_addresses = '*'
vi pg_hba.conf
在 # IPv4 local connections: 行后增加
host all all 192.168.xxx.0/24 md5
pg_ctl reload
6: 修改数据库 postgres 用户密码
psql
postgres=#
alter user postgres with password 'xxxxxx';
7: 创建用户、数据库
CREATE USER db_user1 WITH PASSWORD 'xxxxxx';
CREATE DATABASE testdb WITH OWNER = "db_user1" ENCODING = 'UTF8';
阅读(1354) | 评论(0) | 转发(0) |