Lamp是一组常用于来搭建动态网站或者服务器的软件平台,由linux、apache、mysql、php四个组件组成。
安装开发工具:Development tools、Server Platform Development、Additional Development
源码安装Mysql数据库:下载mysql-5.6.15.tar.gz
创建一个mysql用户组和系统帐号
groupadd mysql
useradd -r -g mysql mysql
yum --disablerepo=\* --enablerepo=c6-media remove mysql-libs移除
安装cmake ncurses-devel libaio包
tar -zxvf mysql-5.6.15.tar.gz -C /usr/local
进入/usr/local/mysql-5.6.15
6.进行编译
cmake ./ -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -
DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -
DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -
DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -
DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci
make && make install
[root@wangcf1009 ~l]#cd /usr/local/mysql 进入目录
chown -R mysql:mysql .更改
./scripts/mysql_install_db --user=mysql 进行mysql的初始化安装
chown -R root .
chown -R mysql data/
cp my.cnf /etc拷贝主配置文件
[root@wangcf1009 mysql ]#cd support-files 进入目录
cp -p mysql.server /etc/init.d/mysql
15.[root@wangcf1009 support-files]# service mysql restart重启mysql
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
[root@wangcf1009 mysql]# vim /etc/profile增加path变量
/usr/local/mysql/bin
[root@wangcf1009 mysql]# . /etc/profile重新读取
进入数据库
[root@wangcf1009 mysql]# mysqladmin -u root -p password '135983'
把数据库加入启动
echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf库文件输出
[root@wangcf1009 include]# ln -s /usr/local/mysql/include/ mysql头
[root@wangcf1009 include]# vim /etc/man.config 处理手册
增加:MANPATH /usr/local/mysql/man
Mysql安装完毕!
源码安装httpd:下载apr*.tar.gz、apr-util*.tar.gz、httpd*.tar.gz包
[root@wangcf1009 ~]# tar -zxvf apr-1.4.6.tar.gz -C /usr/local/src
[root@wangcf1009 ~]# tar -zxvf apr-util-1.5.1.tar.gz -C /usr/local/src/
[root@wangcf1009 ~]# tar -jxvf httpd-2.4.4.tar.bz2 -C /usr/local/src
[root@wangcf1009 ~]# cd /usr/local/src/
[root@wangcf1009 src]# cd apr-1.4.6/
[root@wangcf1009 apr-1.4.6]# ./configure --prefix=/usr/local/apr
[root@wangcf1009 apr-1.4.6]# make && make install
[root@wangcf1009 apr-1.4.6]# cd ../apr-util-1.5.1/
[root@wangcf1009 apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-utils --with-apr=/usr/local/apr/bin/apr-1-config
[root@wangcf1009 apr-util-1.5.1]# make && make install
[root@wangcf1009 apr-util-1.5.1]# cd ../httpd-2.4.4/
[root@wangcf1009 httpd-2.4.4]# yum --disablerepo=\* --enablerepo=c6-media install pcre-devel opensll-devel
编译
./configure \
--prefix=/usr/local/apache \
--sysconfdir=/etc/httpd \
--enable-so \
--enable-ssl \
--enable-rewrite \
--with-apr=/usr/local/apr/bin/apr-1-config \
--with-apr-util=/usr/local/apr-utils/bin/apu-1-config \
--with-pcre \
--with-z \
--enable-mpms-shared=all
make && make install
[root@wangcf1009 httpd-2.4.4]# cd /usr/local/apache
[root@wangcf1009 apache]# vim /etc/profile 增加path变量
/usr/local/apache/bin
[root@wangcf1009 apache]# . /etc/profile重新读取
[root@wangcf1009 apache]# httpd -k start
19.[root@wangcf1009 apache]# vim /etc/man.config增加man手册路径
MANPATH /usr/local/apache/man
20.[root@wangcf1009 apache]# cd /usr/include/ 进入
21.[root@wangcf1009 include]# ln -s /usr/local/apache/include apache头
22.[root@wangcf1009 include]# cd /etc/init.d/
23.[root@wangcf1009 init.d]# touch httpd
24.[root@wangcf1009 init.d]# chmod a+x httpd
25.[root@wangcf1009 init.d]# vim httpd 编写控制文件脚本
26.[root@wangcf1009 init.d]# service httpd start
源码安装php:下载php-5.5.8.tar.bz2、
本地yum安装gd、libxml2-devel、screen
[root@wangcf1009 ~]# tar -jxvf php-5.5.8.tar.bz2 -C /usr/local/src/
[root@wangcf1009 ~]# cd /usr/local/src/php-5.5.8/
[root@wangcf1009 ~]#mkdir /etc/php /etc/php5.d 创建目录
编译./configure --prefix=/usr/local/php --with-config-file-path=/etc/php --with-config-file-scan-dir=/etc/php5.d --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring=all
[root@wangcf1009 php-5.5.8]# make && make install
[root@wangcf1009 php-5.5.8]# cp php.ini-production /etc/php/php.ini
编辑vim /etc/httpd/httpd.conf,增加模块
增加index.php
vim /usr/local/apache/htdocs/index.php如下图
Service httpd restart
打开pc浏览器输入http://192.168.88.100
说明apache与php已经结合在一起
二、vim /usr/local/apache/htdocs/index.php如下图
Service httpd restart Service mysql restart
打开pc浏览器输入http://192.168.88.100
说明通过php已经连接数据库
安装应用:phpwind应用
[root@wangcf1009 ~ ]# unzip phpwind_v9.0_gbk.zip
[root@wangcf1009 ~]# cd phpwind_v9.0_gbk
[root@wangcf1009 phpwind_v9.0_gbk]# mv upload/ /usr/local/apache/htdocs/phpwind
[root@wangcf1009phpwind_v9.0_gbk]#cd/usr/local/apache/htdocs/phpwind
[root@wangcf1009 phpwind]# chmod -R o+w attachment/ conf/ data/ html/ src/ themes/ windid/
访问http://192.168.88.100/phpwind
访问成功!
安装phpMyadmin应用:
[root@wangcf1009 ~]# unzip phpMyAdmin-3.5.8-all-languages.zip
[root@wangcf1009 ~]# mv phpMyAdmin-3.5.8-all-languages /usr/local/apache/htdocs/phpmyadmin
访问http://192.168.88.100/phpmyadmin出现下图
输入数据库帐号与密码
安装wordpress应用:
1.[root@wangcf1009 ~]# unzip wordpress-3.8-zh_CN.zip
2.[root@wangcf1009 ~]# mv wordpress /usr/local/apache/htdocs/
3.访问http://192.168.88.100/wordpress出现下图,然后安装
登陆之后出现下图
进行压力测试:
ab -n 1000 -c 500 http://192.168.88.100/index.php
安装xcache:
[root@wangcf1009 ~]# tar -zxvf xcache-3.1.0.tar.gz /usr/local/src
[root@wangcf1009 ~]#cd /usr/local/src/xcache-3.1.0
[root@wangcf1009 xcache-3.1.0]# /usr/local/php/bin/phpize
[root@wangcf1009 xcache-3.1.0]# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config 编译
[root@wangcf1009 xcache-3.1.0]# make && make install 安装
[root@wangcf1099 xcache-3.1.0]# cd /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/
进入目录查看下模块
7.[root@wangcf1009 no-debug-non-zts-20121212]# ls
opcache.a opcache.so xcache.so
8.[root@wangcf1009 no-debug-non-zts-20121212]# cp xcache.so /etc/php5.d/ 把模块移动到php5.d目录下
9.[root@wangcf1009 no-debug-non-zts-20121212]# cd/usr/local/src/xcache-3.1.0
10.[root@wangcf1009 xcache-3.1.0]# cp xcache.ini /etc/php5.d/
拷贝配置文件
11.[root@wangcf1009 xcache-3.1.0]# cd /usr/local/apache/htdocs/
12.[root@wangcf1009 htdocs]# vim index.php
访问http://192.168.88.100,进入网页测试下xcache是否加载成功
再进行压力测试!明显增加
ab -n 1000 -c 500 http://192.168.88.100/phpwind