version:Postgresql 9.5.2
OS: CentOS 6.5
Source Code: Postgresql9.5.2
建议先 运行 yum list installed mysql* 命令 查看安装了哪些mysql
卸载 yum remove mysql5.6(比如)
同样 把 早期的 postgresql 版本卸载掉
rpm -qa |grep postgre
yum -y remove postgresql-libs-8.4.18-1.el6_4.x86_64
安装 postgresql 需要 mysql5.1版本(yum groupinstall "Additional Development" "Additional Development" 会自动安装并配置)
1、
yum groupinstall "Additional Development" "Additional Development"
cd /tmp/
tar xf postgresql-9.5.2.tar.bz2
cd postgresql-9.5.2
./configure --prefix=/usr/local/postgresql
/如果确实gcc组件则 安装gcc组件包
yum install gcc
/
make
make install
adduser postgres
mkdir /usr/local/postgresql/data
chown postgres /usr/local/postgresql/data/
cd /usr/local/postgresql/
chmod 0700 data
2、
su - postgres
3、
/usr/local/postgresql/bin/initdb -D /usr/local/postgresql/data/
/usr/local/postgresql/bin/postgres -D /usr/local/postgresql/data/ >logfile 2>&1 &
/usr/local/postgresql/bin/createdb test
/usr/local/postgresql/bin/psql test
4、
iptables -I INPUT -p tcp --dport 5432 -j ACCEPT
echo 'PATH=$PATH:/usr/local/postgresql/bin' >> /etc/profile
echo 'PGDATA=/usr/local/postgresql/data' >> /etc/profile
source /etc/profile