Linux上全源码安装Apache、MySQL、PH

Linux上全源码安装Apache、MySQL、PHP、WSF安装(原创)

需要root权限

  1. Apache安装

    下载

    #wgethttp://apache.mirror.phpchina.com/httpd/httpd-2.2.6.tar.gz

    安装

#tarzxvfhttpd-2.2.6.tar.gz

#cdhttpd-2.2.6

#./configure--prefix=/usr/local/apache2--enable-so

#make

#makeinstall

#makeclean系统启动时自动加载Apache

#cp/usr/local/apache2/bin/apachectl/etc/rc.d/init.d/httpd

#cd/etc/rc.d/rc3.d

#ln–s../init.d/httpdS80httpdMySQL安装下载

#wgethttp://mysql.ntu.edu.tw/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz安装

#tarzxvfmysql-5.0.45.tar.gz

#cdmysql-5.0.45

#./configure--prefix=/usr/local/mysql--enable-thread-safe-client--with-charset=utf8

#make

#makeinstall

#cpsupport-files/my-medium.cnf/etc/my.cnf

#makeclean创建mysql用户

#groupaddmysql

#useradd-gmysqlmysql设置目录访问权限

#cd/usr/local/mysql

#chown-Rmysql.

#chgrp-Rmysql.#bin/mysql_install_db--user=mysql(初始化表)

#chown-Rroot.

#chown-Rmysqlvar运行

#/usr/local/mysql/bin/mysqld_safe--user=mysqlLibXML2安装(Linux默认已经存在)下载

#wgetftp://xmlsoft.org/libxml2/libxml2-2.6.30.tar.gz安装

#tarzxvflibxml2-2.6.30.tar.gz

#cdlibxml2-2.6.30

#./configure--prefix=/usr/local/libxml2--exec-prefix=/usr

#make

#makeinstall

#makecleanZlib安装

下载

#wgethttp://www.zlib.net/zlib-1.2.3.tar.gz安装

#tarzxvfzlib-1.2.3.tar.gz

#cdzlib-1.2.3

#./configure--prefix=/usr/local/zlib--exec-prefix=/usr

#make

#makeinstall

#makecleanLibIconv安装

下载

#wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.12.tar.gz安装

#tarzxvflibiconv-1.12.tar.gz

#cdlibiconv-1.12

#./configure--prefix=/usr/local/libiconv

#make

#makeinstall

#makecleanPHP安装下载

#wgethttp://cn2.php.net/distributions/php-5.2.5.tar.gz安装

#tarzxvfphp-5.2.5.tar.gz

#cdphp-5.2.5

#./configure--prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs--with-mysql=/usr/local/mysql--with-zlib--with-iconv=/usr/local/libiconv--with-config-file-path=/home/admin/aep/forum/conf

#make

#makeinstall

#makeclean#cpphp.ini-dist/home/admin/aep/forum/conf/php.ini#vi/home/admin/aep/forum/conf/httpd.conf

任意位置添加如下内容

AddTypeapplication/x-httpd-php.php

AddTypeapplication/x-httpd-php-source.phpspkg-config安装(如果低于0.20版本)

下载

#wgethttp://pkgconfig.freedesktop.org/releases/pkg-config-0.22.tar.gz安装

#tarzxvfpkg-config-0.22.tar.gz

#cdpkg-config-0.22

#./configure--prefix=/usr

#make

#makeinstall

#makecleanSQLite安装

下载

#wgethttp://www.sqlite.org/sqlite-3.5.3.tar.gz安装

#tarzxvfsqlite-3.5.3.tar.gz

#cdsqlite-3.5.3

#./configure--prefix=/usr--disable-tcl

#make

#makeinstall

#makecleanOpenSSL安装(可选)下载

#wgethttp://www.openssl.org/source/openssl-0.9.8b.tar.gz安装

#tarzxvfopenssl-0.9.8b.tar.gz

#cdopenssl-0.9.8b

#./config--prefix=/usr/--openssldir=/usr/local/openssl

#make

#makeinstall

# make cleanWSF安装
  • 安装

    #tarzxvfwso2-wsf-php-src-1.1.0.tar.gz

    #cdwso2-wsf-php-src-1.1.0

    #./configure--with-apache2=/usr/local/apache2/include--with-wsf--enable-savan=no--with-php-config=/usr/local/php/bin/php-config

    #make

    #makeinstall

    # make clean
  • 默认情况下,WSF被安装在/wsf_c,wsf.so被编译到/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
  • # vi /home/admin/aep/forum/conf/php.ini找到extension_dir = "./",改为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"
  • 在php.ini任意位置添加

    [wsf]

    wsf.home=/wsf_c

    wsf.log_path=/wsf_c/logs

    wsf.log_level=3

    wsf.rm_db_dir=/wsf_c

    extension=wsf.so
  • 测试

    重启Apache

    #/usr/local/php/bin/php-m

    看wsf模块是否在列表中
PHP ws-security代码样例(WS安全带签名)
Python代码  Linux上全源码安装Apache、MySQL、PH
  1. <span style="font-size: x-small;"><span style="font-size: small;">$reqPayloadString =<<<XML  
  2. <xsd:getAppByAppId   
  3. xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"   
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
  5. xmlns:xs="http://www.w3.org/2001/XMLSchema"  
  6. xmlns:xsd="http://subsc.api.core.aep.alisoft.com">  
  7. <xsd:param0>$appid</xsd:param0>  
  8. </xsd:getAppByAppId>  
  9. XML;  
  10. $my_cert = ws_get_cert_from_file("./keys/aepforum_cert.cert");  
  11. $my_key = ws_get_key_from_file("./keys/aepforum_key.pem");  
  12. $rec_cert = ws_get_cert_from_file("./keys/aep_cert.cert");  
  13.   
  14. $reqMessage = new WSMessage($reqPayloadString, array (  
  15. "to" => "http://api.alisoft.com:1688/webservice/AppWebService",  
  16. "action" => "http://subsc.api.core.aep.alisoft.com/getAppByAppId"  
  17. ));  
  18.   
  19. $sec_array = array (  
  20. "sign" => TRUE,  
  21. "securityTokenReference" => "IssuerSerial",  
  22. "algorithmSuite" => "Basic256Rsa15"  
  23. );  
  24. $policy = new WSPolicy(array (  
  25. "security" => $sec_array  
  26. ));  
  27.   
  28. $sec_token = new WSSecurityToken(array (  
  29. "privateKey" => $my_key,  
  30. "certificate" => $my_cert,  
  31. "receiverCertificate" => $rec_cert  
  32. ));  
  33.   
  34. $client = new WSClient(array (  
  35. "useWSA" => TRUE,  
  36. "policy" => $policy,  
  37. "securityToken" => $sec_token  
  38. ));  
  39.   
  40. $resMessage = $client->request($reqMessage);  
  41.   
  42. $xml = new SimpleXMLElement($resMessage->str);  
  43. $name = $xml->return[0]->appName;  
  44. $username = $xml->return[0]->isvPassPort;  
  45. $description = $xml->return[0]->description;</span></span>  
转自:http://aaronjiu.iteye.com/blog/164860

相关推荐