环境: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. LeetCode之旅(13)-Valid Anagram

    题目介绍: Given two strings s and t, write a function to determine if t is an anagram of s. For example, ...

  2. mybatis ---- 实现数据的增删改查

    前面介绍了接口方式的编程,需要注意的是:在book.xml文件中,<mapper namespace="com.mybatis.dao.IBookDao"> ,命名空间 ...

  3. Symmetric Tree 对称树

    判断一棵二叉树是否为对称的树.如 1 / \ 2 2 / \ / \ 3 4 4 3 观察上面的树可以看出:左子树的右子树等于右子树的左子树,左子树的左子树等于右子树的右子树. 首先可以使用递归.递归 ...

  4. iframe实现局部刷新和回调(转)

    今天做项目遇到一个问题.就是提交表单的时候,要在后台验证用户名是否存在和验证码是否正确. 当验证码或者用户名存在的时候.在后台弹窗提示.可页面原本file里面符合要求的值刷新没了.用户体验不好.因为用 ...

  5. 实例解析Collections源码,Iterator和ListIterator

    比如一个视频或文章有多个页面标签设置,我们在看一篇文章或一个视频时,底部有为你推荐栏目. 如何根据这个文章或视频的标签,来实现这个推荐栏目呢. public List<VideoInfoVo&g ...

  6. Top Open Source Projects to Watch in 2017

    https://opensource.com/article/16/12/yearbook-projects-watch-2017 No one has a crystal ball to see t ...

  7. Android Studio集成Lombok Plugin

    Lombok是Android Studio名列前茅的插件,有啥用,看这个:http://www.blogjava.NET/fancydeepin/archive/2012/07/12/lombok.h ...

  8. 下载Github上某个项目的子文件夹和单个文件

    preface Github下的项目可能很大,里面有很多的子文件夹,我们可能只需要使用某个子目录下的资源,可以不用下载完整的repo就能使用. 例如,我想下载这个repo中的字典文件:https:// ...

  9. MQTT入手笔记

    MQTT服务官网:http://mosquitto.org/download/ 在unix系统按照以下步骤运行并启动mqtt服务: 1. # 下载源代码包wget http://mosquitto.o ...

  10. SpringBoot jar包中资源加载问题

    在IDE下调试怎么也没有发现问题,但是部署到服务器上,提示找不到资源,找了半天资料总算是找到了原因: Jar包中的资源加载不能使用File方式,只能使用InputStream方式读取.知道原因就好解决 ...