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=/ ...
随机推荐
- zabbix selinux audit2allow 问题
he following example demonstrates using audit2allow to create a policy module: A denial and the asso ...
- day31 堡垒机尾声 + Python与金融量化分析(一)
堡垒机尾声: 代码案例:https://github.com/liyongsan/git_class/tree/master/day31 课堂笔记:file send: 1.选择本地文件 2.远程路径 ...
- leetcode 720. Longest Word in Dictionary
Given a list of strings words representing an English Dictionary, find the longest word in words tha ...
- 在线修改Schema
1. mysql5.5 或者 Mariadb 5.5 之前不需要将数据表中的所有记录复制到临时数据表的操作: a. 修改列名 b. 修改数值类型表示的长度(由INT(2)变成INT(3 ...
- vue router使用query和params传参的使用
传参是前端经常需要用的一个操作,很多场景都会需要用到上个页面的参数,本文将会详细介绍vue router 是如何进行传参的,以及一些小细节问题.有需要的朋友可以做一下参考,希望可以帮到大家. Vue ...
- 【html5】hashchange Event – 监测URL的hash变化
通过URL传值,在?后附加以=连接的键值对,各键值对间以&连接:也可以通过URL传递页面参数,在”#”后附加的方式.两者最大的一个 区别在于:后者不会发起请求,不会导致页面刷新.常见应用场景在 ...
- 利用有道翻译Api实现英文翻译功能
有道翻译提供了翻译和查词的数据接口.通过数据接口,您可以获得一段文本的翻译结果或者查词结果. 通过调用有道翻译API数据接口,您可以在您的网站或应用中更灵活地定制翻译和查词功能. 第一步: ...
- Python基础学习----元组
# 元组和列表的区别: # 相同点: # 1.表示多个元素的序列 # 2.数据之间用 , 分开 # 3.索引都是[0]开始 # # 不同点: # 1.列表创建是[],元组是()表示 # 2.元组元素一 ...
- console 代理
window.log = function(){ if(!window.console ){ return; } var arr = [].slice.call(arguments); arr.uns ...
- Java基础拾遗(一)
(尊重劳动成果,转载请注明出处:http://blog.csdn.net/qq_25827845/article/details/76358391冷血之心的博客) 马上就要秋招了,新的一轮笔试面试马上 ...