CentOS 6.5系统下安装postgresql数据库+postgis+pgagent+pgadmin工具
2017-03-21 13:42
681 查看
CentOS 6.5系统下安装postgresql数据库+postgis+pgagent+pgadmin工具
本文档主要记录在一个全新的centos6.5系统下安装postgresql数据以及其他相关工具的步骤和注意事项。postgresql的其他工具的安装方式也是类似的。检查是否有pg数据库的源:
命令:
yum list postgres*
如无结果,则说明当前系统未引用pg数据库相关的yum源,需要先安装pg的yum源,安装命令如下:
rpm -Uvh https://yum.postgresql.org/9.5/redhat/rhel-6.5-x86_64/pgdg-centos95-9.5-3.noarch.rpm[/code]
注意:pgdg-centos95-9.5-3.noarch.rpm名称会根据版本变化而变化,具体可以打开https://yum.postgresql.org/9.5/redhat/rhel-6.5-x86_64/查看具体的可用版本。
下载的是pg9.5版本的源。
再次运行yum list postgres*命令,结果如下:Loaded plugins: fastestmirror, refresh-packagekit, security Loading mirror speeds from cached hostfile * base: mirrors.tuna.tsinghua.edu.cn * extras: mirror.bit.edu.cn * updates: mirror.bit.edu.cn base | 3.7 kB 00:00 extras | 3.4 kB 00:00 google-chrome | 951 B 00:00 pgdg95 | 4.1 kB 00:00 pgdg95/primary_db | 176 kB 00:02 updates | 3.4 kB 00:00 updates/primary_db | 5.4 MB 00:05 Available Packages postgresql.i686 8.4.20-6.el6 base postgresql.x86_64 8.4.20-6.el6 base postgresql-contrib.x86_64 8.4.20-6.el6 base postgresql-devel.i686 8.4.20-6.el6 base postgresql-devel.x86_64 8.4.20-6.el6 base postgresql-docs.x86_64 8.4.20-6.el6 base postgresql-jdbc.noarch 42.0.0-1.rhel6 pgdg95 postgresql-jdbc-javadoc.noarch 42.0.0-1.rhel6 pgdg95 postgresql-libs.i686 8.4.20-6.el6 base postgresql-libs.x86_64 8.4.20-6.el6 base postgresql-odbc.x86_64 08.04.0200-1.el6 base postgresql-plperl.x86_64 8.4.20-6.el6 base postgresql-plpython.x86_64 8.4.20-6.el6 base postgresql-pltcl.x86_64 8.4.20-6.el6 base postgresql-server.x86_64 8.4.20-6.el6 base postgresql-test.x86_64 8.4.20-6.el6 base postgresql-unit95.x86_64 1.0-1.rhel6 pgdg95 postgresql-unit95-debuginfo.x86_64 1.0-1.rhel6 pgdg95 postgresql94-jdbc.noarch 9.4.1207-1.rhel6 pgdg95 postgresql94-jdbc-javadoc.noarch 9.4.1207-1.rhel6 pgdg95 postgresql95.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-contrib.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-debuginfo.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-devel.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-docs.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-libs.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-odbc.x86_64 09.06.0100-1PGDG.rhel6 pgdg95 postgresql95-odbc-debuginfo.x86_64 09.03.0400-1PGDG.rhel6 pgdg95 postgresql95-plperl.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-plpython.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-pltcl.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-server.x86_64 9.5.6-2PGDG.rhel6 pgdg95 postgresql95-tcl.x86_64 2.0.0-1.rhel6 pgdg95 postgresql95-tcl-debuginfo.x86_64 2.0.0-1.rhel6 pgdg95 postgresql95-test.x86_64
数据库安装
可以看到,现在有若干pg的源可以使用。
运行安装命令:yum install postgresql95-devel.x86_64 yum install postgresql95-server.x86_64 yum install postgresql95-contrib.x86_64
即可安装64位版pg9.5数据库。PG数据库默认会安装到/usr/pgsql-9.5 目录下,在此目录下手动创建data文件夹,用来作为数据目录。
配置环境变量
在etc目录下,打开profile文件,增加如下内容:export PGHOME=/usr/pgsql-9.5 export PGDATA=/usr/pgsql-9.5/data export PATH=$PATH:$PGHOME/bin
保存退出后,运行source profile重新加载环境变量;
创建postgres用户
使用root用户为PG数据库创建管理员用户postgres,并调整PGHOME相关文件夹权限;useradd postgres chown -R postgres:postgres /usr/pgsql-9.5
初始化数据库
上述准备工作完成后,在安装目录的/usr/pgsql-9.5/bin目录下执行initdb命令:./initdb -U postgres -W -D /usr/pgsql-9.5/data/data
根据提示设置postgres用户密码后,即可完成初始化,之后即可启动数据库;
另外
在下载pg数据库yum源的地址时,同时包含了pg其他相关的工具源,如pgagent、postgis等。
执行命令:yum list postgis*可以查看到postgis的可用源,安装方式和pg数据库类似,不再赘述。
同样pgAgent和pgadmin工具安装方式类似,不再赘述;
此次安装最重要的步骤就是安装pg的yum源,之后就可以直接使用yum安装。
相关文章推荐
- centos6.5安装postgresql数据库和pgadmin客户端
- Centos6.5 下安装PostgreSQL9.4数据库
- CentOS 6.5系统中如何安装MySQL 5.6.10数据库和修改root密码
- CentOS6.5 Linux安装mysql5.6数据库 针对64位系统
- CentOS 6.5系统安装配置MySQL 5.6数据库
- CentOS 6.5系统安装配置图解教程(详细图文)
- CentOS 6.5系统安装配置图解教程(详细图文)
- centos安装postgresql数据库
- wdOS系统下安装PostgreSQL数据库~
- CentOS 6.5 + Win 7 双系统U盘安装及问题汇编
- Centos 6.5上Apache + PAM + SVN服务安装配置(使用本地系统用户认证)
- CentOS 6.5系统安装配置图解教程
- alfresco 4.2.e(postgreSQL 数据库)在linux系统安装过程
- CentOS 6.5 系统 LAMP(Apache+MySQL+PHP)安装步骤
- Centos 6.5系统安装配置图解教程
- CentOS 6.5系统上安装MySQL数据库
- 利用U盘与163的yum源镜像网站安装Centos6.5 x86_64系统 推荐
- win7硬盘安装Centos 6.5 64位双系统
- CentOS 6.5系统安装配置图解教程
- centos6.5安装KVM,并在KVM中安装虚拟6.5系统