实验环境:

1、VMware Workstation 10

2、设备A:MySQL,IP地址:192.168.0.102,HostName:mysql

3、设备B:LAMP环境+nginx代理,IP地址:192.168.0.107,HostName:lanp 

4、Linux发行版:Centos 6.7 x86_64;

5、Nginx:http://nginx.org/download/nginx-1.6.2.tar.gz

6、Apache:httpd-2.2.16.tar.gz

7、PHP:php-5.3.28.tar.gz

8、MySQL:mysql-5.5.42-linux2.6-x86_64.tar.gz

9、discuz:Discuz_X3.2_SC_UTF8.zip

10、wordpress:wordpress-4.2.2-zh_CN.tar.gz

11、phpmyadmin:phpMyAdmin-4.0.8-all-languages.zip

实验步骤:

设备A:mysql

cd /usr/local/src/ 

tar zxvf mysql-5.5.42-linux2.6-x86_64.tar.gz

mv mysql-5.5.42-linux2.6-x86_64 /usr/local/mysql 

cd /usr/local/mysql

mkdir -p /data/mysql

useradd -s /sbin/nologin -M mysql

chown -R mysql:mysql /data/mysql

cp support-files/my-large.cnf /etc/my.cnf 

cp support-files/mysql.server /etc/init.d/mysqld

chmod 755 /etc/init.d/mysqld

vi /etc/init.d/mysql,basedir=/usr/local/mysql,datadir=/data/mysql

./scripts/mysql_install_db --user=mysql --datadir=/data/mysql 

 vim /etc/profile.d/mysql.sh加入export PATH=$PATH:/usr/local/mysql/bin

chkconfig --add mysqld

chkconfig mysqld on

service mysqld start

登录mysql授权:grant all on *.* to 'aming'@'192.168.137.107' identified by 'aminglinux.com';

设备B:LAMP

1. 安装apache

cd /usr/local/src/ 

tar zvxf httpd-2.2.16.tar.gz 

cd httpd-2.2.16 

./configure --prefix=/usr/local/apache2  --enable-mods-shared=most  --enable-so

make&make install

apache加入chkconfig

cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

vim /etc/init.d/httpd
在第一行#!/bin/sh下增加两行文字
# chkconfig: 35 70 30
# description: Apache

chkconfig --level 35 httpd on

2.  安装php

cd /usr/local/src/ 

tar zxvf php-5.3.28.tar.gz 

cd php-5.3.28 

./configure   --prefix=/usr/local/php   --with-apxs2=/usr/local/apache2/bin/apxs   --with-config-file-path=/usr/local/php/etc  --with-libxml-dir   --with-gd   --with-jpeg-dir   --with-png-dir   --with-freetype-dir   --with-iconv-dir   --with-zlib-dir   --with-bz2   --with-openssl   --with-mcrypt   --enable-soap   --enable-gd-native-ttf   --enable-mbstring   --enable-sockets   --enable-exif   --disable-ipv6 --with-mysql=mysqlnd --with-mysqli=mysqlnd  --with-pdo-mysql=mysqlnd

make&make install

cp /usr/local/src/php-5.3.28/php.ini-production /usr/local/php/etc/php.ini

3、 配置apache结合php

vim /usr/local/apache2/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加:
AddType application/x-httpd-php .php
找到:
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
将该行改为:
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
</IfModule>
找到:
#ServerName www.example.com:80
修改为:
ServerName localhost:80

vim /usr/local/apache2/conf/httpd.conf找到:
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>
改为:
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
</Directory>

测试LAMP环境:在浏览器访问192.168.137.107,如果显示IT Works!表示LAMP环境搭建成功

mkdir data

cd data

在data目录分别创建bbs、blog、pma目录

4.解压discuz并把upload下的内容移到bbs下

cd /usr/local/src

unzip Discuz_X3.2_SC_UTF8.zip

 mv upload/* /data/bbs  

5.解压wordpress并把wordpress下的内容移到blog下

[root@lanp src]# tar zxvf wordpress-4.2.2-zh_CN.tar.gz

[root@lanp src]# mv wordpress/* /data/blog

6.解压phpmyadmin并把phpMyAdmin-4.0.8-all-languages下的内容移到pma下

[root@lanp src]# unzip phpMyAdmin-4.0.8-all-languages.zip

[root@lanp src]# mv phpMyAdmin-4.0.8-all-languages/* /data/pma

7.把apache端口改成88:进入apache主配置文件,把lisen 80改成88