Linux下PostgreSQL 的安装与配置 下载本文

内容发布更新时间 : 2024/5/22 10:05:53星期一 下面是文章的全部内容请认真阅读。

Linux下PostgreSQL的安装与配置

一、简介

PostgreSQL是一种非常复杂的对象-关系型数据库管理系统(ORDBMS),也是目前功能最强大,特性最丰富和最复杂的自由软件数据库系统。有些特性甚至连商业数据库都不具备。这个起源于伯克利(BSD)的数据库研究计划目前已经衍生成一项国际开发项目,并且有非常广泛的用

二、系统环境

系统平台:RHEL_6.4 x86_64

PostgreSQL版本:postgresql-test-8.4.13-1.el6_3.x86_64 防火墙已关闭/iptables: Firewall is not running. SELINUX=disabled

三、安装方式

在系统rhel6.4光盘里有postgresql软件包。Rhel光盘里一般都为比较稳定的版本,rhev环境中所使用的数据库就是postgreSQL。

A. 下载RPM包安装

B. yum 安装

C. 源码包安装 使用光盘的yum安装

[root@localhost ~]# yum install postgresqlpostgresql-server postgresql-contribpostgresql-libs Total download size: 6.7 M Installed size: 31 M Is this ok [y/N]: y Downloading Packages: Installed: postgresql.x86_64 0:8.4.13-1.el6_3 postgresql-contrib.x86_64 0:8.4.13-1.el6_3 postgresql-libs.x86_64 0:8.4.13-1.el6_3 postgresql-server.x86_64 0:8.4.13-1.el6_3 Complete!

4. 初始化PostgreSQL库

PostgreSQL服务初次启动的时候会提示初始化使用命令/etc/init.d/postgresqlinitdb

初始化数据库

[root@localhost ~]# /etc/init.d/postgresql start

/var/lib/pgsql/data is missing. Use \first.

[root@localhost ~]# /etc/init.d/postgresqlinitdb

Initializing database: [ OK ] You have new mail in /var/spool/mail/root

5. 启动服务

[root@localhost ~]# /etc/init.d/postgresql start

Starting postgresql service:

6. 把PostgreSQL服务加入到启动列表

[root@localhost ~]# chkconfigpostgresql on [root@localhost ~]# chkconfig --list |greppostgresql

postgresql 0:off 1:off 2:on 3:on 4:on [root@localhost ~]#

[ OK ] 5:on 6:off