红帽不注册,yum方法:
查看yum包
rpm -qa|grep yum
卸载之
rpm -qa|grep yum|xargs rpm -e –nodeps
下载对应的yum包,...为机器型号
http://centos.ustc.edu.cn/centos/5/os/.../CentOS/yum-3.2.22-26.el5.centos.noarch.rpm
http://centos.ustc.edu.cn/centos/5/os/.../CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm
http://centos.ustc.edu.cn/centos/5/.../CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
并且安装之
rpm -ivh yum-*
注意:yum和yum-fastestmirror相互依赖,所以同时安装即可。
下载yum的配置源
wget http://www.linuxidc.com/files/2011/05/06/CentOS-Base.repo 下载到 /etc/yum.repos.d/ 目录下面
运行yum makecache生成缓存
1. MySQL
(1). rpm安装:rpm -ivh MySQL-shared-5.6.11-1.rhel5.x86_64.rpm
rpm卸载:rpm -e MySQL-shared
rpm查看:rpm -aq
a. MySQL-server-5.6.10-1.rhel5.x86_64.rpm
b. MySQL-client-5.6.10-1.rhel5.x86_64.rpm
c. MySQL-devel-5.6.10-1.rhel5.x86_64.rpm
d. MySQL-shared-5.6.11-1.rhel5.x86_64.rpm
(2). cp /usr/share/mysql/my-default.cnf /etc/my.cnf
(3). 如果出现InnoDB的ibdata1错误,根据错误日志,vi /etc/my.cnf
添加innodb_data_file_path = ibdata1:10M:autoextend
2. Apache2安装
./configure --enable-lib64 -libdir=/usr/lib64 --enable-cache --enable-cache-disk --with-pcre=/usr/local --enable-ssl --with-ssl=/usr/ --with-libxml2=/usr --enable-so --enable-expires --enable-rewrite
make;make install
自动启动:
(1). cp apachectl /etc/init.d/apache
(2). vi /etc/init.d/apache
在!/bin/sh后面添加chkconfig识别标志,345为启动级别,10和70为关闭和启动顺序。
#chkconfig: 345 10 70
#description: Start and stop the Apache HTTP Service.
(3). chkconfig --add apache
3. PHP5.4.14安装
(1) tar -xvf php-5.4.14.tar.bz2
(2). ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/ --with-libxml-dir=/usr/ --with-gd=/usr --with-jpeg-dir=/usr/ --with-png-dir=/usr/ --with-png-dir=/usr/ --with-zlib-dir=/usr/lib64/ --with-freetype-dir=/usr/ --with-curl=/usr --enable-soap --with-xsl=/usr --enable-sockets --enable-mbstring --enable-soap
(3). make; make install
(4). cp php.ini-product /usr/local/lib/php.ini
4. 配置Apache2和PHP
(1). vi/usr/local/apache2/conf/httpd.conf 打开配置文件,/AddType找到AddType,添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
:wq保存退出(windows也一样添加)
(2). opcode缓存apc
tar -xvf APC-3.1.9.tgz
cd APC-3.1.9
/usr/local/bin/phpize
./configure --enable-apc --with-apc-mmap
make; make install
编辑php.ini
添加配置信息
[apc]
extension=apc.so
apc.cache_by_default=1
apc.enabled=1
apc.shm_segments=1
apc.shm_size=128M
apc.ttl=0
apc.user_ttl=7200
apc.num_files_hint=1000
apc.write_lock=1
apc.stat=0
apc.maxfile_size=1M
(3) mod_cache配置
<IfModule mod_cache.c>
CacheDefaultExpire 3600
CacheMaxExpire 86400
CacheLastModifiedFactor 0.1
<IfModule mod_cache_disk.c>
CacheRoot "D:/Program Files/Apache Software Foundation/Apache2.2/cache/"
CacheEnable disk /
CacheDirLevels 5
CacheDirLength 3
CacheMaxFileSize 10000000
CacheMinFileSize 1
</IfModule>
</IfModule>
(4) xdebug配置
linux安装
pecl install xdebug
php.ini添加
[Xdebug]
zend_extension="/usr/local/lib/php/extensions/no-debug-zts-20100525/xdebug.so"(linux)
zend_extension="D:\Program Files\PHP\ext\php_xdebug.dll"(windows)
xdebug.profiler_output_dir="D:\Program Files\PHP\xdebug"
xdebug.profiler_enable=On
xdebug.profiler_enable_trigger=1
xdebug.default_enable=On
xdebug.show_exception_trace=On
xdebug.show_local_vars=1
xdebug.max_nesting_level=50
xdebug.var_display_max_depth=6
xdebug.dump_once=On
xdebug.dump_globals=On
xdebug.dump_undefined=On
xdebug.dump.REQUEST=*
xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT
xdebug.trace_output_dir="D:\Program Files\PHP\xdebug"
xdebug.trace_output_dir=/usr/local/apache2/xdebug(linux)
注意linux目录要daemon有执行权限chown daemon /usr/local/apache2/xdebug
查看调试文件
下载WinCacheGrind(windows)\kcachegrind(linux)工具
tar -zxf kcachegrind-0.4.6.tar.gz
cd kcachegrind-0.4.6
由于kcachegrind依赖于kde,所以需要先安装kde相关的库:
yum install kdebase-devel
然后再进行安装,注意configure时要制定qt的路径,否则会报checking for Qt... configure: error: Qt (>= Qt 3.0) (headers and libraries) not found错误:
./configure --prefix=`kde-config --prefix`
make && make install
安装完成后在命令行下运行kcachegrind 即可