PostgreSQL编译安装
PostgreSQL编译安装
- 安装语言包
### PostgreSQL 初始化过程中,会读取操作系统字符编码,
### 若程序需要使用zh_CN.utf-8字符编码,需要在PostgreSQL 初始化之前安装中文包,再初始化PostgreSQL,
### 否则未安装中文包初始化数据库,会导致数据库字符编码格式没有h_CN.utf-8字符编码格式,影响程序后期使用
# sudo apt-get install language-pack-zh*
# sudo apt-get install language-pack-en*
- 安装编译所需依赖包:
# sudo apt-get install -y libtool libapr1 make gcc libexpat1-dev
# sudo apt install libreadline5-dev
# sudo apt install libreadline-gplv2-dev
# sudo apt install zlib1g-dev
# sudo apt install uuid-dev libossp-uuid-dev
- 编译PostgreSQL:
# cd /Sioeye/SioApps/Environment/
# wget https://ftp.postgresql.org/pub/source/v10.6/postgresql-10.6.tar.gz
# tar -zxvf postgresql-10.6.tar.gz
# cd postgresql-10.6/
# ./configure --prefix=/Sioeye/SioApps/Environment/postgresql --with-ossp-uuid
# make
# make install
# cd contrib/
# make
# make install
- 创建postgres用户
### 创建postgres用户
# groupadd postgres
# useradd -g postgres -m postgres
### 设置用户密码
# passwd postgres
### 创建数据存储目录,并授权postgres用户所属权限
# mkdir -pv /Sioeye/Data/postgresql/data
# chown postgres:postgres /Sioeye/SioApps/Environment/postgresql -R
# chown postgres:postgres /Sioeye/Data/postgresql/data -R
- 初始化PostgreSQL
### 切换用户,并设置基础环境变量。
# su - postgres
# vim ~/.bash_profile
### 在其文件最底下追加以下配置
export PGHOME=/Sioeye/SioApps/Environment/postgresql
export PGDATA=/Sioeye/Data/postgresql/data/
export PATH=$PGHOME/bin:$PATH
export MANPATH=$PGHOME/share/man:$MANPATH
export LANG=en_US.utf8
export LD_LIBRARY_PATH=$PGHOME/lib:$LD_LIBRARY_PATH
# source ~/.bash_profile
### 初始化数据库
# initdb -D /Sioeye/Data/postgresql/data
### 创建日志存储目录,启动数据库
# mkdir /Sioeye/Data/logs/postgresql
# pg_ctl -D /Sioeye/Data/postgresql/data -l /Sioeye/Data/logs/postgresql/start_logs.log start
- 设置postgres用户密码
### 此处设置数据库用户密码,而非操作系统用户密码
# psql
postgres=# alter user postgres with password '123456';
- 设置开机启动
### 从源码中拷贝启动脚本到/etc/init.d/目录
# cd /Sioeye/SioApps/Environment/postgresql-10.6/start-scripts/
# cp linux /etc/init.d/postgresql
### 修改默认配置
# vim /etc/init.d/postgresql
##############################################
# Installation prefix
prefix=/Sioeye/SioApps/Environment/postgresql
# Data directory
PGDATA="/Sioeye/Data/postgresql/data/"
# Who to run the postmaster as, usually "postgres". (NOT "root")
PGUSER=postgres
PGLOG="/Sioeye/Data/logs/postgresql/"
# Where to keep a log file
PGLOG="$PGLOG/serverlog"
##############################################
# chmod a+x /etc/init.d/postgresql
# chkconfig --add postgresql
# update-rc.d postgresql defaults 98
- 按需修改pg_hba.conf,postgresql.conf文件
### /Sioeye/Data/postgresql/data/pg_hba.conf 文件最后追加
host all all 0.0.0.0 0.0.0.0 md5
### /Sioeye/Data/postgresql/data/postgresql.conf 文件修改
listen_addresses = '0.0.0.0'
port = 5432
PostgreSQL编译安装的更多相关文章
- postgresql编译安装与调试(二)
接前文postgresql编译安装与调试(一),继续说说postgresql的编译安装与调试. 上一篇已经详细说明了如何在Linux系统上编译安装postgresql,这次我们在此基础上简单讲讲如何在 ...
- postgresql编译安装与调试(一)
因为最近组里的项目和postgresql有关,并且需要查看和调试源码,所以专门学习了一下如何安装和调试postgresql,此博文用来记录自己的安装和调试过程.安装环境是CentOS6(CentOS7 ...
- Linux环境PostgreSQL源码编译安装
Linux环境PostgreSQL源码编译安装 Linux版本: Red Hat 6.4 PostgreSQL版本: postgresql-9.3.2.tar.gz 数据存放目录: /var/post ...
- 在CentOS上编译安装PostgreSQL
http://my.oschina.net/tashi/blog 第一步:准备阶段 获取必需软件包: CentOS中查看是否安装了某个软件的命令:rpm -qa | grep 软件名.which命令可 ...
- ubuntu编译安装postgresql
闲着没事用源码编译安装了postgresql,遇到了不少故障,记录一下. 1:用./configure配置时发生错误.看信息说是缺少相关包.有什么readline,zlip等. 我配置的很简单,只是配 ...
- Redhat 7.2 编译安装PostgreSQL 10
1.环境说明 CentOS7.2 postgresql10.4 2.下载 postgresql的官方地址 https://www.postgresql.org/ftp/source/ 在下载列表中根据 ...
- CentOS7编译安装PostgreSQL
创建组和用户 groupadd postgres useradd -g postgres postgres passwd postgres 编译安装 yum install -y gcc gcc-c+ ...
- Mac OSX下编译安装PostgreSQL
原先使用的是官方提供的安装包,可是安装包会创建postgre这个用户.在登陆界面看的有点不爽,搜索了半天居然没有找到怎样在osx下编译安装的教程,并且假设是依照官方文档的编译安装办法一定会让你崩溃,本 ...
- postgreSQL在Centos6下编译安装
1.准备安装源 下载地址:https://www.postgresql.org/ftp/source/ 下载并解压. 2.软件编译安装 配置.检查安装环境 ./configure --prefix=/ ...
随机推荐
- 河南省多校联盟二-F 线段树+矩阵
---恢复内容开始--- 1284: SP教数学 时间限制: 2 秒 内存限制: 128 MB提交: 24 解决: 4 题目描述 输入 输出 对于每组数据的2操作,输出一行对1e9 + 7取模的答 ...
- 打开Eclipse提示“The default workspace “xxxx” is in use or cannot be created Please choose a different one“
原因:出现这种情况一般是workspace的配置文件中出现了.lock文件(workspace/.metadata/.lock),锁定了workspace.把.lock文件删除即可. 如果该文件不能删 ...
- edm 邮件制作指南
格式编码 1.页面宽度请设定在 600px 到 800px 以内,长度 1024px 以内. 2.html 编码请使用 utf-8. 3.html 代码在 15KB 以内.(各个邮箱的收件标准不一样, ...
- [转载]java获取word文档的条目化内容
在开发Web办公系统或文档系统时,PageOffice组件是众所周知的在线处理微软word/ppt/excel文档的强大工具,它对WORD文档的各种处理在API层面进行了封装,屏蔽了Office VB ...
- 004-对象——public protected private PHP封装的实例
<?php /** *public protected private PHP封装的实例 */ /*class tv { private $shengyin; function __constr ...
- 二十三、DBMS_METADATA(提供提取数据库对象的完整定义的接口)
1.概述 作用:提供提取数据库对象的完整定义的接口.这些定义可以用XML或SQL DDL格式描述.提供两种类型接口:可编程控制的接口:用于Ad Hoc查询的简单接口. 2.包的组成 dbms_meta ...
- Jquery validation自定义验证
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Spring整合Hibernate:2、使用Annotation方式进行声明式的事务管理
1.加入DataSourceTransactionManager的命名空间 修改applicationContext.xml文件,增加如下内容: 1 2 3 4 5 6 7 8 9 10 11 12 ...
- Redis数据结构:跳跃表
1. 跳跃表是有序集合(zset)的底层实现之一: 2. 由zskiplist和zskiplistNode组成: 3. 每个跳跃表节点的层数都是1-32之间的随机数(每创建一个节点的时候,程序会随机生 ...
- Linux(CentOS7)下发送邮件(使用Gmail作为发件服务器)
参考下述文章的思路,补充了在Gmail上的相关设置 https://gist.github.com/ilkereroglu/aa6c868153d1c5d57cd8 1.安装mailx yum ins ...