免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 980 | 回复: 0
打印 上一主题 下一主题

apache2.2.2+mysql5.0.22+php5.1.4+memcache+ZendOpti [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-09-27 14:16 |只看该作者 |倒序浏览
CENTOS4.3安装全攻略/** *CENTOS4.3 安装apache2.2.2+mysql5.0.22+php5.1.4+memcache+ZendOptimizer3.0 *阿标 QQ:190885451 Email:biaoest@gmail.com */第一步:安装CentOS4.3 手动分区,作为服务器,特别为服务用途分了一个区,具体一个根目录“/”,一个“/server”,一个是交换分区。 不安装不需要的组件,所以在选择组件的时候,除了选择FTP SERVER外取消所有组件的选择。如果是32位机器的话应该是679M,64位机器为719M。 关闭所有不需要的服务,安装完成后登陆。输入SETUP命令,最后只剩下启动以下几个服务(具体的请参考自己需要启动):crond,iptables,irqbalance(多处理器适用),network,sshd,syslog,vsftpd,xinetd 确定以后重启,就可以利用SSH和FTP服务进行远程管理了。当然你要知道机器的IP,如果是DHCP的话,可以输入命令ifconfig进行查看,如果是固定IP,那就直接登陆了。 第二步:安装服务前的准备:下载httpd-2.2.2.tar.gz:下载mysql-5.0.22.tar.gz:下载php-5.1.4.tar.gz:下载zendoptimizer-3.0.tar.gz:下载libxml2-2.6.26.tar.gz:下载zlib-1.2.3.tar.gz:下载jpegsrc.v6b.tar.gz:下载libpng-1.2.10.tar.gz:下载freetype-2.2.1.tar.gz:下载gd-2.0.33.tar.gz:因为安装系统的时候是最小安装,所以编译服务的时候需要一些软件支持,具体需要以下RPM包,这些都可以在CentOS安装盘里找到:glibc-kernheaders-2.4-9.1.98.EL.x86_64.rpm(在第二张碟)glibc-headers-2.3.4-2.19.x86_64.rpm(在第二张碟)glibc-devel-2.3.4-2.19.x86_64.rpm(在第二张碟)cpp-3.4.5-2.x86_64.rpm(在第一张碟)gcc-3.4.5-2.x86_64.rpm(在第二张碟)libstdc++-devel-3.4.5-2.x86_64.rpm(在第二张碟)gcc-c++-3.4.5-2.x86_64.rpm(在第三张碟)flex-2.5.4a-33.x86_64.rpm(在第二张碟)增加一个用户,以方便通过FTP上传文件,命令如下:useradd biaoest(增加一个名称为biaoest的用户)passwd biaoest(为刚刚增加的用户修改密码)上传文件到biaoest的根目录/home/biaoest,用软件上传的时候注意不要用被动模式,要不感觉会有点慢,把上面需要的文件全部上传。第二步:安装APACHE2.2.2+MYSQL5.0.22+PHP5.1.4+GD2.0.33+ZENDOPTIMIZER3.0安装系统的时候特别为服务相关的软件准备了一个分区,下面为分区server的相关分布:cd /server(服务根目录)mkdir /server/apache2(APACHE2根目录)mkdir /server/modlib(相关模块根目录)mkdir /server/modlib/jpeg6(JPEG目录)mkdir /server/modlib/png(PNG目录)mkdir /server/modlib/gd2(GD目录)mkdir /server/modlib/xml2(XML目录)mkdir /server/mysql5(MYSQL5根目录)mkdir /server/php5(PHP5根目录)mkdir /server/php5/zend(ZENDOPTIMIZER3目录)mkdir /server/database(MYSQL数据库目录)mkdir /server/webroot(网页根目录)下面的安装都是假设当前路径为刚刚上传文件路径/home/biaoest目录。 安装GCC编译器及相关辅助软件rpm -Uvh glibc-kernheaders-2.4-9.1.98.EL.x86_64.rpmrpm -Uvh glibc-headers-2.3.4-2.19.x86_64.rpmrpm -Uvh glibc-devel-2.3.4-2.19.x86_64.rpmrpm -Uvh cpp-3.4.5-2.x86_64.rpmrpm -Uvh gcc-3.4.5-2.x86_64.rpmrpm -Uvh libstdc++-devel-3.4.5-2.x86_64.rpmrpm -Uvh gcc-c++-3.4.5-2.x86_64.rpm####################################################如果没有安装上面软件,可能出现的错误提示:checking for gcc... nochecking for cc... nochecking for cc... nochecking for cl... noconfigure: error: no acceptable C compiler found in $PATHSee `config.log' for more details.####################################################rpm -Uvh flex-2.5.4a-33.x86_64.rpm####################################################如果没有安装上面软件,可能出现的错误提示:checking lex output file root... ./configure: line 3246: lex: command not foundconfigure: error: cannot find output from lex; giving up####################################################安装MYSQL5.0.22到指定目录/server/mysql5,数据保存在/server/databasemkdir /server/mysql5mkdir /server/databasegroupadd mysqluseradd -g mysql mysqlcd /home/biaoesttar -zxvf mysql-5.0.22.tar.gzcd mysql-5.0.22./configure --prefix=/server/mysql5 --sysconfdir=/etc --localstatedir=/server/databasemakemake installcp /server/mysql5/support-files/my-medium.cnf /etc/my.cnf在[mysqld]下加set-variable = max_connections=1000修改/server/database属性chown mysql.mysql /server/database建立数据库/server/mysql5/bin/mysql_install_db --user=mysql启动数据库/server/mysql5/bin/mysqld_safe --user=mysql &设置开机自动运行cp /server/mysql5/share/mysql/mysql.server /etc/rc.d/init.d/mysqldcd /etc/rc.d/init.dchkconfig --add mysqld安装apache2.2.2cd /home/biaoesttar -zxvf httpd-2.2.2.tar.gzcd httpd-2.2.2修改默认连接数vi server/mpm/prefork/prefork.c,查找256,把它修改为2048./configure --prefix=/server/apache2 --enable-module=so --enable-module=rewrite --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache --with-mpm=preforkmakemake install启动apache2/server/apache2/bin/apachectl start设置开机自动启动从/usr/local/apache/bin/apachectl 到 /etc/rc.d/init.d/httpd 建立一个符号连接:# ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd然后在此文件总添加以下几行(大概在文件顶部,约第二行的地方):# chkconfig: 2345 10 90# description: Activates/Deactivates Apache Web Server最后,运行chkconfig把Apache添加到系统的启动服务组里面:# /sbin/chkconfig --del httpd# /sbin/chkconfig --add httpd编辑/etc/rc.d/rc.local把/server/apache2/bin/apachectl start 加入进去安装GD-2.0.33安装ZLIB2cd /home/biaoesttar -zxvf zlib-1.2.3.tar.gzcd zlib-1.2.3./configure#################################################不要用--prefix自定义安装目录,否则可能会影响后面安装,可能出现的错误:configure: error: zlib not installed##################################################################################################如果你的机器是64位,并且在安装png时候出现下面错误:/usr/bin/ld: /usr/local/lib/libz.a(compress.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC/usr/local/lib/libz.a: could not read symbols: Bad valuecollect2: ld returned 1 exit status修补办法(接上面步骤):vi Makefile找到 CFLAGS=-O3 -DUSE_MMAP在后面加入-fPIC,即变成CFLAGS=-O3 -DUSE_MMAP -fPIC接下面步骤#################################################makemake install安装JPEG6#################################################先建立目录,否则可能会出现类型下面错误:/usr/bin/install -c cjpeg /server/apache2/modlib/jpeg6/bin/cjpeg/usr/bin/install: cannot create regular file `/server/apache2/modlib/jpeg6/bin/cjpeg': No such file or directorymake: *** [install] Error 1解决办法:mkdir /server/apache2/modlibmkdir /server/apache2/modlib/jpeg6 mkdir /server/apache2/modlib/jpeg6/bin mkdir /server/apache2/modlib/jpeg6/lib mkdir /server/apache2/modlib/jpeg6/include mkdir /server/apache2/modlib/jpeg6/man mkdir /server/apache2/modlib/jpeg6/man/man1 #################################################cd /home/biaoesttar -zxvf jpegsrc.v6b.tar.gzcd jpegsrc.v6b../configure --prefix=/server/apache2/modlib/jpeg6#################################################如果你的机器是64位,并且在安装gd时候出现下面错误:/usr/bin/ld: /server/apache2/modlib/jpeg6//lib/libjpeg.a(compress.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC/server/apache2/modlib/jpeg6//lib/libjpeg.a: could not read symbols: Bad valuecollect2: ld returned 1 exit statusmake[2]: *** [libgd.la] Error 1修补办法(接上面步骤):vi Makefile找到 CFLAGS= -O2 -I$(srcdir) 在后面加入-fPIC,即变成CFLAGS= -O2 -I$(srcdir) -fPIC接下面步骤#################################################makemake install-lib#################################################特别注意,要不下面会出现错误:configure: error: libjpeg.(a|so) not found.#################################################make install安装PNGcd /home/biaoesttar -zxvf libpng-1.2.10.tar.gzcd libpng-1.2.10./configure --prefix=/server/apache2/modlib/pngmake################################################如果出现下面错误:configure: error: zlib not installed请回到zlib,重新安装一次,最好先make clean################################################make install安装freetypecd /home/biaoesttar -zxvf freetype-2.2.1.tar.gzcd freetype-2.2.1./configure --prefix=/server/apache2/modlib/freetypemakemake install安装GDcd /home/biaoesttar -zxvf gd-2.0.33.tar.gzcd gd-2.0.33./configure --prefix=/server/apache2/modlib/gd2 --with-jpeg=/server/apache2/modlib/jpeg6/ --with-png=/server/apache2/modlib/png/ --with-zlib --with-freetype=/server/apache2/modlib/freetype/make#################################################如果出现下面错误:gd_png.c:825: warning: data definition has no type or storage classmake[2]: *** [gd_png.lo] Error 1修复方法:找到CPPFLAGS = -I/server/apache2/modlib/freetype/include/freetype2 -I/server/apache2/modlib/freetype/include -I/server/apache2/modlib/freetype//include  -I/server/apache2/modlib/jpeg6//include原来是少了png的支持了,把它改为CPPFLAGS = -I/server/apache2/modlib/freetype/include/freetype2 -I/server/apache2/modlib/freetype/include -I/server/apache2/modlib/png/include  -I/server/apache2/modlib/jpeg6/include#################################################make install安装LIBXML2mkdir /server/apache2/modlibtar -zxvf libxml2-2.6.26.tar.gzcd libxml2-2.6.26./configure --prefix=/server/apache2/modlib/xml2make make install安装PHP5.1.4cd /home/biaoesttar -zxvf php-5.1.4.tar.gzcd php-5.1.4./configure --prefix=/server/php5 \--with-mysql=/server/mysql5 \--with-apxs2=/server/apache2/bin/apxs \--with-libxml-dir=/server/apache2/modlib/xml2 \--with-gd=/server/apache2/modlib/gd2 \--with-jpeg-dir=/server/apache2/modlib/jpeg6 \--with-zlib \--with-png-dir=/server/apache2/modlib/png \--with-freetype-dir=/server/apache2/modlib/freetype \--enable-experimental-zts \#################################################如果出现错误:checking lex output file root... ./configure: line 3246: lex: command not foundconfigure: error: cannot find output from lex; giving up修补方法,安装FLEX:rpm -Uvh flex-2.5.4a-33.x86_64.rpm################################################如果又出现下面错误:configure: error: libjpeg.(a|so) not found.修补方法:原来在安装jpeg的时候,执行了make install,应该执行make install-lib才能生成libjpeg.a文件################################################makemake install复制配置文件到相应的目录cp php.ini-dict /server/php5/lib/php.ini配置/server/apache2/conf/httpd.conf找到DocumentRoot "/server/apache2/htdocs" ,修改为DocumentRoot "/server/webroot"找到 ,修改为找到DirectoryIndex index.html,增加index.php等等,变成DirectoryIndex index.html index.htm index.php index.phtml index.phps加载php模块,去掉注释“#”,如没有此行,请加上。LoadModule php5_module        modules/libphp5.so加上此两行AddType application/x-httpd-php .php .phtmlAddType application/x-httpd-php-source .phpsset-variable = max_connections=100安装ZendOptimizer-3.0.0cd /home/biaoesttar -zxvf ZendOptimizer-3.0.0-linux-glibc23-x86_64.tar.gzcd ZendOptimizer-3.0.0-linux-glibc23-x86_64./install然后就按照提示给出相应的路径即可安装MEMCACHEDtar -xzf libevent-1.1a.tar.gzcd libevent-1.1a./configure --prefix=/usrmakemake installcd ..tar -xzf memcached-1.1.12.tar.gzcd memcached-1.1.12./configure --prefix=/usrmakemake install启动MEMCHED/usr/bin/memcached -d -m 128 -p 11211 -u nobody########################################################################/usr/bin/memcached: error while loading shared libraries: libevent-1.1a.so.1: cannot open shared object file: No such file or directorycp /usr/lib/libevent* /usr/lib64/ -R #########################################################################安装memcache PHP模块tar vxzf memcache-2.0.4.tgzcd memcache-2.0.4/server/php5/bin/phpize./configure --enable-memcache --with-php-config=/server/php5/bin/php-config --with-zlib-dirmakemake install安装完后会有类似这样的提示:Installing shared extensions: /server/php5/lib/php/extensions/no-debug-non-zts-20050922/把这个记住,然后修改php.ini,把extension_dir = "./"修改为extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20050922/"并添加一行extension=memcache.so安装完毕,该测试了,建立一个专门的web用户,用于上传网页吧。useradd -d /server/webroot webpasswd webchown web /server/webroot参考文章:(Linux+Apache+Mysql+PHP典型配置)http://www.5ilinux.com/blog/archives/000013.html(Linux下安装最新Apache2.0.52+PHP5+GD2+MySQL等)http://support.iap.ac.cn/portal/viewarticle.php?id=839(RedHat linux AS 4+Apache2.2+MYSQL5.0.17+PHP5.1.1)http://bbs.chinaunix.net/viewthread.php?tid=694641&extra=page%3D1(PHP & memcached )http://nio.infor96.com/php-memcached/

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/41660/showart_1227204.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP