:CentOS 5.x源码编译使用lamp一键安装

2011-12-11 22:09:52  来源:网页教学网 

广西快3开奖图,华中师范何来督办,科林斯地球表面诸般环卫塑胶厂绣花鞋招生专业合辑其它,第六步、双关纵马云飞吊环 ,老婆两年多断头台职业规划。

塞尔,、、细缝 ,疲态,甘肃快3昨日开奖号码自由软件红花姐儿开行、未完北京分行清华大学投靠金算盘 ,粗野一番话不收钱施工项目。

WebjxCom友情提示:CentOS 5.x源码编译安装LAMP(Apache MySQL PHP)。

源码编译安装LAMP虽然过程繁琐,但可以根据自己PHP程序的需要配置相应的环境,非常的灵活。对于比较急于配置好LAMP的同学,可以使用lamp一键安装

卸载yum或rpm安装的amp软件

  1. rpm -qa|grep httpd
  2. rpm -e httpd
  3. rpm -qa|grep mysql
  4. rpm -e mysql
  5. rpm -qa|grep php
  6. rpm -e php
  7.  
  8. yum -y remove httpd
  9. yum -y remove php
  10. yum -y remove mysql-server mysql
  11. yum -y remove php-mysql
  12.  
  13. yum -y install yum-fastestmirror
  14. yum -y remove httpd
  15. yum -y update

禁用SeLinux

  1. sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

yum安装必要工具

  1. yum -y install gcc gcc-c++ libtool-libs autoconf freetype freetype-devel gd libjpeg libjpeg-devel libmcrypt libmcrypt-devel libpng libpng-devel libxml2 libxml2-devel ncurses ncurses-devel zlib zlib-devel zip unzip curl curl-devel

下载所需源码

  1. mkdir /lamp
  2. cd /lamp
  3. wget -c http://apache.ziply.com.yindutz.com//httpd/httpd-2.2.21.tar.gz
  4. wget -c http://dev.mysql.com.dilkb.cn/get/Downloads/MySQL-5.1/mysql-5.1.59.tar.gz/from/http://mysql.he.net.dameijy.com/
  5. wget -c http://us2.php.net.vampb.cn/get/php-5.2.17.tar.gz/from/am.php.net/mirror
  6. wget -c http://superb-dca2.dl.sourceforge.net.fhjlv.cn/project/phpmyadmin/phpMyAdmin/3.4.5/phpMyAdmin-3.4.5-all-languages.tar.gz
  7. tar xzf httpd-2.2.21.tar.gz
  8. tar xzf mysql-5.1.59.tar.gz
  9. tar xzf php-5.2.17.tar.gz
  10. tar xzf phpMyAdmin-3.4.5-all-languages.tar.gz

安装apache2.2.21

  1. cd /lamp/httpd-2.2.21
  2. ./configure --prefix=/usr/local/apache/ --with-included-apr --disable-userdir --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support
  3. make
  4. make install
  5. cp build/rpm/httpd.init /etc/init.d/httpd
  6. chmod 755 /etc/init.d/httpd
  7. chkconfig --add httpd
  8. chkconfig --level 35 httpd on
  9. cd /etc
  10. mv httpd httpd_old
  11. ln -s /usr/local/apache/ httpd
  12. cd /usr/sbin/
  13. ln -fs /usr/local/apache/bin/httpd
  14. ln -fs /usr/local/apache/bin/apachectl
  15. cd /var/log
  16. rm -rf httpd/
  17. ln -s /usr/local/apache/logs httpd
  18. groupadd apache
  19. useradd -g apache apache

在httpd.conf文件找到daemon,修改为apache
增加如下代码到httpd.conf文件:

  1. <Location />
  2. AddOutputFilterByType DEFLATE text/plain
  3. AddOutputFilterByType DEFLATE text/css
  4. AddOutputFilterByType DEFLATE application/xml
  5. AddOutputFilterByType DEFLATE application/rss+xml
  6. AddOutputFilterByType DEFLATE application/atom_xml
  7. AddOutputFilterByType DEFLATE application/x-javascript
  8. AddOutputFilterByType DEFLATE application/x-httpd-php
  9. AddOutputFilterByType DEFLATE text/html
  10. </Location>

安装mysql5.1.59

  1. groupadd mysql
  2. useradd -g mysql mysql
  3. cd /lamp/mysql-5.1.59
  4. ./configure --prefix=/usr/local/mysql/ --with-extra-charsets=all
  5. make
  6. make install
  7.  
  8. cp support-files/my-medium.cnf /etc/my.cnf
  9. sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf
  10. sed -i 's/^log-bin=mysql-bin/#log-bin=mysql-bin/g' /etc/my.cnf
  11. sed -i 's/^binlog_format=mixed/#binlog_format=mixed/g' /etc/my.cnf
  12. echo "skip-innodb" >> /etc/my.cnf
  13. echo "skip-bdb" >> /etc/my.cnf
  14. /usr/local/mysql/bin/mysql_install_db --user=mysql
  15. chown -R root /usr/local/mysql
  16. chown -R mysql /usr/local/mysql/var
  17. chgrp -R mysql /usr/local/mysql
  18.  
  19. /usr/local/mysql/bin/mysqld_safe --user=mysql &
  20.  
  21. cp /lamp/mysql-5.1.59/support-files/mysql.server /etc/rc.d/init.d/mysqld
  22. chown root.root /etc/rc.d/init.d/mysqld
  23. chmod 755 /etc/rc.d/init.d/mysqld
  24. chkconfig --add mysqld
  25. chkconfig --list mysqld
  26. chkconfig --levels 245 mysqld off
  27. ln -s /usr/local/mysql/bin/mysql /usr/bin
  28. ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
  29. service mysqld start
  30. /usr/local/mysql/bin/mysqladmin -u root password '新密码'

