美文网首页
1. PostgreSQL安装

1. PostgreSQL安装

作者: 善良的良 | 来源:发表于2019-05-04 18:10 被阅读0次

1.依赖包安装

yum groupinstall "Development tools"   ##开发包
yum install -y bison ##语法分析器
yum install -y flex ##词法分析器
yum install -y readline-devel ##psql客户端的命令历史
yum install -y zlib-devel  ##pg_dump/pg_restore的压缩功能支持

yum install docbook-dtds
yum install docbook-style-dsssl
yum install docbook-style-xsl
yum install libxslt
yum install bxslt-devel

2.创建用户、目录

useradd postgres
echo postgres | passwd --stdin postgres
mkdir -p /u07
mkdir -p /u07/pgsql
mkdir -p /u07/pg_data
chown -R postgres:postgres /u07
chmod -R 755 /u07

3.编译安装

./configure --prefix=/u07/pgsql \
--enable-cassert \
--enable-debug \
--enable-depend CFLAGS=-O0

make world&& make install-world

编译选项
重要
--prefix= PREFIX 安装路径
--with-blocksize=BLOCKSIZE 数据库blocksize ,缺省8KB
--with-segsize=SEGSIZE 表文件的段尺寸,缺省1GB
-with-llvm 使用基于JIT的lIvm编译
存储过程语言支持
--with-tcl
--with-tclconfig = DIR
--with-perl
--with-python
安全选项
--with-gssapi
--with-krb-srvnam = NAME
--with-pam
--with-bsd-auth
--with-ldap
---with-bonjour
--with-openssl
--with-selinux
其他
--enable-debug

4.修改环境变量

vi  ~/.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 PGDATA=/u07/pg_data
export PGHOME=/u07/pgsql
export PGDATABASE=postgres
export PGPORT=5432
export LD_LIBRARY_PATH=$PGHOME/lib
export PATH=$PGHOME/bin:$PATH

source .bash_profile

5.初始数据库

initdb -D $PGDATA -E utf8 --wal-segsize=8
pg_ctl start

相关文章

网友评论

      本文标题:1. PostgreSQL安装

      本文链接:https://www.haomeiwen.com/subject/jqifrqtx.html