PostgreSQL installation on Fedora 8

源:http://blog.sina.com.cn/s/blog_48c95a190100e3g1.html
评:
今天突然意识到有可能以后要与PostgreSQL为伍的形势,所以赶紧尝试着在Fedora 8上装了一下传说中最Advanced的开源数据库系统,现在总结安装过程如下:
首先,从PostgreSQL的官方网站上下载其源代码,本人下载的版本是postgresql-8.3.7。然后为数据库建立对应的用户以避免以root登陆而造成安全漏洞。
# useradd postgres
然后解压下载的源代码到/usr/local/src中
# tar xvfz postgresql-8.3.7.tar.gz
# cd postgresql-8.3.7
# ./configure
# make
# make install
此时PostgreSQL的安装就完成了,但还需要进行相应的后续工作。
建立数据库目录
# mkdir /usr/local/pgsql/data
# chown -R postgres.postgres /usr/local/pgsql/data
此时,以postgres用户登录
# su - postgres
[postgres@localhost bin]$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/
[postgres@localhost bin]$ cd /usr/local/pgsql/bin
启动服务
[postgres@localhost bin]$ pg_ctl -D /usr/local/pgsql/data start
server starting
创建数据库
[postgres@localhost bin]$ createdb test
CREATE DATABASE
对数据库进行测试
[postgres@localhost bin]$ psql test
Welcome to psql 8.2.5, the PostgreSQL interactive terminal.

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

test=# create table mytable(Id varchar(20),Name varchar(30));
CREATE TABLE
test=# insert into mytable values('05601083','Zhichao Liang');
INSERT 0 1
test=# select * from mytable;
id | name
----------+---------------
05601083 | Zhichao Liang
(1 行)

test=#
此时,PostgreSQL已经可以正常使用了。
注:以上资料都是综合了网上其它人所写的关于PostgreSQL安装的中文文档,其实也可以直接根据PostgreSQL官网上所给的方法,步骤更加简单同时对于每一步都进行了相应的注释,链接如下http://www.postgresql.org/docs/8.4/interactive/install-procedure.html
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值