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

猜你喜欢

转载自mauersu.iteye.com/blog/2032834
今日推荐