系统: Centos6
httpd版本: 2.4 使用event工作模式
PHP版本: 5.4.26
mariadb版本: 5.5.46
xcache版本: 3.0.3
安装顺序: PHP最后安装
一、准备源码包:
二、安装httpd:
1.安装所需环境
yum groupinstall -y"Development tools" "Server Platform Development"
yum install -y pcre-devel
2.安装apr
tar -xjvf apr-1.5.0.tar.bz2
cd apr-1.5.0
./configure--prefix=/usr/local/apr
make & make install
tar -xjvfapr-util-1.5.3.tar.bz2
cd apr-util-1.5.3
./configure--prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
3.安装httpd
tar -xjvf httpd-2.4.9.tar.bz2
cd httpd-2.4.9
./configure --prefix=/usr/local/apache--sysconf=/etc/httpd24--enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/--enable-modules=most--enable-mpms-shared=all --with-mpm=event
//默认使用event工作模式
make && make install
4.后续工作
vim/etc/profile.d/http24.sh
./etc/profile.d/http24.sh
ln -s /usr/local/apache/include//usr/include/httpd24
echo"MANPATH /usr/local/apache/man/" >> /etc/man.config
cp/etc/rc.d/init.d/httpd /etc/rc.d/init.d/httpd24
vim/etc/rc.d/init.d/httpd24
vim/etc/httpd24/httpd.conf
chkconfig--add httpd24
chkconfig--level 35 httpd24 on
servicehttpd24 start
三、安装mariadb:
groupadd -r -g 306 MysqL
useradd -r -g MysqL -u 306 MysqL
2.部署mariadb
tar-xzvf mariadb-5.5.46-linux-x86_64.tar.gz -C /usr/local/
ln -s/usr/local/mariadb-5.5.46-linux-x86_64/ /usr/local/MysqL
cd/usr/local/MysqL/
chown-R root:MysqL ./*
3.初始化数据库
mkdir-p /mydata/data
chown MysqL:MysqL /mydata/data/ //准备数据库存放目录
/usr/local/MysqL/scripts/MysqL_install_db--user=MysqL --basedir=/usr/local/MysqL --datadir=/mydata/data/
//指定mariadb目录和数据库存放目录
4.准备配置文件
mkdir/etc/MysqL
cp/usr/local/MysqL/support-files/my-large.cnf /etc/MysqL/my.cnf
vim /etc/MysqL/my.cnf
5.后续工作
vim /etc/profile.d/MysqLd.sh
. /etc/profile.d/MysqLd.sh
echo '/usr/local/MysqL/lib/'> /etc/ld.so.conf.d/MysqLd.conf
ldconfig
ln -s/usr/local/MysqL/include/MysqL/ /usr/include/MysqLd
echo 'MANPATH/usr/local/MysqL/man/' >> /etc/man.config
cp/usr/local/MysqL/support-files/MysqL.server /etc/rc.d/init.d/MysqLd
chkconfig --add MysqLd
chkconfig MysqLd on //设置开机启动
service MysqLd start
6.安全初始化
/usr/local/MysqL/bin/MysqL_secure_installation
四、安装PHP:
1.解决依赖关系
yum install -y bzip2-devellibmcrypt-devel libxml2-devel
2.安装PHP
tar -xjvf PHP-5.4.26.tar.bz2
cd PHP-5.4.26
./configure --prefix=/usr/local/PHP--with-MysqL=/usr/local/MysqL --with-openssl--with-MysqLi=/usr/local/MysqL/bin/MysqL_config --enable-mbstring--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib--with-libxml-dir=/usr --enable-xml--enable-sockets --with-apxs2=/usr/local/apache/bin/apxs --with-mcrypt--with-config-file-path=/etc/PHP--with-config-file-scan-dir=/etc/PHP/PHP.d --with-bz2 --enable-maintainer-zts
make && make install
mkdir /etc/PHP //用于存放PHP配置文件,要和编译时指定的一致
cp PHP.ini-production/etc/PHP/PHP.ini
3.配置hpttd
vim /etc/httpd24/httpd.conf
service httpd24 reload //重载配置
测试
vim /usr/local/apache/htdocs/index.PHP //测试PHP页面
vim/usr/local/apache/htdocs/db.PHP//测试连接mariadb
五、整合xcache:
1.安装xcache
tar -xjvf xcache-3.0.3.tar.bz2cd xcache-3.0.3
/usr/local/PHP/bin/PHPize //生成configure
./configure --enable-xcache--with-PHP-config=/usr/local/PHP/bin/PHP-config
make && make install
2.整合xcache
mkdir /etc/PHP/PHP.d //用于存放配置文件,要和编译PHP时指定的路径一致
cp xcache-3.0.3/xcache.ini/etc/PHP/PHP.d //复制配置文件
service httpd24 reload //重载配置文件
原文链接:https://www.f2er.com/centos/379234.html