CentOS+httpd-2.4.9+mysql-5.6.12+php-5.4.16+xcache-3.1.0+Discuz_X3.0_SC_GBK
CentOS+httpd-2.4.9+mysql-5.6.12+php-5.4.16+xcache-3.1.0+Discuz_X3.0_SC_GBK
【最新版的LAXMP】
序:
一、安装系统工具包
二、安装Apache
三、安装Mysql数据库
四、安装PHP
五、整合Apache与PHP
六、安装Xcache加速器
七、启用服务器状态
八、安装Discuz论坛(Discuz_X3.0_SC_GBK)
一、安装系统工具包
1. 准备安装包
2. 安装vim wget gcc gcc-c++ unzip zip
# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# yum -y install vim wget gcc gcc-c++ unzip zip
3. 关闭iptables和selinux
# chkconfig iptables off
# service iptables stop
# vim /etc/sysconfig/selinux
修改一行
SELINUX = disabled
# getenforce
4. 卸载默认的低版本环境及rpm包环境Mysql,Apache,PHP
# rpm -qa |grep mysql
mysql-libs-5.1.66-2.el6_3.x86_64
# rpm -e --nodeps mysql-libs
# rpm -e --nodeps httpd
# rpm -e --nodeps php
二、安装Apache服务
1. 安装Apache
注意:
正式开始编译安装步骤,我们按照一定的顺序安装:Apache –>Mysql –>PHP,但在安装PHP之前,应该先安装PHP5需要的最新版本库文件,
例如:libxml2、libmcrypt、GD2库等文件。安装GD2库是为了让PHP5支持GIF、PNG、JPEG图片格式,所以在安装GD2库之前还要先安装最新的
zlib、libpng、freetype 和 jpegsrc 等库文件。而且中间还会穿插安装一些软件
------------
apr
apr-util
pcre
zlib
apache
---
Install apr
# tar xf apr-1.4.8.tar.gz
# cd apr-1.4.8
# ./configure --prefix=/usr/local/apr
# make && make install
Install apr-util
# tar xf apr-util-1.5.2.tar.gz
# cd apr-util-1.5.2
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make && make install
Install pcre
# unzip pcre-8.33.zip
# cd pcre-8.33
# ./configure --prefix=/usr/local/pcre
# make && make install
Install zlib
# tar xf zlib-1.2.8.tar.gz
# cd zlib-1.2.8
# ./configure --prefix=/usr/local/zlib
# make && make install
Install apache
# tar xf httpd-2.4.9.tar.gz
# cd httpd-2.4.9
# ./configure --prefix=/usr/local/apache \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util \
--with-pcre=/usr/local/pcre \
--enable-so \
--enable-cgi \
--with-zlib \
--enable-rewrite \
--with-z=/usr/local/zlib \
--enable-mpms-shared=all \
--enable-deflate=shared \
--enable-expires=shared \
--enable-rewrite=shared \
--enable-static-support
# make && make install
2. 测试Apache服务器
启动Apache服务
# /usr/local/apache/bin/apachectl stop
AH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using localhost.localdomain.
Set the ‘ServerName‘ directive globally to suppress this message
# vim /usr/local/apache/conf/httpd.conf
修改一行 去掉注释#
ServerName localhost:80
查看apache的80端口是否开启
# netstat -tnlp |grep :80
访问apache服务器
IE---> http://192.168.2.129
It works!
如果显示It works! 则表明安装成功!
3. 提供SysV服务脚本有两种方法
# cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
# vim /etc/init.d/httpd
增加两行
{
#!/bin/sh
#chkconfig: 35 80 90
#description Apache Web Server
}
chmod +x /etc/init.d/httpd
chkconfig --add httpd
chkconfig --list httpd
service httpd stop
service httpd start
netstat -tnlp
4. 为Apache添加环境变量
[root@localhost /]# /usr/local/apache2/bin/httpd -v #绝对路径
Server version: Apache/2.4.9 (Unix)
Server built: Mar 31 2014 10:06:52
[root@localhost /]# httpd #bash环境下不能直接调用,因为环境变量中没有httpd的路径
-bash: httpd: command not found
# vim /etc/profile.d/httpd.sh
增加一行
export PATH=$PATH:/usr/local/apache/bin
# source /etc/profile
[root@localhost /]# httpd -v
Server version: Apache/2.4.9 (Unix)
Server built: Mar 31 2014 10:06:52
}
三. Mysql数据库
1. 安装cmake
# tar xf cmake-2.8.11.2.tar.gz
# cd cmake-2.8.11.2
# ./configure
# gmake
# make install
# ln -sv /usr/local/bin/cmake /usr/bin/cmake
2. 创建mysql用户和组
groupadd -r mysql
useradd -g mysql -r -s /sbin/nologin mysql
3. 创建mysql数据目录
mkdir -pv /mydata/data
chown -R mysql:mysql /mydata/data
4. 安装mysql
# yum -y install ncurses ncurses-devel{mysql在cmake的时候报错所需要的依赖包}
# rm -rf /usr/local/src/mysql-5.6.12/CMakeCache.txt
# tar xf mysql-5.6.12.tar.gz
# cd mysql-5.6.12
# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
-DMYSQL_DATADIR=/mydata/data \
-DSYSCONFDIR=/etc \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DWITH_SSL:STRING=bundled \
-DWITH_ZLIB:STRING=bundled \
-DWITH_LIBWRAP=0 \
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci
# make && make install
5. 为mysql提供服务脚本
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
6. 初始化mysql
cd /usr/local/mysql/
chown -R mysql:mysql /usr/local/mysql/
scripts/mysql_install_db --user=mysql --datadir=/mydata/data/
7. 修改mysql配置文件
# cp /usr/local/mysql/my.cnf /etc/my.cnf
# vim /etc/my.cnf
#增加如下内容
binlog-format=ROW
log-bin=master-bin.log
log-slave-updates=true
gtid-mode=on
enforce-gtid-consistency=true
master-info-repository=TABLE
relay-log-info-repository=TABLE
sync-master-info=1
slave-parallel-workers=2
binlog-checksum=CRC32
master-verify-checksum=1
slave-sql-verify-checksum=1
binlog-rows-query-log_events=1
server-id=1
report-port=3306
port=3306
datadir=/mydata/data
socket=/tmp/mysql.sock
report-host=master.allentuns.com
8. 启动mysql
# service mysqld start
9. mysql命令添加到环境变量中
# vim /etc/profile.d/mysql.sh
增加一行
export PATH=$PATH:/usr/local/mysql/bin
# source /etc/profile #重新读取环境变量
10. 输出mysql的库文件
# vim /etc/ld.so.conf.d/mysql.conf
增加一行
/usr/local/mysql/lib/
# ldconfig -v #重新加载库文件
11. 输出mysql的头文件到系统头文件
# ln -sv /usr/local/mysql/include/ /usr/include/mysql
好了到这里mysql的源码安装的配置过程全部完成,下面我们测试一下!
四、安装PHP
1. 安装libxml2
tar xf libxml2-2.7.2.tar.gz
cd libxml2-2.7.2
./configure --prefix=/usr/local/libxml2
make && make install
2. 安装libmcrypt
tar xf libmcrypt-2.5.7.tar.gz
cd libmcrypt-2.5.7
./configure --prefix=/usr/local/libmcrypt/
make && make install
3. 安装libpng
tar xf libpng-1.4.3.tar.bz2
cd libpng-1.4.3
yum -y install zlib-devel
./configure --prefix=/usr/local/libpng
make && make install
4. 安装jpeg7
tar xf jpegsrc.v7.tar.gz
cd jpeg-7/
./configure --prefix=/usr/local/jpeg-7
make && make install
5. 安装freetype
tar xf freetype-2.4.0.tar.gz
cd freetype-2.4.0
./configure --prefix=/usr/local/freetype
make && make install
6. 安装autoconf
tar xf autoconf-2.69.tar.gz
cd autoconf-2.69
./configure
make && make install
7. 安装GD库文件
tar xf libgd-gd-libgd-9f0a7e7f4f0f.tar.gz
cd libgd-gd-libgd-9f0a7e7f4f0f
cmake .
make && make install
8. 安装php
# tar -xf php-5.4.16.tar.gz
# cd php-5.4.16
# ./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-libxml-dir=/usr/local/libxml2/ \
--with-jpeg-dir=/usr/local/jpeg-7/ \
--with-png-dir=/usr/local/libpng/ \
--with-freetype-dir=/usr/local/freetype/ \
--with-gd \
--with-zlib-dir=/usr/local/zlib/ \
--with-mcrypt=/usr/local/libmcrypt/ \
--enable-soap \
--enable-mbstring=all \
--enable-sockets
# make && make install
9. 为php提供配置文件
# cp /usr/local/src/php/php-5.4.26/php.ini-production /etc/php.ini
五、整合Apache和PHP
1. 编辑apache配置文件httpd.conf,以apache支持php
(1) 首先要在apache配置文件中定义,使apache能够处理php结尾的文件 ,全文查找AddType字段,添加一下内容
[root@localhost php-5.4.26]# vim /usr/local/apache/conf/httpd.conf
添加三行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
PHPIniDir "/etc/php.ini"
(2)定位至DirectoryIndex index.html修改为:
DirectoryIndex index.php index.html
2. 重启Apache服务
# service httpd start
测试页
# vim /usr/local/apache/htdocs/index.php
<?php
phpinfo();
?>
六、安装Xcache加速器
1. 安装xcache-3.1.0
# tar xf xcache-3.1.0.tar.gz
# cd /usr/local/src/xcache-3.1.0
# /usr/local/php/bin/phpize
# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config
# make && make install
编译完成,让php支持xcache功能前提要把xcache的配置信息添加到php的配置文件中
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20100525/
/usr/local/php/lib/php/extensions/no-debug-zts-20100525/
2. 追加配置文件xcache.ini至php.ini
# cat xcache.ini >> /etc/php.ini
# vim /etc/php.ini
接下来编辑/etc/php.d/xcache.ini,找到zend_extension开头的行,修改为如下行:
[xcache-common]
;; non-Windows example:
extension = /usr/local/php/lib/php/extensions/no-debug-zts-20100525/xcache.so #修改这一行
;; Windows example:
; extension = php_xcache.dll
3. 重启apache并测试
# service httpd stop
# service httpd start
七、启用服务器状态
# vim /usr/local/apache/conf/httpd.conf
<Location /server-status>
SetHandler server-status
Require all granted
</Location>
测试
IE访问---> http://192.168.2.129/server-status
八、安装Discuz论坛(Discuz_X3.0_SC_GBK最新版)
(1)授权主机对mysql的访问
mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘192.168.%.%‘ IDENTIFIED BY ‘123456‘;
Query OK, 0 rows affected (0.03 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.02 sec)
(2). 准备Discuz 3.0
# unzip Discuz_X3.0_SC_GBK.zip
# mv upload/* /usr/local/apache/htdocs/
(3). 安装
IE----> http://192.168.2.129/install
(4). 修改权限
[root@localhost htdocs]# cd /usr/local/apache/htdocs/upload
[root@localhost htdocs]# chmod 777 ./data ./config/ ./data/cache/ ./data/avatar/ ./data/plugindata/ ./data/download/ ./data/addonmd5/ ./data/template/ ./ data/threadcache/ ./data/attachment/ ./data/attachment/album/ ./data/attachment/forum/ ./data/attachment/group/ ./data/log/ ./uc_client/data/cache/ ./uc_server/data ./uc_server/data/avatar/ ./uc_server/data/backup/ ./uc_server/data/logs/ ./uc_server/data/tmp/ ./uc_server/data/view/ ./uc_server/data/cache/
(5). 选择全新安装
(6). 配置数据库文件
(7). 安装完成
附截图
============================================================================
参考文档
参考文章:
http://minitoo.blog.51cto.com/4201040/1257698/ lamp
http://freeloda.blog.51cto.com/2033581/1232648 lamp
http://freeloda.blog.51cto.com/2033581/1252067 mysql
http://www.ithov.com/linux/131544_5.shtml ldmmp
http://hi.baidu.com/in_coding/item/a0cc49d03162ac1ed68ed056 xcache
============================================================================
本文出自 “郑彦生” 博客,请务必保留此出处http://467754239.blog.51cto.com/4878013/1388309
CentOS+httpd-2.4.9+mysql-5.6.12+php-5.4.16+xcache-3.1.0+Discuz_X3.0_SC_GBK,古老的榕树,5-wow.com
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。