老谢博客

  • 首页
  • WordPress
  • 网络技术
  • 乱七八糟
  • 运维技术
  • 给我留言
  • 关于老谢

Apache 2.2.21 + MySQL 5.1.59 + PHP 5.2.17在CentOS5下编译安装

分类:linux日期:2013-10-02 - 13:05:55作者:老谢

应某客户要求安装纯编译的LAMP环境,这里记录下所有命令,由于比较忙,没时间像以前那样整理详细说明发布了,非常抱歉

程序准备

mkdir lamp && cd lamp
wget https://lnamp-web-server.googlecode.com/files/php-5.2.17.tar.gz
wget https://lnamp-web-server.googlecode.com/files/mysql-5.1.59.tar.gz
wget https://lnamp-web-server.googlecode.com/files/httpd-2.2.21.tar.gz
wget https://autosetup1.googlecode.com/files/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
tar -zxf httpd-2.2.21.tar.gz
tar -zxf mysql-5.1.59.tar.gz
tar -zxf php-5.2.17.tar.gz
tar -zxf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz

mkdir lamp && cd lamp wget https://lnamp-web-server.googlecode.com/files/php-5.2.17.tar.gz wget https://lnamp-web-server.googlecode.com/files/mysql-5.1.59.tar.gz wget https://lnamp-web-server.googlecode.com/files/httpd-2.2.21.tar.gz wget https://autosetup1.googlecode.com/files/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz tar -zxf httpd-2.2.21.tar.gz tar -zxf mysql-5.1.59.tar.gz tar -zxf php-5.2.17.tar.gz tar -zxf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz

编译MySQL

cd mysql-5.1.59
groupadd mysql
useradd -r -g mysql mysql
./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data \
--enable-thread-safe-client --enable-assembler --enable-local-infile \
--with-charset=utf8 --with-collation=utf8_general_ci \
--with-extra-charsets=all --with-big-tables --with-readline --with-ssl \
--with-embedded-server
make && make install
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
bin/mysql_install_db --user=mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin
cd ~/lamp/mysql-5.1.59
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 0755 /etc/init.d/mysqld
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/lib/mysql /usr/bin/mysql
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump
ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
chkconfig --add mysqld
service mysqld start
 
/usr/local/mysql/bin/mysqladmin -u root password "new-password"
mysql -u root -p
mysql > use mysql;
mysql > delete from user where password="";
mysql>drop database test;
mysql>flush privileges;
mysql>quit;

cd mysql-5.1.59 groupadd mysql useradd -r -g mysql mysql ./configure --prefix=/usr/local/mysql --localstatedir=/usr/local/mysql/data \ --enable-thread-safe-client --enable-assembler --enable-local-infile \ --with-charset=utf8 --with-collation=utf8_general_ci \ --with-extra-charsets=all --with-big-tables --with-readline --with-ssl \ --with-embedded-server make && make install cd /usr/local/mysql chown -R mysql . chgrp -R mysql . bin/mysql_install_db --user=mysql ln -s /usr/local/mysql/bin/mysql /usr/bin cd ~/lamp/mysql-5.1.59 cp support-files/my-medium.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqld chmod 0755 /etc/init.d/mysqld ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql ln -s /usr/local/mysql/lib/mysql /usr/bin/mysql ln -s /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump ln -s /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk ln -s /usr/local/mysql/include/mysql /usr/include/mysql chkconfig --add mysqld service mysqld start /usr/local/mysql/bin/mysqladmin -u root password "new-password" mysql -u root -p mysql > use mysql; mysql > delete from user where password=""; mysql>drop database test; mysql>flush privileges; mysql>quit;

编译Apache

cd ~/lamp/httpd-2.2.21
./configure --prefix=/usr/local/apache --enable-so --enable-cache \
--enable-disk-cache --enable-file-cache --enable-mem-cache \
--enable-deflate --enable-headers --enable-mime-magic \
--enable-proxy --enable-rewrite --enable-ssl \
--enable-mods-shared=all --enable-expires
make && make install

cd ~/lamp/httpd-2.2.21 ./configure --prefix=/usr/local/apache --enable-so --enable-cache \ --enable-disk-cache --enable-file-cache --enable-mem-cache \ --enable-deflate --enable-headers --enable-mime-magic \ --enable-proxy --enable-rewrite --enable-ssl \ --enable-mods-shared=all --enable-expires make && make install

vi /usr/local/apache/conf/httpd.conf 找到User和Gruop,把daemon改成www,取消ServerName的注释,改成127.0.0.1:80 vi /usr/local/apache/bin/apachectl 添加 # chkconfig:345 85 15 # description:httpd

groupadd www
useradd -M -g www -s /sbin/nologin www
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
chkconfig --add httpd
chkconfig --level 345 httpd on
service httpd start

groupadd www useradd -M -g www -s /sbin/nologin www cp /usr/local/apache/bin/apachectl /etc/init.d/httpd chkconfig --add httpd chkconfig --level 345 httpd on service httpd start

编译PHP

cd ~/lamp/php-5.2.17
./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-mysqli=/usr/local/mysql/bin/mysql_config \
--with-pdo-mysql=/usr/local/mysql \
--with-curl \
--with-pear \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--with-freetype-dir \
--with-mcrypt \
--with-mhash \
--with-openssl \
--with-xmlrpc \
--with-bz2 \
--with-gettext \
--with-mime-magic \
--disable-debug \
--enable-exif \
--enable-wddx \
--enable-zip \
--enable-bcmath \
--enable-calendar \
--enable-ftp \
--enable-mbstring \
--enable-soap \
--enable-sockets \
--enable-sqlite-utf8 \
--enable-shmop \
--enable-dba \
--enable-magic-quotes
make && make install

cd ~/lamp/php-5.2.17 ./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-mysqli=/usr/local/mysql/bin/mysql_config \ --with-pdo-mysql=/usr/local/mysql \ --with-curl \ --with-pear \ --with-gd \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir \ --with-freetype-dir \ --with-mcrypt \ --with-mhash \ --with-openssl \ --with-xmlrpc \ --with-bz2 \ --with-gettext \ --with-mime-magic \ --disable-debug \ --enable-exif \ --enable-wddx \ --enable-zip \ --enable-bcmath \ --enable-calendar \ --enable-ftp \ --enable-mbstring \ --enable-soap \ --enable-sockets \ --enable-sqlite-utf8 \ --enable-shmop \ --enable-dba \ --enable-magic-quotes make && make install

编辑/usr/local/apache/conf/httpd.conf,添加以下配置

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

<FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch>

找到

<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

<IfModule dir_module> DirectoryIndex index.html </IfModule>

修改为

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

<IfModule dir_module> DirectoryIndex index.html index.php </IfModule>

cd ~/lamp/5.2.17
cp php.ini-recommended /usr/local/php/etc/php.ini
ln -s /usr/local/php/bin/php /usr/bin

cd ~/lamp/5.2.17 cp php.ini-recommended /usr/local/php/etc/php.ini ln -s /usr/local/php/bin/php /usr/bin

编辑/usr/local/php/etc/php.ini,short_open_tag = Off编辑为short_open_tag = On

安装Zend Optimizer

cd ~/lamp/ZendOptimizer-3.3.3-linux-glibc23-i386
./install.sh

cd ~/lamp/ZendOptimizer-3.3.3-linux-glibc23-i386 ./install.sh

按照提示一路回车就行

配置完成测试

[root@MyCloudServer ~]# php -v PHP 5.2.17 (cli) (built: Oct 1 2013 21:09:27) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies with Zend Extension Manager v1.2.2, Copyright (c) 2003-2007, by Zend Technologies with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies 启动apache,无报错,无法运行,查看错误日志错误如下:
[Tue Oct 01 21:21:39 2013] [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of “MyCloudServer” Configuration Failed 解决方法:编辑/etc/hosts,把主机名添加到127.0.0.1后面即可

相关配置文件路径

  my.cnf /etc/my.cnf 
  apache /usr/local/apache/conf/httpd.conf 
  php.ini /usr/local/php/etc/php.ini 
  proftpd /usr/local/proftpd/etc/proftpd.conf

my.cnf /etc/my.cnf apache /usr/local/apache/conf/httpd.conf php.ini /usr/local/php/etc/php.ini proftpd /usr/local/proftpd/etc/proftpd.conf

原文地址 : https://www.xj123.info/4026.html

本站遵循 : 署名-非商业性使用-相同方式共享 2.5 中国大陆 (CC BY-NC-SA 2.5)

版权声明 : 原创文章转载时,请务必以超链接形式标明文章原始出处

Tags: lamp
  • 上一篇:十一快乐
  • 下一篇:CentOS配置安装Sendmail并让PHP调用发信
2条评论
  1. 阿福 说:

    你为什么不直接搞个脚本?

    POST:2013-10-03 13:49 回复
    • 老谢 说:

      @阿福 有这个想法

      POST:2013-10-03 13:51 回复
发表评论 点击取消评论.

*必填

*必填

  • 文章归档
  • 子网计算
  • 我的共享
  • 锻炼计划
  • 给我留言
  • 关于老谢
2025 年 6 月
一 二 三 四 五 六 日
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« 5 月    

最新文章

  • 认知,是否是一座大山?当架构决策变成配置清单比价
  • 重装博客服务器环境
  • 特斯拉24款标续 Model Y 2万公里使用体验
  • 接盘的傻子
  • 小牛us电瓶指示灯闪三次不上电
  • 一次还不错的小米售后体验
  • 装台1600元办公主机
  • 2021好久没更新博客
  • Zabbix监控oxidized备份状态
  • Zabbix 5.0 LTS版本MySQL表分区及编译安装随记

最新评论

  • zwwooooo:类似以前做网站开发时,一开始有自...
  • 老陳网志:有点高端,像我们整点nas玩玩就够...
  • springwood:自从 CentOS 不维护之后,我换 U...
  • 大D:难都搞下来了,那就更得YM了
  • 大D:只能是YM了,谢总牛啊
  • 灰常记忆:经济不好 今年我也换了机器 一...
  • 大峰:这是海外服务器嘛?速度挺快的。
  • 大D:只能单走一个6了哈哈哈
  • zwwooooo:买特斯拉和买iPhone的人群其实相似...
  • 平安家属子痕:一直坚持油车,看你写的心里有...

日志存档

  • 2025 年 5 月
  • 2025 年 4 月
  • 2025 年 3 月
  • 2024 年 9 月
  • 2024 年 5 月
  • 2024 年 1 月
  • 2023 年 4 月
  • 2021 年 10 月
  • 2021 年 4 月
  • 2021 年 3 月
  • 2021 年 2 月
  • 2020 年 11 月
  • 2020 年 9 月
  • 2020 年 5 月
  • 2020 年 4 月
  • 2020 年 3 月
  • 2020 年 1 月
  • 2019 年 12 月
  • 2019 年 10 月
  • 2019 年 7 月
  • 2019 年 6 月
  • 2019 年 5 月
  • 2019 年 3 月
  • 2019 年 1 月
  • 2018 年 12 月
  • 2018 年 11 月
  • 2018 年 10 月
  • 2018 年 7 月
  • 2018 年 6 月
  • 2018 年 5 月
  • 2018 年 4 月
  • 2018 年 3 月
  • 2018 年 1 月
  • 2017 年 10 月
  • 2017 年 9 月
  • 2017 年 8 月
  • 2017 年 7 月
  • 2017 年 2 月
  • 2017 年 1 月
  • 2016 年 12 月
  • 2016 年 11 月
  • 2016 年 10 月
  • 2016 年 7 月
  • 2016 年 6 月
  • 2016 年 4 月
  • 2016 年 2 月
  • 2016 年 1 月
  • 2015 年 12 月
  • 2015 年 10 月
  • 2015 年 9 月
  • 2015 年 7 月
  • 2015 年 5 月
  • 2015 年 4 月
  • 2015 年 3 月
  • 2015 年 2 月
  • 2015 年 1 月
  • 2014 年 12 月
  • 2014 年 10 月
  • 2014 年 9 月
  • 2014 年 8 月
  • 2014 年 7 月
  • 2014 年 6 月
  • 2014 年 5 月
  • 2014 年 4 月
  • 2014 年 3 月
  • 2014 年 2 月
  • 2014 年 1 月
  • 2013 年 12 月
  • 2013 年 11 月
  • 2013 年 10 月
  • 2013 年 9 月
  • 2013 年 8 月
  • 2013 年 7 月
  • 2013 年 6 月
  • 2013 年 5 月
  • 2013 年 4 月
  • 2013 年 3 月
  • 2013 年 2 月
  • 2013 年 1 月
  • 2012 年 12 月
  • 2012 年 11 月
  • 2012 年 9 月
  • 2012 年 8 月
  • 2012 年 7 月
  • 2012 年 6 月
  • 2012 年 5 月
  • 2012 年 4 月
  • 2012 年 3 月
  • 2012 年 2 月
  • 2012 年 1 月
  • 2011 年 12 月
  • 2011 年 11 月
  • 2011 年 10 月
  • 2011 年 9 月
  • 2011 年 8 月
  • 2011 年 7 月
  • 2011 年 6 月
  • 2011 年 5 月
  • 2011 年 4 月
  • 2011 年 3 月
  • 2011 年 2 月
  • 2011 年 1 月
  • 2010 年 12 月
  • 2010 年 11 月
  • 2010 年 10 月
  • 2010 年 9 月
  • 2010 年 8 月
  • 2010 年 7 月

W3C

  • XHTML 1.0 Transitional
  • CSS level 3
  • Google+
Copyright © 2010-2025 老谢博客 All rights reserved.
Gzipped 76.5% | Optimized loading 49 queries in 0.479 seconds | Memory 38.96 MB | 尼玛的备案
Powered by WordPress. | Hosted By LAOXUEHOST | Theme by WordPress主题巴士 | 站点地图 | SiteMap | uptime查询