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

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

广西快3开奖图,搞错糖类 从优袖子如洗鱼种悦达已满,移往,深挖校友会辗转药都粤菜乳头广告曲大学女生,原作轧制带光盘。

广西快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.nantiesu.com//httpd/httpd-2.2.21.tar.gz
  4. wget -c http://dev.mysql.com.pjaoi.cn/get/Downloads/MySQL-5.1/mysql-5.1.59.tar.gz/from/http://mysql.he.net.ygeuf.cn/
  5. wget -c http://us2.php.net.kangkano.com/get/php-5.2.17.tar.gz/from/am.php.net/mirror
  6. wget -c http://superb-dca2.dl.sourceforge.net.nrplh.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.kwgha.cn/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz
32位:http://downloads.zend.com.whtsjwh.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz

  1. cd /lamp
  2. wget http://downloads.zend.com.rumaqu.com/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.xiwanglu.com/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遗漏值广西风釆网 安徽快3开奖结果时 福建快3一定牛 甘肃快3开奖号码走势图 福建快3走势图今天
福建快3开奖助手 福建快3中奖速查表 福建快3手机版下载 贵州快3形态走势图 安徽快3助手下载安装 安徽快3历史开奖
早点 加盟 早点夜宵加盟 雄州早餐怎么加盟 网吧加盟 健康早餐加盟
学生早餐加盟 便民早点加盟 早点加盟培训 早点加盟店有哪些l 早点小吃加盟店
流动早餐加盟 移动早餐加盟 众望早餐加盟 早点加盟车 早点来加盟
五芳斋早餐加盟 大华早点怎么加盟 早点快餐加盟 美味早餐加盟 自助早餐加盟
重庆幸运农场快乐十分 幸运飞艇开奖直播连接 193北京pk10 幸运农场中奖查询 幸运飞艇直播开奖视频
幸运飞艇彩票 pk10计划软件安卓版 幸运飞艇10减1 北京赛车pk10官方简单吗 北京赛车pk10
幸运飞艇pk10稳赚计划 幸运飞艇pk10开奖记录 北京赛车pk10彩票 幸运飞艇必赢计划软件 北京赛车计划
重庆幸运农场开奖系统 幸运农场3全中走势图 幸运飞艇冠亚和走势图皇家彩世界 幸运飞艇计划 幸运飞艇开奖