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
- [[email protected] ~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拷贝主配置文件
- [[email protected] mysql ]#cd support-files 进入目录
cp -p mysql.server /etc/init.d/mysql
15.[[email protected] support-files]# service mysql restart重启mysql
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!
- [[email protected] mysql]# vim /etc/profile增加path变量
/usr/local/mysql/bin
- [[email protected] mysql]# . /etc/profile重新读取
进入数据库
- [[email protected] mysql]# mysqladmin -u root -p password ‘135983‘
- 把数据库加入启动
- echo "/usr/local/mysql/lib" > /etc/ld.so.conf.d/mysql.conf库文件输出
- [[email protected] include]# ln -s /usr/local/mysql/include/ mysql头
- [[email protected] include]# vim /etc/man.config 处理手册
增加:MANPATH /usr/local/mysql/man
Mysql安装完毕!
源码安装httpd:下载apr*.tar.gz、apr-util*.tar.gz、httpd*.tar.gz包
- [[email protected] ~]# tar -zxvf apr-1.4.6.tar.gz -C /usr/local/src
- [[email protected] ~]# tar -zxvf apr-util-1.5.1.tar.gz -C /usr/local/src/
- [[email protected] ~]# tar -jxvf httpd-2.4.4.tar.bz2 -C /usr/local/src
- [[email protected] ~]# cd /usr/local/src/
- [[email protected] src]# cd apr-1.4.6/
- [[email protected] apr-1.4.6]# ./configure --prefix=/usr/local/apr
- [[email protected] apr-1.4.6]# make && make install
- [[email protected] apr-1.4.6]# cd ../apr-util-1.5.1/
- [[email protected] apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-utils --with-apr=/usr/local/apr/bin/apr-1-config
- [[email protected] apr-util-1.5.1]# make && make install
- [[email protected] apr-util-1.5.1]# cd ../httpd-2.4.4/
- [[email protected] 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
- [[email protected] httpd-2.4.4]# cd /usr/local/apache
- [[email protected] apache]# vim /etc/profile 增加path变量
/usr/local/apache/bin
- [[email protected] apache]# . /etc/profile重新读取
- [[email protected] apache]# httpd -k start
19.[[email protected] apache]# vim /etc/man.config增加man手册路径
MANPATH /usr/local/apache/man
20.[[email protected] apache]# cd /usr/include/ 进入
21.[[email protected] include]# ln -s /usr/local/apache/include apache头
22.[[email protected] include]# cd /etc/init.d/
23.[[email protected] init.d]# touch httpd
24.[[email protected] init.d]# chmod a+x httpd
25.[[email protected] init.d]# vim httpd 编写控制文件脚本
26.[[email protected] init.d]# service httpd start
源码安装php:下载php-5.5.8.tar.bz2、
本地yum安装gd、libxml2-devel、screen
- [[email protected] ~]# tar -jxvf php-5.5.8.tar.bz2 -C /usr/local/src/
- [[email protected] ~]# cd /usr/local/src/php-5.5.8/
- [[email protected] ~]#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
- [[email protected] php-5.5.8]# make && make install
- [[email protected] 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应用
- [[email protected] ~ ]# unzip phpwind_v9.0_gbk.zip
- [[email protected] ~]# cd phpwind_v9.0_gbk
- [[email protected] phpwind_v9.0_gbk]# mv upload/ /usr/local/apache/htdocs/phpwind
- [[email protected]_v9.0_gbk]#cd/usr/local/apache/htdocs/phpwind
- [[email protected] phpwind]# chmod -R o+w attachment/ conf/ data/ html/ src/ themes/ windid/
访问http://192.168.88.100/phpwind
访问成功!
安装phpMyadmin应用:
- [[email protected] ~]# unzip phpMyAdmin-3.5.8-all-languages.zip
- [[email protected] ~]# mv phpMyAdmin-3.5.8-all-languages /usr/local/apache/htdocs/phpmyadmin
- 访问http://192.168.88.100/phpmyadmin出现下图
输入数据库帐号与密码
安装wordpress应用:
1.[[email protected] ~]# unzip wordpress-3.8-zh_CN.zip
2.[[email protected] ~]# 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:
- [[email protected] ~]# tar -zxvf xcache-3.1.0.tar.gz /usr/local/src
- [[email protected] ~]#cd /usr/local/src/xcache-3.1.0
- [[email protected] xcache-3.1.0]# /usr/local/php/bin/phpize
- [[email protected] xcache-3.1.0]# ./configure --enable-xcache --with-php-config=/usr/local/php/bin/php-config 编译
- [[email protected] xcache-3.1.0]# make && make install 安装
- [[email protected] xcache-3.1.0]# cd /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/
进入目录查看下模块
7.[[email protected] no-debug-non-zts-20121212]# ls
opcache.a opcache.so xcache.so
8.[[email protected] no-debug-non-zts-20121212]# cp xcache.so /etc/php5.d/ 把模块移动到php5.d目录下
9.[[email protected] no-debug-non-zts-20121212]# cd/usr/local/src/xcache-3.1.0
10.[[email protected] xcache-3.1.0]# cp xcache.ini /etc/php5.d/
拷贝配置文件
11.[[email protected] xcache-3.1.0]# cd /usr/local/apache/htdocs/
12.[[email protected] htdocs]# vim index.php
访问http://192.168.88.100,进入网页测试下xcache是否加载成功
再进行压力测试!明显增加
ab -n 1000 -c 500 http://192.168.88.100/phpwind