卸载yum或rpm安装的amp软件
#在编译安装lamp之前,首先先卸载已存在的rpm包。
rpm -e httpd
rpm -e mysql
rpm -e php yum -y remove httpd
yum -y remove mysql-server mysql
yum -y remove php
yum -y remove php-mysql yum -y install yum-fastestmirror
禁用SeLinux
#selinux可能会致使编译安装失败,我们先禁用它。
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config #永久禁用,需要重启生效。
或
setenforce 0 #临时禁用,不需要重启(推荐)。
yum安装必要工具
#安装编译工具gcc gcc-c++make automake autoconf kernel-devel,安装PHP所需依赖,如libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel等。
yum -y install gcc gcc-c++ kernel-devel ntp vim-enhanced flex bison autoconf make automake bzip2-devel ncurses-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel libXpm-devel gettext-devel pam-devel libtool libtool-ltdl openssl openssl-devel fontconfig-devel libxml2-devel curl-devel libicu libicu-devel libmcrypt libmcrypt-devel libmhash libmhash-devel pcre-devel libtool-libs gd file patch mlocate diffutils readline-devel glibc-devel glib2-devel libcap-devel
下载所需源码
源码包放在了“百度云盘”:进入下载页面
所需源码包:
/usr/local/src/Apache-2.2.25/httpd-2.2.25.tar.gz
/usr/local/src/MySQL-5.5.25/cmake-2.8.8.tar.gz
/usr/local/src/MySQL-5.5.25/mysql-5.5.25.tar.gz
/usr/local/src/PHP-5.3.27/libiconv-1.14.tar.gz
/usr/local/src/PHP-5.3.27/libmcrypt-2.5.8.tar.gz
/usr/local/src/PHP-5.3.27/mcrypt-2.6.8.tar.gz
/usr/local/src/PHP-5.3.27/mhash-0.9.9.9.tar.gz
/usr/local/src/PHP-5.3.27/php-5.3.27.tar.gz
下载的源码包统一放在 /usr/local/src/ 目录下。(Windows平台上下载,然后用FTP工具上传至Linux服务器的 /usr/local/src/ 目录下)
解压包:
[root@localhost ~]# cd /usr/local/src/Apache-2.2.25
[root@localhost src]# tar -xzvf ./httpd-2.2.25.tar.gz #其它的解压同理可得
...
...
延伸阅读:
CentOS6.x编译安装LAMP(2):编译安装 Apache2.2.25
CentOS6.x编译安装LAMP(2):编译安装 Apache2.4.6
CentOS6.x编译安装LAMP(3):编译安装 MySQL5.5.25
CentOS6.x编译安装LAMP(4):编译安装 PHP5.2.17