在CentOS 6.3 安装postgresql9.5

一、安装准备

需要安装的包:

yum install postgresql95-devel-9.5.5-1PGDG.rhel6.x86_64.rpm

文件可以从官网下载。http://yum.postgresql.org/repopackages.php

操作系统:

CentOS release 6.3 (Final)

安装时如果提示yum源不对,注意调整rpm源如下:

[[email protected] yum.repos.d]# cat pgdg-95-redhat.repo
[pgdg95]
name=PostgreSQL 9.5 $releasever - $basearch
baseurl=https://download.postgresql.org/pub/repos/yum/9.5/redhat/rhel-$releasever-$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95

[pgdg95-source]
name=PostgreSQL 9.5 $releasever - $basearch - Source
failovermethod=priority
baseurl=https://download.postgresql.org/pub/repos/yum/srpms/9.5/redhat/rhel-$releasever-$basearch
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG-95

二、开始安装:

yum install postgresql95-devel-9.5.5-1PGDG.rhel6.x86_64.rpm

yum install postgresql95-server postgresql95-contrib

三、初始化数据库:

  mkdir -p /data/postgres/pgsql/data

  chown -R postgres.postgres /data/postgres/

(1)先切换到postgres用户

  [[email protected] yum.repos.d]# su - postgres

(2)如果初始化成功,会有如下提示:

-bash-4.1$ /usr/pgsql-9.5/bin/initdb -D /data/postgres/pgsql/data
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /data/postgres/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /data/postgres/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects‘ descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

/usr/pgsql-9.5/bin/pg_ctl -D /data/postgres/pgsql/data -l logfile start

-bash-4.1$

四、启动数据库:

$ /usr/pgsql-9.5/bin/pg_ctl -D /data/postgres/pgsql/data -l /tmp/postrest.log start
server starting

五、创建db

createdb mysql2gp_sy

六、登录数据库:

$ psql -h 127.0.0.1 -d mysql2gp_sy -U postgres
psql (9.5.6)
Type "help" for help.

mysql2gp_sy=#

至此,安装成功。

时间: 2024-07-31 14:29:24

在CentOS 6.3 安装postgresql9.5的相关文章

CentOS7安装PostgreSQL9.4

这次选择的数据库安装的是run 文件,更容易掌握.这次数据库全是默认安装,如果有需求的可以自行修改一下的. 这是我的第一篇博客,各位观众老爷,如果觉得哪里有什么不好的,可以留言一起探讨,探讨.有什么问题的也可以一起学习学习. 一,打开centos7的ssh 因为我的CentOS7 是新安装的,所以需要爱打开ssh,如果你的已经在使用了,这个就忽略吧. 1.1 设置静态ip 1.1.1 进入/etc/sysconfig/network-scripts/ 目录找到需要修改的网络的配置文件,并修改.

centos 使用yum 安装自定义安装postgresql和postgis扩展已经phpPgAdmin

系统信息: #head -1  /etc/issue CentOS release 6.5 (Final) 安装postgresql9.3版本: #rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm # yum install postgresql93 postgresql93-server postgresql93-libs postgresql93-contrib

CentOS 6.x安装Metasploit

      网上关于CentOS系统下安装Metasploit的教程一堆有一堆,我这里也没有什么新意,完全就是一步一步的走一遍,算是做个笔记,往后备查.       首先,我的系统是CentOS 6.4_x64版本.更新一下系统,如果系统比较老,这个时间可能会比较长,命令如下: yum update yum upgrade       开始安装Metasploit需要的所有依赖包,命令如下: yum groupinstall 'Development Tools' yum install sql

centos 6.5安装NodeJS

centos 6.5安装NodeJS 下载 可以在本地下载node.js最新版,然后通过ftp工具上传到服务器,或者直接在服务器终端使用wget命令下载(我当时下载的是node-v7.5.0-linux-x86版本,其他版本请查看上面链接然后替换即可): $ wget http://nodejs.org/dist/latest/node-v7.5.0-linux-x86.tar.gz 解压 进入服务器终端,找到上传或者下载的安装包,解压 $ tar -zvxf node-v7.5.0-linux

MongoDB 3.2 在CentOS 上的安装和配置

MongoDB 3.2 在CentOS 上的安装和配置 2016-01-06 14:41:41 发布 您的评价:       0.0   收藏     0收藏 一.安装 编辑/etc/yum.repos.d/mongodb-org-3.2.repo [mongodb-org-3.2] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/ gpg

Centos 7 一键安装openstack

系统:Centos7x64 单节点 CentOS yum 快速安装: # 安装RDO repo $ sudo yum install -y https://www.rdoproject.org/repos/rdo-release.rpm # 更新repo源 $ sudo yum update -y # 安装openstack-packstack $ sudo yum install -y openstack-packstack # 执行部署过程 $ packstack --allinone 访问

CentOS 7 yum安装Zabbix

CentOS 7 yum安装Zabbix 一.Zabbix简介 zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案.zabbix能监视各种网络参数,保证服务器系统的安全运营:并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题. 下面是Centos7上yum安装zabbix的步骤. 二.Zabbix安装 本文档在同一台机器上安装了zabbix-server 和zabbix-agent 自己监控自己. 1.配置LAMP 参照下面的链接 Centos

CentOS 6.5 安装部署iSCSi共享存储

 CentOS 6.5 安装部署iSCSi共享存储 一.前言 1.什么是iSCSI? iSCSI技术是一种由IBM公司研究开发的,是一个供硬件设备使用的可以在IP协议的上层运行的SCSI指令集,这种指令集合可以实现在IP网络上运行SCSI协议,使其能够在诸如高速千兆以太网上进行路由选择.iSCSI技术是一种新储存技术,该技术是将现有SCSI接口与以太网络(Ethernet)技术结合,使服务器可与使用IP网络的储存装置互相交换资料. iSCSI:Internet 小型计算机系统接口 (iSCSI:

CentOS 6.8安装Samba 4做Windows共享服务器

在某些情况下为了实现Windows多台服务器负载均衡,需要使用共享来做图片及附件的上传空间. 这个时候就需要使用到Samba.IIS虚拟目录等相关技术 Web服务器使用upload作为上传的目录,现在需要使用2台服务器做负载均衡,后台使用一台Samba服务器作为文件共享存储 1.建立Samba文件服务器 卸载旧的samba组件,CentOS 6默认安装的是3.6的版本 for a in `rpm -qa|grep samba`; do rpm -e --nodeps $a;done 2.安装Sa