2017年05月31日

PostgreSQL10-beta ソースからコンパイルしてインストールする CentOS6.9 (成功)

CentOS 6.9 (64bit)

1. Firewall 5432 port をopen

vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
/etc/init.d/iptables restart


2.
yum -y install gcc
yum -y install readline
yum -y install readline-devel
yum -y install zlib
yum -y install zlib-devel

3.
useradd postgres
passwd postgres


4.
chown -R postgres:postgres /home/postgres
chmod -R 700 /home/postgres
ls -ld  /home/postgres


5.

6.
ls
tar zxvf postgresql-10beta1.tar.gz
ls -d postgresql-10beta1

7.
mkdir /opt/postgresql10b1

8.
cd /usr/local/src/postgresql-10beta1
./configure --prefix=/opt/postgresql10b1


9.
make

10.
make install

11.
ls -l /opt/postgresql10b1

12.
chown -R postgres:postgres /opt/postgresql10b1
ls -l /opt/postgresql10b1

13.
vi /home/postgres/.bash_profile


15.
# .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
-------------------------------------------------------------------------------追記
POSTGRES_HOME=/opt/postgresql10b1

PGBIN=$POSTGRES_HOME/bin

PGLIB=$POSTGRES_HOME/lib

PGDATA==$POSTGRES_HOME/data

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PGLIB

PGPATH=$PATH:$HOME/bin:$PGBIN

export PATH

export PGDATA

export LD_LIBRARY_PATH

export POSTGRES_HOME=/opt/postgresql10b1
export PGBIN=$POSTGRES_HOME/bin
export PGLIB=$POSTGRES_HOME/lib
export PGDATA=$POSTGRES_HOME/data
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PGLIB
export PATH=$PGBIN:.:$PATHH
-------------------------------------------------------------------------------追記END


起動スクリプト


展開したPostgreSQLソース内にcontribディレクトリがあります。
contribディレクトリ内のstart-scriptsにlinuxというファイルが起動スクリプトの雛型になります。
このファイルをrootユーザで/etc/rc.d/init.d/にpostgresとファイル名を変更してコピーします。
インストール先は/opt/postgresql10b1なのでprefixに/opt/postgresql10b1を指定します。

chmod 755 /etc/init.d/postgres

chkconfig --add postgres
chkconfig --list | grep postgres
chkconfig postgres on


su - postgres
env | grep PGDATA
initdb --encoding=UTF8 --no-locale
initdb --encoding=UTF8 --locale=C



service postgres start

[root@localhost ~]# su - postgres
[postgres@localhost ~]$ psql

posted by a23 at 16:31| Comment(0) | PostgreSQL
この記事へのコメント
コメントを書く
お名前: [必須入力]

メールアドレス: [必須入力]

ホームページアドレス: [必須入力]

コメント: [必須入力]

認証コード: [必須入力]


※画像の中の文字を半角で入力してください。