公司的一个部门要搭建linux下的单点登录“客户端”环境:
Linux下的web环境配置,(为实现sso单点登录crm系统的测试环境搭建)要求整合apache2.0与php5.2+(同时apache和php都要openssl,php还要支持curl)(下面的gd开发包可以不安装)实现过程如下:
1.安装zlib-1.2.3
#tar zxvf zlib-1.2.3.tar.gz
#cd zlib-1.2.3
#CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib/ //前面一串命令在64为系统上面需要执行否在在后面编译php时会报错,
#make
#make install
#make clean
2.安装openssl-0.9.8d
#tar zxvf openssl-0.9.8d.tar.gz
#cd openssl-0.9.8d
#./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl shared zlib
#make
#make test
#make install
3.安装httpd-2.0.64.tar.gz
#tar zxvf httpd-2.0.64.tar.gz
#cd httpd-2.0.64
#./configure --prefix=/usr/local/apache --enable-so --enable-ssl --with-ssl=/usr/local/openssl --enable-rewrite
#make
#make install
(我没做这一步#echo "/usr/local/apache/bin/apachectl start" >> /etc/rc.d/rc.local)
4.安装libpng-1.2.14
#tar zxvf libpng-1.2.47.tar.gz
#cd libpng-1.2.47
#cp scripts/makefile.linux makefile
#make //如果提示找不到zlib库文件或者头文件,多半是makefile文件里的zlib的默认路径有误。可编辑makefile文件,找到zlib项并重新指定路径到/usr/local/zlib/lib和/usr/local/zlib/include).
#make install
5.安装freetype-2.1.10
#tar -zvxf freetype-2.1.10.tar.gz
#cd freetype-2.1.10
#mkdir -pv /usr/local/freetype
#./configure --prefix=/usr/local/freetype
#make && make install
6.安装jpegsrc.v6b
Jpeg默认不会自动创建目录,手动创建
#mkdir -p /usr/local/jpeg6
#mkdir -p /usr/local/jpeg6/bin
#mkdir -p /usr/local/jpeg6/lib
#mkdir -p /usr/local/jpeg6/include
#mkdir -p /usr/local/jpeg6/man
#mkdir -p /usr/local/jpeg6/man1
#mkdir -p /usr/local/jpeg6/man/man1
安装:
#tar zxvf jpegsrc.v6b.tar.gz
#cd ./jpeg-6b/
#./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
#make (这步可能报错,根据报错看看是否执行如下操作报错执行#cp /usr/share/libtool/config.guess ./config.guess #cp /usr/share/libtool/config.sub ./config.sub执行后再make )
#make install
#make install-lib
7.安装libxml2-2.6.19
#tar -jxvf ./libxml2-2.6.23.tar.bz2
#cd libxml2-2.6.23
# mkdir -pv /usr/local/libxml2
#./configure --prefix=/usr/local/libxml2
#make
#make install
#cp xml2-config /usr/bin
8.安装GD-2.0.33库
#tar -zxvf gd-2.0.33.tar.gz
#mkdir -pv /usr/local/gd2
#cd gd-2.0.33
#./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/zlib/ --with-freetype=/usr/local/freetype/ --with-openssl=/usr/local/openssl/ --with-curl=/usr/local/curl/
#make
#make install
9.安装php-5.2.1
#./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg6/ --with-png=/usr/local/lib/ --with-zlib=/usr/local/zlib/ --with-freetype=/usr/local/freetype/ --with-openssl=/usr/local/openssl/ --with-curl=/usr/local/curl/
(如果configure错误看到无法找到openssl的库执行如下操作#echo /usr/local/openssl/lib >> /etc/ld.so.conf #ldconfig)
#make (这里可能提示zlib的32的错误,上面如果在64位系统编译zlib时加上了前面一段#CFLAGS="-O3 -fPIC" ./configure --prefix=/usr/local/zlib/才会成功)
#make install
#cp php.ini-dist /usr/local/php/lib/php.ini
10.编辑apache配置文件httpd.conf
#vi /usr/local/apache/conf/httpd.cong
修改如下几处:
找到LoadModule php5_module modules/libphp5.so
前面的#号去掉(默认已经去掉)
#AddType application/x-gzip.gz.tgz
下面加二行
AddType application/x-httpd-php .php
AddType application/x-httpd-phpsource .phps
找到DirectoryIndex index.html
加上index.php让它把index.php作为默认页
11.测试PHP
#vi /usr/localapache/htdocs/index.php
添加:
<?
Phpinfo()
?>
12.启动apache服务
#/usr/local/apache/bin/apachectl start
浏览器测试一下IP
13.ssl的启用没有做,开发要求的不是很明确,
转载于:https://blog.51cto.com/hhwong/881758