1. PostgreSQL安裝

1.依賴包安裝

yum groupinstall "Development tools"   ##開發(fā)包
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.創(chuàng)建用戶、目錄

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 數(shù)據(jù)庫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.修改環(huán)境變量

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.初始數(shù)據(jù)庫

initdb -D $PGDATA -E utf8 --wal-segsize=8
pg_ctl start
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容