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中文插件进行全文检索. 准备工作 安装插件,最方便的方法是直接使用安装好插件 ...
随机推荐
- git分享:Git_MinaPro
Apache MINA+MyBatis+EHcache定制开发,实现终端设备数据的实时接收解析存储. <项目运行:打包下载所有文件导入Eclipse,将datapro.sql导入mysql数据库 ...
- mybatis --- 以接口的方式进行编程
); 我们来学习下接口方式的编程. 接口类IBookDao.java package com.mybatis.dao; import com.mybatis.model.Book; public i ...
- What’s new in Channels 2 摘译
最近准备在一个老Django项目上启用Channels,Channels于今年2月2日发布2.0版本,这个版本包含很多不向前兼容的特性,为了新特性调研的需要,也为了方便社区,我新版本的What's N ...
- Spring MVC “404 Not Found”错误的解决
一般这个问题发生的原因不会出在Web.xml配置文件的Servlet URL映射部分,因为这个URL映射做JavaWeb的人经常配置不会发生错误,而且此处的这个映射自由度很大,可以有目录字符串,也可以 ...
- Django push: Using Server-Sent Events and WebSocket with Django
http://curella.org/blog/2012/jul/17/django-push-using-server-sent-events-and-websocket/ The goal of ...
- 在基于debian的deepin或者Ubuntu上双等号“==”和双中括号“[[]]”不能使用的真相
使用的deepin-linux,今天写shell脚本的时候,忽然发现 sh test.sh 会报错[[: not found ,双等号和双中括号都不能使用了,很郁闷,后来探索发现,sh其实是dash的 ...
- JAVAEE——BOS物流项目13:Quartz入门案例、核心概念、cron 表达式的格式(了解)
1.quartz入门案例 本入门案例基于spring和quartz整合完成. 第一步:创建maven工程,导入spring和quartz相关依赖 第二步:创建任务类 第三步:在spring配置文件中配 ...
- JS中的top是什么?
<iframe/>或者<frame>里面用主页面的东西,就是top.xxx如:<script> function func(){ ... };</script ...
- eclipse中maven下载不了私服上面的第三方包问题
问题描述在nexus中上传了第三方jar包,在本地项目中添加了引用,但就是下载不下来. 转载文章 1. 打开windows -> preferences -> maven,勾选如图所示 2 ...
- spring-mvc报红错误
can't resolve spring 以及运行测试案例报错 ‘无法找到路径’ 解决办法是在pom文件里面重新配置 对应 resource <resources> <resou ...