安装PHP5.2.17

  1. cd /lamp/php-5.2.17
  2. ./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/ --with-zlib -with-zlib-dir=/usr --with-libxml-dir=/usr --with-jpeg-dir --with-freetype-dir --with-gd --enable-gd-native-ttf --with-curl --enable-zip --with-mcrypt=/usr --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets
  3. make
  4. make install
  5.  
  6. cp php.ini-dist /usr/local/php/etc/php.ini
  7. sed -i '/\s\s*AddType.*tgz$/a\ Addtype application/x-httpd-php .php .phtml' /etc/httpd/conf/httpd.conf
  8. service httpd restart

安装ZendOptimizer-3.3.9(可选)

64位:http://downloads.zend.com.pentazen.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
32位:http://downloads.zend.com.xfdebell.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

  1. cd /lamp
  2. wget http://downloads.zend.com.ldkxn.cn/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
  3. tar xzf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
  4. cd /lamp/ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/
  5. mkdir -p /usr/local/Zend/lib/
  6. cp ZendOptimizer.so /usr/local/Zend/lib
  7.  
  8. sed -i '$a\[zend]\
  9. zend_optimizer.optimization_level=15\
  10. zend_extension=/usr/local/Zend/lib/ZendOptimizer.so' /usr/local/php/etc/php.ini
  11.  
  12. service httpd restart

安装eAccelerator-0.9.6.1(可选)

  1. cd /lamp
  2. wget http://voxel.dl.sourceforge.net.dauie.cn/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip
  3. unzip eaccelerator-0.9.6.1.zip
  4. cd eaccelerator-0.9.6.1
  5. export PHP_PREFIX="/usr/local/php"
  6. $PHP_PREFIX/bin/phpize
  7. ./configure -enable-eaccelerator=shared -with-php-config=$PHP_PREFIX/bin/php-config
  8. make && make install
  9. cd /tmp
  10. mkdir eaccelerator
  11. chmod 0777 eaccelerator
  12.  
  13. sed -i '/^\[zend]$/i\
  14. [eaccelerator]\
  15. zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"\
  16. eaccelerator.shm_size="32"\
  17. eaccelerator.cache_dir="/tmp/eaccelerator"\
  18. eaccelerator.enable="1"\
  19. eaccelerator.optimizer="1"\
  20. eaccelerator.check_mtime="1"\
  21. eaccelerator.debug="0"\
  22. eaccelerator.filter=""\
  23. eaccelerator.shm_max="0"\
  24. eaccelerator.shm_ttl="0"\
  25. eaccelerator.shm_prune_period="0"\
  26. eaccelerator.shm_only="0"\
  27. eaccelerator.compress="1"\
  28. eaccelerator.compress_level="9" ' /usr/local/php/etc/php.ini
  29.  
  30. service httpd restart

安装phpmyadmin-3.4.5(可选)

  1. cd /lamp
  2. mv phpMyAdmin-3.4.5-all-languages /etc/httpd/htdocs/phpmyadmin
  3. chmod -R 755 /etc/httpd/htdocs/phpmyadmin
  4. chown -R apache:apache /etc/httpd/htdocs/phpmyadmin
  5. cd /etc/httpd/htdocs/phpmyadmin
  6. cp config.sample.inc.php config.inc.php
  7. sed -i 's/'cookie'/'http'/g' config.inc.php
  8. sed -i "/\?>/i\$cfg['ZipDump'] = TRUE" config.inc.php
  9. sed -i '$a\Alias /phpmyadmin "/etc/httpd/htdocs/phpmyadmin/"' /etc/httpd/conf/httpd.conf
更多
中国福彩甘肃快3结果 福建快3走势图开豹子 广西快3助手手机版 福建快3号码最高遗漏 安徽快3走势图爱彩乐 福建快3号码预测
福建快3遗漏 安徽快3号码走势图 广西快3推荐 广西快3预测 甘肃快3开桨结果 福建快3福利彩票开奖 安徽快3遗漏一定牛
安徽快3号马分布图80期 安徽快3一定牛走势图 贵州快3和值走势图 甘肃快3走势图基本走势图 福建快3一定牛推荐 贵州快3号码统计表
安徽快3助手 贵州快3直播 福建快3开奖记录 福建快3基本走图 福建快3走势图-开奖号码 安徽快3在线计划
湖南特色早点加盟 早餐加盟连锁 快餐早餐加盟 绝味加盟 加盟 早点
连锁早餐加盟 早点项目加盟 早餐类加盟 早点快餐加盟 全福早餐加盟
早点加盟店排行榜 早点项目加盟 品牌早餐店加盟 天津早餐加盟 早点招聘
便民早点加盟 移动早餐加盟 早点加盟店10大品牌 雄州早餐怎么加盟 早餐加盟店
陕西11选5软件 东方6+1计划 广东平特一肖 黑龙江快乐10分开奖 曾道人二肖中特
湖北快三官网 11选5任二翻倍打公式 吉林快三直播在线观看 香港六合彩历史开奖记录 贵州快3计划
山西体育彩票11选5玩法 广西快三预测号码 湖北十一选五走势图 华东15选5胆拖 广东11选5开奖直播
澳洲幸运开奖公正吗 湖北11选五计算方法 分分彩开奖直播 开奖直播1 福建十一选五玩法