postgres 数据库的安装
环境: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 数据库的安装的更多相关文章
- 以windows服务方式快速部署免安装版Postgres数据库
目录 以windows服务方式快速部署免安装版Postgres数据库 1.下载Postgresql数据库免安装包 2.安装环境准备及验证 解压文件 测试环境依赖 3.创建并初始化数据目录 创建数据目录 ...
- pgadmin(IDE)工具连接postgres数据库
1. 下载软件 软件地址:http://www.pgadmin.org/download/pgagent.php 2.安装软件 安装过程:略 打开软件64位会出现 “无 ...
- Postgres绿色版本安装 windows
虽然PostgreSQL是为类UNIX平台开发的,但它却是可以移植的.从7.1版本开始,PostgreSQL可以编译安装和作为一个PostgreSQL服务器运行在Windows NT 4,2000,X ...
- 配置postgres9.3间的fdw——实现不同postgres数据库间的互访问
下面是安装.配置.使用fdw实现postgres数据库间互访问的方法,转载注明出处: 1.源码安装fdw支持(要求数据库源码安装) cd /usr/local/postgresql-9.3.2/con ...
- PostgreSQL数据库的安装
1 总体规划 操作系统 CentOS Linux release 7.5.1804 处理器 1 内存 4G 硬盘 38G 主机名称 chenzx IP地址 192.168.56.8 1.1 用户组和用 ...
- PostgreSQL数据库的安装与配置
项目中要用PostgreSQL,所以专门学习了一下如何安装和调试postgresql,此博文用来记录自己的安装和调试过程,安装环境是centos7. 首先尝试了yum安装,因为毕竟yum安装简单粗暴, ...
- postgres数据库小记
因为工作中需要查询其他部门数据库,刚好是postgres数据库,用python链接的话,可以用psycopg2库,具体用法其实和MysqlDB是一样的,就是安装的时候遇到点问题. 安装的时候,提示: ...
- linux服务器自动备份与删除postgres数据库数据
1.先创一个back.sh 文件,授权,然后在下面这个文件添加脚本 export PGPASSWORD='123456' #这是登录服务器密码cur_time=`date +%Y%m%d ...
- 在ef core中使用postgres数据库的全文检索功能实战之中文支持
前言 有关通用的postgres数据库全文检索在ef core中的使用方法,参见我的上一篇文章. 本文实践了zhparser中文插件进行全文检索. 准备工作 安装插件,最方便的方法是直接使用安装好插件 ...
随机推荐
- WebService学习--(一)webservice相关概念
一.序言 大家或多或少都听过 WebService(Web服务),有一段时间很多计算机期刊.书籍和网站都大肆的提及和宣传WebService技术,其中不乏很多吹嘘和做广告的成 分.但是不得不承认的是W ...
- int类型被强制转换成较低精度的byte类型
公司的项目上线之前会进行代码合规性检查,其中很容易违反的一个规则就是“不要把原始类型转换成较低的精度”,实际开发的过程中,很多方法在处理数据时,尤其在做移位操作的时候,难免要把int类型转换成byte ...
- 《JUnit实战(第2版)》读书笔记
第1章 JUnit起步 主要了解JUnit,如何安装.运行JUnit 要点 JUnit4不需要像JUnit3那样extends TestCase类 Junit4基本都是用注解(该书都翻译为注释,但我喜 ...
- 浏览器调试js
在Google Chrome浏览器出来之前,我一直使用FireFox,因为FireFox的插件非常丰富,更因为FireFox有强大的Firebug,对于前端开发可谓神器. 在Chrome出来的时候,我 ...
- ThreadPoolExecutor的运转机制
最近发现几起对ThreadPoolExecutor的误用,其中包括自己,发现都是因为没有仔细看注释和内部运转机制,想当然的揣测参数导致,先看一下新建一个ThreadPoolExecutor的构建参数: ...
- 苹果公司揭秘首批列入 Swift 源代码兼容性开源项目清单
源代码兼容性是 Swift 未来的目标.为了实现这一目标,(苹果公司的 swift 编译器团队)建立了一个源兼容性测试套件,用于根据 Swift 源代码(逐渐增加)语料库对编译器进行回归测试更改. 添 ...
- Pod install 之后 no such module
官方文档在pod install之后的操作是: open App.xcworkspace 使用pod以后,项目的旧打开方式就不行了,必须到项目目录里面,打开“项目名.xcworkspace”这种方式来 ...
- Django若干新版本一些新特性
前面那篇文章简单总结了1.9版本的新特性,其实这是我一直想做的一件事情,不过因为对于工作不是那么紧急需要,所以一直被搁浅着,今天既然做了就多做一点吧 Django1.8的新特性大概(2015年4月发布 ...
- Android开发之adb无法连接
2017/11/14 21:20 Unable to run 'adb': null 21:20 'E:\AndroidSDK\platform-tools\adb.exe start-server' ...
- codeforces——961B. Lecture Sleep
本文为博主原创文章,未经允许不得转载. 我在csdn也同步发布了此文,链接 https://blog.csdn.net/umbrellalalalala/article/details/7989196 ...