环境:Linux version 2.6.32-642.el6.x86_64   软件版本:postgresql-9.6.8.tar.gz

新项目要上线测试,要求安装一个PG 的数据库

我们进行的是源码包的安装

1:下载源码包

2:安装数据库需要的依赖包

yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-devel gcc-c++ openssl-devel cmake

3:解压源码包

[root@oracle soft]# tar -xvf postgresql-9.6.8.tar.gz

4:创建 需要的目录

[root@oracle soft]# mkdir postgres
[root@oracle soft]# mkdir pgsql

5:进入解压后的目录

[root@oracle soft]# cd postgresql-9.6.8

6:开始编译安装PostgreSQL 数据库

[root@oracle postgresql-9.6.8]# ./configure --prefix=/data/soft/postgres

7:执行gmake

8:执行gmake install

9:创建postgresql 的数据目录

[root@oracle soft]# mkdir pgsql

[root@oracle ~]# groupadd postgres
[root@oracle ~]# useradd -g postgres postgres

[root@oracle soft]# chown postgres:postgres /data/soft/postgres -R
[root@oracle soft]# chown postgres:postgres /data/soft/pgsql -R
[root@oracle soft]# chmod 700 /data/soft/pgsql -R

10:配置环境变量

[postgres@oracle ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export PATH=/data/soft/postgresql/bin:$PATH
export PGDATA=/data/soft/pgsql

11:初始化数据库 指定数据目录

[postgres@oracle ~]$ /data/soft/postgres/bin/initdb -D /data/soft/pgsql/
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/soft/pgsql ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... 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:

/data/soft/postgres/bin/pg_ctl -D /data/soft/pgsql/ -l logfile start

12:启动数数据库

[postgres@oracle ~]$ /data/soft/postgres/bin/pg_ctl start
server starting
[postgres@oracle ~]$ LOG: database system was shut down at 2018-05-22 15:11:11 CST
LOG: MultiXact member wraparound protections are now enabled
LOG: database system is ready to accept connections
LOG: autovacuum launcher started

13:创建数据库

[postgres@oracle ~]$ psql
-bash: psql: command not found
如果报上面的错误说明你的你的程序的路径不在path变量中,用绝对路径调用下你的psql看看

postgres=# create user lhh with login password 'm2i3sc@newnet';

^
postgres=# grant all privileges on database nntlds to lhh;

到这一个postgresql 数据库就算搭建完成了。

postgres 数据库的安装的更多相关文章

  1. 以windows服务方式快速部署免安装版Postgres数据库

    目录 以windows服务方式快速部署免安装版Postgres数据库 1.下载Postgresql数据库免安装包 2.安装环境准备及验证 解压文件 测试环境依赖 3.创建并初始化数据目录 创建数据目录 ...

  2. pgadmin(IDE)工具连接postgres数据库

    1. 下载软件        软件地址:http://www.pgadmin.org/download/pgagent.php   2.安装软件    安装过程:略    打开软件64位会出现  “无 ...

  3. Postgres绿色版本安装 windows

    虽然PostgreSQL是为类UNIX平台开发的,但它却是可以移植的.从7.1版本开始,PostgreSQL可以编译安装和作为一个PostgreSQL服务器运行在Windows NT 4,2000,X ...

  4. 配置postgres9.3间的fdw——实现不同postgres数据库间的互访问

    下面是安装.配置.使用fdw实现postgres数据库间互访问的方法,转载注明出处: 1.源码安装fdw支持(要求数据库源码安装) cd /usr/local/postgresql-9.3.2/con ...

  5. PostgreSQL数据库的安装

    1 总体规划 操作系统 CentOS Linux release 7.5.1804 处理器 1 内存 4G 硬盘 38G 主机名称 chenzx IP地址 192.168.56.8 1.1 用户组和用 ...

  6. PostgreSQL数据库的安装与配置

    项目中要用PostgreSQL,所以专门学习了一下如何安装和调试postgresql,此博文用来记录自己的安装和调试过程,安装环境是centos7. 首先尝试了yum安装,因为毕竟yum安装简单粗暴, ...

  7. postgres数据库小记

    因为工作中需要查询其他部门数据库,刚好是postgres数据库,用python链接的话,可以用psycopg2库,具体用法其实和MysqlDB是一样的,就是安装的时候遇到点问题. 安装的时候,提示: ...

  8. linux服务器自动备份与删除postgres数据库数据

    1.先创一个back.sh 文件,授权,然后在下面这个文件添加脚本 export PGPASSWORD='123456'        #这是登录服务器密码cur_time=`date +%Y%m%d ...

  9. 在ef core中使用postgres数据库的全文检索功能实战之中文支持

    前言 有关通用的postgres数据库全文检索在ef core中的使用方法,参见我的上一篇文章. 本文实践了zhparser中文插件进行全文检索. 准备工作 安装插件,最方便的方法是直接使用安装好插件 ...

随机推荐

  1. 回顾一下shell脚本1

    首先: 1.编写一个hello.sh的程序 hello.sh vim hello.sh #!/bin/sh #作者:yangyx echo "hello shell"</sp ...

  2. Digogo ugdx文件的制作

    The openplatform source code is in old IT FTP server at "vte/KCD/20150814/openplatform_wallace. ...

  3. unix下对于字符串变量的各种操作总结

    在unix like系统的shell中,提供了很多操作字符串变量的灵活语法,我们接下来依次来看一看. apple@kissAir: ~$path=$PATH apple@kissAir: ~$echo ...

  4. ruby利用Zip Gem写一个简单的压缩和解压的小工具

    在UNIX下的我们怎么会沦落到用ruby写压缩和解压工具呢?直接上shell啊!但是请允许本猫这次可耻的用ruby来玩玩吧!其实ruby GEM中有很多压缩解压包,我选的是Zip,也许是因为名字符合K ...

  5. Mac环境svn的使用

    在Windows环境中,我们一般使用TortoiseSVN来搭建svn环境.在Mac环境下,由于Mac自带了svn的服务器端和客户端功能,所以我们可以在不装任何第三方软件的前提下使用svn功能,不过还 ...

  6. R实战 第七篇:绘图文本表

    文本表是显示数据的重要图形,一个文本表按照区域划分为:列标题,行标题,数据区,美学特征有:前景样式.背景央视.字体.网格线等. 一,使用ggtexttable绘图文本表 载入ggpubr包,可以使用g ...

  7. ORACLE之TO_DATE (转载)

    转自 http://www.cnblogs.com/anran_guojianjun/archive/2009/09/11/1564535.html 一.在使用Oracle的to_date函数来做日期 ...

  8. OkHttp上传文件,服务器端请求解析找不到文件信息的问题

    长话短说,不深入解释了,官方给的上传案例代码: private static final String IMGUR_CLIENT_ID = "..."; private stati ...

  9. Docker快速入门(二)

    上篇文章<Docker快速入门(一)>介绍了docker的基本概念和image的相关操作,本篇将进一步介绍image,容器和Dockerfile. 1 image文件 (1)Docker ...

  10. 架构之微服务(etcd)

    1. ETCD是什么 ETCD是用于共享配置和服务发现的分布式,一致性的KV存储系统.该项目目前最新稳定版本为2.3.0. 具体信息请参考[项目首页]和[Github].ETCD是CoreOS公司发起 ...