尝试课题:搭建LAMP,安装Nginx,作为署理,将MySQL安装在单独的呆板,apache认真动态,nginx认真静态
尝试情况:
1、VMware Workstation 11
2、设备A:MySQL,ip地点:192.168.0.102,Host:mysql
3、设备B:Nginx+Apache+php,IP地点:192.168.0.107,,Host:lanp 真机:192.168.0.104
4、linux刊行版:Centos 6.6 x86;
5、Nginx:http://nginx.org/download/nginx-1.6.2.tar.gz
6、Apache:get http://mirrors.sohu.com/apache/httpd-2.4.16.tar.gz
7、PHP:http://cn2.php.net/get/php-5.6.12.tar.gz
8、MySQL:http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.42-linux2.6-i686.tar.gz
9、discuz:http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip
10、WordPRess:https://cn.wordpress.org/wordpress-4.2.2-zh_CN.tar.gz
11、phpmyadmin:https://files.phpmyadmin.net/phpMyAdmin/4.4.13.1/phpMyAdmin-4.4.13.1-all-languages.zip
12、pcre http://sourceforge.net/projects/pcre/files/pcre2/10.20/pcre2-10.20.tar.gz
13、apr http://mirror.bit.edu.cn/apache//apr/apr-1.5.2.tar.gz
14、apr-util http://mirror.bit.edu.cn/apache//apr/apr-util-1.5.4.tar.gz
15、epel-release http://mirrors.ustc.edu.cn/epel/6Server/x86_64/epel-release-6-8.noarch.rpm
16、libmcrypt
尝试筹备:
1、改换163下载源
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.old
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS6-Base-163.repo CentOS-Base.repo
yum clean all
yum makecache (留意替换CentOS-Base.repo $Realease :1,$s/$Realease/6.6/g)
yum -y update
2、别离在设备A和B中下载各个软件;
3、更新系统时间;
crontab -e */30 * * * * ntpdate 210.72.145.44 > /dev/null 2>&1
4、清空Iptables,封锁Selinux,可能添加数据库和网站的会见权限。
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 88 -j ACCEPT ##
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
5.安装依赖包
yum -y install ntp make openssl openssl-devel pcre pcre-devel libpng libpng-devel libtiff-devel libjpeg-6b libjpeg-devel-6b freetype freetype-devel gd gd-devel fontconfig-devel zlib zlib-devel libevent-devel gcc gcc-c++ flex bison bzip2 bzip2-devel libXpm libXpm-devel ncurses ncurses-devel libmcrypt libmcrypt-devel libxml2 libxml2-devel imake autoconf automake screen sysstat compat-libstdc++-33 curl curl-devel
尝试步调:
设备A:mysql
tar zxvf /usr/local/src/mysql-5.5.42-linux2.6-i686.tar.gz
mv mysql-5.5.42-linux2.6-i686 /usr/local/mysql
useradd -s /sbin/nologin mysql
cd /usr/local/mysql
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
./scripts/mysql_install_db --user=mysql --datadir=/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
vim /etc/init.d/mysqld #修改datadir=/usr/local/mysql
chkconfig --add mysqld
chkconfig mysqld on
service mysqld start
mysql -uroot -p <输入你的mysql登录暗码>
create database discuz;
create database wordpress;
grant all on discuz.* to 'youruser'@'lyourhostip' identified by 'yourpassword';
grant all on wordpress .* to 'youruser'@'lyourhostip' identified by 'yourpassword';
quit
设备B:lanp
一、安装Apache
tar zxvf /usr/local/src/httpd-2.4.16.tar.gz
tar zxvf /usr/local/src/apr-1.5.2.tar.gz
tar zxvf /usr/local/src/apr-util-1.5.4.tar.gz
mv /usr/loca/src/apr-1.5.2 /usr/loca/src/httpd-2.4.16/srclib/apr
mv /usr/local/src/apr-util-1.5.4 /usr/loca/src/httpd-2.4.16/srclib/apr-util
cd /usr/loca/src/httpd-2.4.16
./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared
make && make install
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
二、安装PHP
tar zxf /usr/local/src/php-5.6.12.tar.gz
cd php-5.6.12
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --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
##利用了php自带的对mysql的驱动措施mysqlnd
make && make install
cp /usr/local/src/php-5.6.12/php.ini-production /usr/local/php/etc/php.ini
三、设置PHP和Apache团结