centos环境+pgsql+postgis+apache+php等插件的安装

1、centos系统的安装

http://www.linuxidc.com/Linux/2014-02/97389.htm

 

只作为服务器的话,选Minimal

 

2、pgsql的安装

http://my.oschina.net/tashi/blog/189351

 

3、postgis的安装

安装geos时出现“line 990: g++: command not found”错误

解决方法:

[root@cqs geos-3.4.2]# yum -y groupinstall ‘Development Tools’

安装postgis时先安装

gdal-1.11.2geos-3.4.2ibxml2-2.9.2proj-4.9.1json-c-0.12

 

最后安装postgis时,先进行配置

[root@cqs postgis-2.1.6]# ./configure –prefix=/usr/local/postgis-2.1.6 –with-pgconfig=/usr/local/postgresql-9.5/bin/pg_config  –with-gdalconfig=/usr/local/gdal-1.11.2/bin/gdal-config  –with-geosconfig=/usr/local/geos-3.4.2/bin/geos-config
–with-xml2config=/usr/local/libxml2-2.9.2/bin/xml2-config –with-projdir=/usr/local/proj-4.9.1/ –with-jsondir=/usr/local/json-c-0.12/

 

 

 

4、配置运行环境变量管理上更方便

[root@testbin]# vim /etc/profile

PGDATA=/home/postgres/data

PGHOST=127.0.0.1

PGDATABASE=postgres

PGUSER=postgres

PGPORT=5432

PATH=/usr/local/pgsql/bin:$PATH

export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL

export PGDATA PGHOST PGDATABASE PGUSER PGPORT

环境变量生效

[root@testbin]# cd  /etc/

[root@testbin]#source profile

配置密码文件用于管理员无密码连接使用

[root@test ld.so.conf.d]# cd /home/postgres/

[root@test postgres]# cat .pgpass

127.0.0.1:5432:*:postgres:000

WARNING: password file “/home/postgres/.pgpass” has group or world access; permissions should be u=rw (0600) or less

解决方案:

[root@cqs postgres]# ls -la .pgpass

-rw-r–r–. 1 root root 30 9月  15 19:00 .pgpass

[root@cqs postgres]# chmod 600 .pgpass

[root@cqs postgres]# ls -la .pgpass   

-rw——-. 1 root root 30 9月  15 19:00 .pgpass

[root@cqs postgres]#

 

问题:

[postgres@cqs data]$ psql -h 127.0.0.1 -U pgb_user -d read_db -p 5433

psql: ERROR:  pgbouncer cannot connect to server

解决方案:

[postgres@cqs data]$ vim postgresql.conf

listen_addresses = ‘*’

[postgres@cqs data]$ vim pg_hba.conf

# IPv4 local connections:

host    all             all             127.0.0.1/32            trust

host    all             all              0.0.0.0/0              md5

[postgres@cqs local]$ cd /home/postgres/data/

[postgres@cqs data]$ pg_ctl restart -D ./

[postgres@cqs pgbouncer]$ /usr/local/pgbouncer-1.5.4/bin/pgbouncer  -R -d /home/postgres/pgbouncer/pgbouncer.ini

 

5、apachephp的安装

(1)apache的安装

    cd /home/cqs/source/

tar xf httpd-2.3.16-beta.tar.bz2

cd httpd-2.3.16-beta

./configure –prefix=/usr/local/httpd –enable-so

报错:解决方案
http://cuisuqiang.iteye.com/blog/2068794

安装对应的wget查找命令yum install wget -y

安装apr :

wget
http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz

cd /home/cqs/source/

tar -zxf apr-1.4.5.tar.gz

cd apr-1.4.5

./configure –prefix=/usr/local/apr

make

make install

安装apr-utilpcre-8.10.zip

wget
http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz

wget
http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

tar -zxf apr-util-1.3.12.tar.gz

cd apr-util-1.3.12

./configure –prefix=/usr/local/apr-util -with-apr=/usr/local/apr/bin/apr-1-config

make

make install

cd ..

cd httpd-2.3.16-beta

./configure –prefix=/usr/local/httpd –enable-so –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util/ –with-pcre=/usr/local/pcre

make

make install

/usr/local/httpd/bin/apachectl start —启动apache服务

/usr/local/httpd/bin/apachectl restart —重启apache服务

/usr/local/httpd/bin/apachectl stop —停止apache服务

(2)freetype的安装

cd /home/cqs/source/

tar xf freetype-2.4.0.tar.bz2

cd freetype-2.4.0

cd builds/unix/

./configure –prefix=/usr/local/freetype –enable-shared

make

make install

(3)freetds的安装

cd /home/cqs/source/

tar -zxvf freetds-current.tar.gz

cd freetds-dev.0.99.523/

    ./configure –prefix=/usr/local/freetds

gmake

gmake install

(4)php的安装

cd /home/cqs/source/

tar xf php-7.0.1.tar.bz2

cd php-7.0.1

yum install libxml2

yum install libxml2-devel

yum install libpng-devel

 ./configure –prefix=/usr/local/php -with-pgsql=/usr/local/postgresql-9.5 –with-gd –enable-gd-native-ttf –with-freetype-dir=/usr/local/freetype –with-zlib

gmake

gmake install

安装完毕后,跟apache通讯时发现少了libphp7.so文件,解决方案是编译时加上–with-apxs2=/usr/local/apache/bin/apxs

所以编译时要的语句是

./configure –prefix=/usr/local/php -with-pgsql=/usr/local/postgresql-9.5 –with-gd –enable-gd-native-ttf –with-freetype-dir=/usr/local/freetype –with-zlib –with-apxs2=/usr/local/apache/bin/apxs

转载自:https://blog.csdn.net/qiufengwuqing123/article/details/53706197

You may also like...