1,停止防火墙及不必要的服务
/etc/init.d/rpcbind stop
/etc/init.d/cups stop
/etc/init.d/postfix stop
/etc/init.d/qpidd stop
/etc/init.d/nfslock stop
chkconfig rpcbind off
chkconfig cups off
chkconfig postfix off
chkconfig qpidd off
chkconfig nfslock off
chkconfig iptables off
2,临时停止selinux
[root@bogon ~]# setenforce 0
Disabled
查看状态
[root@bogon ~]# getenforce
Disabled
也可以修改 /etc/selinux/config,将SELINUX=disabled,重新启动系统即可。
3,更新系统软件源
rpm -ivh rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
4,安装依赖的软件包
yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
5,编译apache
tar -zxvf httpd-2.2.22.tar.gz
cd httpd-2.2.22
./configure --prefix=/usr/local/webserver/apache2 --enable-module=so --enable-rewrite
make && make install
设置自启动
cp support/apachectl /etc/init.d/httpd
vi /etc/init.d/httpd,在第二行添加下面的内容
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
chkconfig --add httpd
chmod 755 /etc/init.d/httpd
chkconfig httpd on
修改 httpd.conf,添加:
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
6,下载二进制的mysql软件包,直接解压即可,二进制包编译麻烦。
7,编译PHP
注意修改httpd,mysql的安装路径,安装完毕后,添加info.php文件进行测试
./configure \
--prefix=/usr/local/webserver/php \
--with-apxs2=/usr/local/webserver/apache2/bin/apxs \
--with-config-file-path=/usr/local/webserver/php/etc \
--with-mysql=/usr/local/webserver/mysql \
--with-mysqli=/usr/local/webserver/mysql/bin/mysql_config \
--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath \
--enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex \
--enable-mbstring --with-gd --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap
make
make install
cp php.ini-dist /usr/local/webserver/php/etc/php.ini