2、 开始安装最新版PostgreSQL
现在已经可以使用yum直接安装
yum -y install postgresql postgresql-contrib postgresql-libs postgresql-plperl postgresql-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.ustc.edu.cn * epel: ftp.jaist.ac.jp * extras: centos.ustc.edu.cn * rpmforge: mirror.hmc.edu * updates: ftp.iij.ad.jp Setting up Install Process Resolving Dependencies –> Running transaction check —> Package postgresql92.i686 0:9.2.1-1PGDG.rhel6 will be installed —> Package postgresql92-contrib.i686 0:9.2.1-1PGDG.rhel6 will be installed —> Package postgresql92-libs.i686 0:9.2.1-1PGDG.rhel6 will be installed —> Package postgresql92-plperl.i686 0:9.2.1-1PGDG.rhel6 will be installed —> Package postgresql92-server.i686 0:9.2.1-1PGDG.rhel6 will be installed –> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================== Package Arch Version ====================================================================================================================== Installing: postgresql92 i686 9.2.1-1PGDG.rhel6 postgresql92-contrib i686 9.2.1-1PGDG.rhel6 postgresql92-libs i686 9.2.1-1PGDG.rhel6 postgresql92-plperl i686 9.2.1-1PGDG.rhel6 postgresql92-server i686 9.2.1-1PGDG.rhel6 Transaction Summary ====================================================================================================================== Install 5 Package(s) Total download size: 5.3 M Installed size: 21 M Downloading Packages: (1/5): postgresql92-9.2.1-1PGDG.rhel6.i686.rpm (2/5): postgresql92-contrib-9.2.1-1PGDG.rhel6.i686.rpm (3/5): postgresql92-libs-9.2.1-1PGDG.rhel6.i686.rpm (4/5): postgresql92-plperl-9.2.1-1PGDG.rhel6.i686.rpm (5/5): postgresql92-server-9.2.1-1PGDG.rhel6.i686.rpm ———————————————————————————————————————- Total Running rpm_check_debug Running Transaction Test Transaction Test Succeeded Running Transaction Installing : postgresql92-libs-9.2.1-1PGDG.rhel6.i686 Installing : postgresql92-9.2.1-1PGDG.rhel6.i686 Installing : postgresql92-server-9.2.1-1PGDG.rhel6.i686 Installing : postgresql92-plperl-9.2.1-1PGDG.rhel6.i686 Installing : postgresql92-contrib-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-plperl-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-server-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-libs-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-contrib-9.2.1-1PGDG.rhel6.i686 Verifying : postgresql92-9.2.1-1PGDG.rhel6.i686 Installed: postgresql92.i686 0:9.2.1-1PGDG.rhel6 postgresql92-contrib.i686 0:9.2.1-1PGDG.rhel6 pos postgresql92-plperl.i686 0:9.2.1-1PGDG.rhel6 postgresql92-server.i686 0:9.2.1-1PGDG.rhel6 Complete!
3、初始化数据库并启动
安装操作顺利完成后,对数据库进行初始化,然后启动服务
[root@wardking ~]# service postgresql-9.2 initdb Initializing database: [ OK ] [root@wardking ~]# service postgresql-9.2 start Starting postgresql-9.2 service: [ OK ]
如果有错误信息出现,检查日志文件 /var/lib/pgsql/9.2/data/pg_log,查找线索
4、 配置工作环境