性能测试基本功 - Centos5.5下安装LAMP
下载软件包(截至2010/7/25软件为最新稳定版本)
http://www.libgd.org/releases/gd-2.0.35.tar.gz
ftp://xmlsoft.org/libxml2/libxml2-2.7.7.tar.gz
http://ftp.devil-linux.org/pub/devel/sources/1.2/libmcrypt-2.5.8.tar.bz2
http://cronolog.org/download/cronolog-1.6.2.tar.gz
http://labs.renren.com/apache-mirror/httpd/httpd-2.2.15.tar.gz
http://gd.tuwien.ac.at/db/mysql/Downloads/MySQL-5.1/mysql-5.1.49.tar.gz
http://cn.php.net/distributions/php-5.2.14.tar.gz
http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz
http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
保存为down.txt
# cd /usr/local/src
# wget -i down.txt
fonts-chinese-3.02-9.6.el5.noarch.rpm
fonts-ISO8859-2-75dpi-1.0-17.1.noarch.rpm
二、编译安装基本环境
1. 安装准备
1) 系统约定
操作系统:Centos5.5 i386
IP:192.168.1.103
软件源代码包存放位置 /usr/local/src
源码包编译安装位置(prefix) /usr/local/software_name
脚本以及维护程序存放位置 /usr/local/sbin
MySQL 数据库位置 /data/mysql/data(可按情况设置)
这几步可以放到脚本里面安装
vim install_1.sh
查到CPU的参数为
64 bit profile (amd64) for < GCC 4.3
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CXXFLAGS="${CFLAGS}"
Core 2 Duo/Quad, Xeon 51xx/53xx/54xx, Pentium Dual-Core T23xx+/Exxxx, Celeron Dual-Core
32 bit profile (x86):
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=prescott -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
tar -zxvf mysql-5.1.49.tar.gz
cd mysql-5.1.49
修改mysql的最大连接数,默认是100
vim sql/mysqld.cc
搜索max_connections,找到REQUIRED_ARG后面的100,改成1500,当然小点也可以,根据你的需要来,不建议改的太大,然后保存
vim install_mysql.sh
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CXXFLAGS="${CFLAGS}"
./configure \
"--prefix=/usr/local/mysql" \
"--localstatedir=/data/mysql/data" \
"--with-comment=Source" \
"--with-server-suffix=-hx10" \
"--with-mysqld-user=mysql" \
"--without-debug" \
"--with-big-tables" \
"--with-charset=gbk" \
"--with-collation=gbk_chinese_ci" \
"--with-extra-charsets=all" \
"--with-pthread" \
"--enable-static" \
"--enable-thread-safe-client" \
"--with-client-ldflags=-all-static" \
"--with-mysqld-ldflags=-all-static" \
"--enable-assembler" \
"--without-isam" \
"--without-innodb" \
"--without-ndb-debug"
make && make install
mkdir -p /data/mysql/data
useradd mysql -d /data/mysql -s /sbin/nologin
/usr/local/mysql/bin/mysql_install_db --user=mysql
cd /usr/local/mysql
chown -R root:mysql .
chown -R mysql /data/mysql/data
cp share/mysql/my-huge.cnf /etc/my.cnf
cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
chmod 755 /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
/etc/rc.d/init.d/mysqld start
cd /usr/local/mysql/bin
for i in *; do ln -s /usr/local/mysql/bin/$i /usr/bin/$i; done
然后执行脚本 sh install_mysql.sh
# mysql -u root -p
mysql> select version();
+----------------------+
| version() |
+----------------------+
| 5.1.49-hx10-log |
+----------------------+
1 row in set (0.00 sec)
mysql>
6)安装apache
groupadd httpd
useradd -g httpd -s /sbin/nologin -M httpd
tar -zxvf httpd-2.2.15.tar.gz
cd httpd-2.2.15
vim install_httpd.sh
./configure \
"--prefix=/usr/local/apache2" \
"--with-included-apr" \
"--enable-so" \
"--enable-deflate=shared" \
"--enable-expires=shared" \
"--enable-rewrite=shared" \
"--enable-static-support" \
"--disable-userdir"
make
make install
cd ..
exit
# sh install_httpd.sh
7)安装php
tar -zxvf php-5.2.14.tar.gz
cd php-5.2.14
vim install_php.sh
mkdir -p /usr/local/php/etc
./configure \
"--prefix=/usr/local/php" \
"--with-apxs2=/usr/local/apache2/bin/apxs" \
"--with-config-file-path=/usr/local/php/etc" \
"--with-mysql=/usr/local/mysql" \
"--with-libxml-dir=/usr/local/libxml2" \
"--with-gd=/usr/local/gd2" \
"--with-jpeg-dir" \
"--with-png-dir" \
"--with-bz2" \
"--with-freetype-dir" \
"--with-iconv-dir" \
"--with-zlib-dir " \
"--with-openssll" \
"--with-mcrypt=/usr/local/libmcrypt" \
"--enable-soap" \
"--enable-gd-native-ttf" \
"--enable-ftp" \
"--enable-mbstring" \
"--enable-exif" \
"--disable-ipv6" \
"--disable-cgi" \
"--disable-cli"
make
make install
cp php.ini-dist /usr/local/php/etc/php.ini
#sh install_php.sh
7)安装Xcache
tar -zxvf xcache-1.3.0.tar.gz
cd xcache-1.3.0
/usr/local/php/bin/phpize \
./configure --enable-xcache \
--enable-xcache-coverager \
--with-php-config=/usr/local/php/bin/php-config \
--enable-inline-optimization --disable-debug
vim /usr/local/php/etc/php.ini
在最后添加以下内容
[xcache-common]
zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/xcache.so
[xcache.admin]
xcache.admin.user = "admin"
;create md5 password: echo -n "password"| md5sum
xcache.admin.pass = "f3dfd37a03b1356d6380b41e524f903b" #password is hx10.com
[xcache]
; Change xcache.size to tune the size of the opcode cache
xcache.size = 24M
xcache.shm_scheme = "mmap"
xcache.count = 4
xcache.slots = 8K
xcache.ttl = 0
xcache.gc_interval = 0
; Change xcache.var_size to adjust the size of variable cache
xcache.var_size = 8M
xcache.var_count = 1
xcache.var_slots = 8K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
xcache.test = Off
xcache.readonly_protection = On
xcache.mmap_path = "/tmp/xcache"
xcache.coredump_directory = ""
xcache.cacher = On
xcache.stat = On
xcache.optimizer = Off
[xcache.coverager]
xcache.coverager = On
xcache.coveragedump_directory = ""
8)安装Zend Optimizer
tar -zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
mv ZendOptimizer-3.3.9-linux-glibc23-i386 /usr/local/Zend
cp /usr/local/Zend/data/5_2_x_comp/ZendOptimizer.so /usr/local/Zend/ (因为php是5.2)
vim /usr/local/php/etc/php.ini 最后一行加入以下内容
zend_optimizer.optimization_level=15
zend_extension=/usr/local/Zend/ZendOptimizer.so
9)整合Apache与PHP及系统初化配置
vim /usr/local/apache2/conf/httpd.conf
查找AddType application/x-gzip .gz .tgz,在该行下面添加
AddType application/x-httpd-php .php
查找DirectoryIndex index.html 把该行修改成
DirectoryIndex index.html index.htm index.php
找到
#Include conf/extra/httpd-mpm.conf
#Include conf/extra/httpd-info.conf
#Include conf/extra/httpd-vhosts.conf
#Include conf/extra/httpd-default.conf
去掉这4行前面的#
注意:以上 4 个扩展配置文件中的设置请按照相关原则进行合理配置!
vim /usr/local/apache2/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin webmaster@hx10.com
DocumentRoot "/www/wwwroot/"
ServerName mail.520.com
ServerAlias www.dummy-host.example.com
ErrorLog "logs/dummy-host.example.com-error_log"
CustomLog "logs/dummy-host.example.com-access_log" common
</VirtualHost>
新建一个虚拟主机
mkdir -p /www/wwwroot/
然后把探针(http://depoch.net/download.htm)放到这个目录
vim /usr/local/apache2/conf/httpd.conf
找到
<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all //把这里的Deny改成Allow
</Directory>
找到
#ServerName www.example.com:80 在这一行后面加入下面一行
ServerName 127.0.0.1:80
找到
User daemon
Group daemon
把原来的daemon修改成httpd
Apache 运行账户 httpd:httpd
chown -R httpd:httpd /www/wwwroot
重启apache
# /usr/local/apache2/bin/apachectl restart
输入探针的地址访问
http://ip/php.php
10)安全和性能优化
vim /usr/local/php/etc/php.ini
查找disable_functions =
等号后面加入以下参数,注意不能换行
phpinfo,passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,
ini_alter,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,get_cfg_var
查找以下2项,把on改成off
expose_php = Off
display_errors = Off
vim /usr/local/apache2/conf/extra/httpd-default.conf 修改后的内容如下
Timeout 15
KeepAlive Off
MaxKeepAliveRequests 50
KeepAliveTimeout 5
UseCanonicalName Off
AccessFileName .htaccess
ServerTokens Prod
ServerSignature off
HostnameLookups Off
vim /usr/local/apache2/conf/extra/httpd-mpm.conf 修改一个模块后的内容如下
原来的配置如下:
<IfModule mpm_prefork_module>
ServerLimit 256
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 256
MaxRequestsPerChild 0
</IfModule>
修改后配置如下
<IfModule mpm_prefork_module>
ServerLimit 2000
StartServers 10
MinSpareServers 10
MaxSpareServers 15
MaxClients 2000
MaxRequestsPerChild 10000
</IfModule>
查看是什么模式
/usr/local/apache2/bin/apachectl -l
如果出现prefork.c那就说明是prefork模式
关于详细的参数调整,查看http://zhengdl126.javaeye.com/blog/450620
11)将apache,mysql安装为系统服务
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
#cd /etc/rc.d/init.d
#vi /etc/rc.d/init.d/httpd
添加以下两行内容(在#!/bin/sh下面)
# chkconfig: 2345 10 90
# description: Activates/Deactivates Apache Web Server
最后,运行chkconfig 把Apache 添加到系统的启动服务组里面:
# chkconfig --add httpd
# chkconfig httpd on
mysql前面已经加入到服务启动,不需要此步骤
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
cd /etc/rc.d/init.d
chkconfig --add mysqld //ntsysv检查Mysql是否已经加载到服务启动
service mysqld start/stop
/usr/local/mysql/bin/mysqladmin -uroot -p shutdown //关闭mysql
转载于:https://www.cnblogs.com/preftest/archive/2011/05/26/2057975.html
性能测试基本功 - Centos5.5下安装LAMP相关推荐
- Centos5.5下安装LAMP完整版
Centos5.5(32bit) Author:hx10 Date: 2010/7/25 hangzhou Blog :http://hi.baidu.com/hx10 转载:http://hx10 ...
- centos6.5 安装php探针,Centos5.5下安装LAMP完整版
冰鱼客:以下保存为web.config|@|<?xml version="1.0" encoding="UTF-8"?>|@||@| |@||@| ...
- CentOS5.6下安装Oracle10G软件 【保留报错经验】
CentOS5.6下安装Oracle10G ****************************************************************************** ...
- 服务器安装centos5.5下安装samba服务器以及windows访问samba服务器
最近使用开发的进程中出现了一个小问题,顺便记录一下原因和方法--服务器安装 windows下,想必大家都用过同享功能吧,的确很便利,直接把文件放在同享目录下即可. 那Linux下是如何实现这种同享功能 ...
- ubuntu下安装lamp环境
一.安装 1. 首先安装SSH sudo apt-get install ssh 2.安装MySQL(虽然现在最新版为5.1,但是还只能装5.0版本) sudo apt-get install mys ...
- linux 升级mysql版本 lamp_Linux 下安装 LAmp及配置
第一步:配置防火墙(默认情况下,端口80和3306是拒绝访问的,在防火墙上进行配置): vi /etc/sysconfig/iptables(在"COMMIT"的上一行加上如下两句 ...
- Ubuntu下安装LAMP及phpmyadmin
出处:http://www.cnblogs.com/ubuntubox/archive/2011/04/07/2008258.html 关于Ubuntu下的LAMP配置,已经成为了某一些人的心病,加上 ...
- Linux之Debian下安装LAMP apt-get安装方式
1.安装编译环境 apt-get install build-essential 2.安装Mysql apt-get install mysql-server 3.安装apache apt-get i ...
- CentOS5.4下安装短信猫
为了能及时知道网站的运行情况,我打算给我们服务器上一套监控系统,在网站出现问题后,及时的通知我,初步打算采用邮件,短信,msn这三种方式,今天我们这篇文章主要是讲linux下短信猫的安装. 硬件环境: ...
- Deepin 下安装 LAMP
ubuntu/deepin linux 下使用 apt-get 安装所需套的软件 LAMP 1. 安装 apacache2 apt-get install apache2 配置文件:/etc/apac ...
最新文章
- 【数据结构】HashMap 面试题8问
- VisualSvn Server介绍
- 什么是java一句话一个例子_一句话讲清楚什么是JavaEE
- oracle:平均分大于78的女同学的学号、姓名、平均分
- 自执行匿名函数剖析整理
- lucene使用3.0.3_Apache Lucene 5.0.0即将发布!
- 有驾照不等于会开车,教你开车技巧27招
- python 判断数据类型,是否与已知相同
- mysql索引别名_Mysql索引知识详谈
- Objective-C的对象模型
- Python中.mat文件的读写操作
- win10系统安装loadrunner11提示“为了对电脑进行保护,已经阻止此应用”的解决方案
- win10系统文件拖拽卡顿_如何解决Win10鼠标拖动窗口有延迟?
- 2014年11月合肥黄山宏村之旅
- 罗格斯的计算机科学博士奖学金,罗格斯大学cs
- linux中设置中英文语言
- “当前不会命中断点。还没有为该文档加载任何符号“解决方案
- 天星数科首页CSS布局回顾
- ARCGIS中某字段递增赋值,如1,2,3,4,
- 自由地思考——保护思想环境
热门文章
- Linux 命令之 yum 软件仓库
- Linux CentOS 7.2 安装 Tomcat 8 服务器
- 阶段3 2.Spring_06.Spring的新注解_8 spring整合junit完成
- 阶段1 语言基础+高级_1-3-Java语言高级_09-基础加强_第2节 反射_6_反射_获取字节码Class对象的三种方式...
- ZT:Linux上安装JDK,最准确
- 限制用户不能删除SharePoint列表中的条目(项目)
- tinymce 编辑器 上传图片
- tomcat开启远程调试
- 50多条mysql数据库优化建议
- 使用curses管理基于文本的屏幕--(三)