Chinaunix首页 | 论坛 | 博客
  • 博客访问: 77617
  • 博文数量: 15
  • 博客积分: 1420
  • 博客等级: 上尉
  • 技术积分: 160
  • 用 户 组: 普通用户
  • 注册时间: 2007-07-12 18:50
文章分类

全部博文(15)

文章存档

2010年(2)

2009年(1)

2007年(12)

我的朋友

分类:

2007-07-27 15:05:45

最简洁的安装。
[root@Enterprise ~]# cd /usr/local
[root@Enterprise local]# tar -zxf /root/postgresql-8.2.4.tar.gz
[root@Enterprise local]# cd postgresql-8.2.4
[root@Enterprise postgresql-8.2.4]# ls
aclocal.m4  config.status  contrib    GNUmakefile     INSTALL   src
config      configure      COPYRIGHT  GNUmakefile.in  Makefile
config.log  configure.in   doc        HISTORY         README
配置
[root@Enterprise postgresql-8.2.4]# ./configure --prefix=PREFIX
(PREFIX是安装postgresql的路径)
我直接用的./configure
[root@Enterprise postgresql-8.2.4]# ./configure
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking which template to use... linux
checking whether to build with 64-bit integer date/time support... no
checking whether NLS is wanted... no
checking for default port number... 5432
接着是编译
[root@Enterprise postgresql-8.2.4]# gmake
安装
[root@Enterprise postgresql-8.2.4]# gmake install
安装完成
[root@Enterprise postgresql-8.2.4]# adduser postgresql
[root@Enterprise postgresql-8.2.4]# mkdir /usr/local/pgsql/data
[root@Enterprise postgresql-8.2.4]# chown postgresql /usr/local/pgsql/data
[root@Enterprise postgresql-8.2.4]# su - postgresql
 
尝试启动数据库
[postgresql@Enterprise ~]$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ start
server starting
[postgresql@Enterprise ~]$ LOG:  database system was shut down at 2007-07-27 06:22:07 HKT
LOG:  checkpoint record is at 0/46AEF4
LOG:  redo record is at 0/46AEF4; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 0/624; next OID: 16397
LOG:  next MultiXactId: 1; next MultiXactOffset: 0
LOG:  database system is ready
停止
[postgresql@Enterprise ~]$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data/ stop
LOG:  received smart shutdown request
LOG:  shutting down
LOG:  database system is shut down
waiting for server to shut down.... done
server stopped
创建数据库
[postgresql@Enterprise ~]$ /usr/local/pgsql/bin/createdb testdb
CREATE DATABASE
登陆
[postgresql@Enterprise ~]$ /usr/local/pgsql/bin/psql testdb
Welcome to psql 8.2.4, 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
testdb=#
执行脚本
testdb=# \i /home/postgresql/test_table.sql
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "aaa_pkey" for table "aaa"
psql:/home/postgresql/test_table.sql:1: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "aaa_pkey" for table "aaa"
CREATE TABLE
先写这么多吧!
 
 
阅读(1417) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~