Linux下web服务器环境搭建.docx

上传人:牧羊曲112 文档编号:2011925 上传时间:2022-12-31 格式:DOCX 页数:12 大小:147.72KB
返回 下载 相关 举报
Linux下web服务器环境搭建.docx_第1页
第1页 / 共12页
Linux下web服务器环境搭建.docx_第2页
第2页 / 共12页
Linux下web服务器环境搭建.docx_第3页
第3页 / 共12页
Linux下web服务器环境搭建.docx_第4页
第4页 / 共12页
Linux下web服务器环境搭建.docx_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《Linux下web服务器环境搭建.docx》由会员分享,可在线阅读,更多相关《Linux下web服务器环境搭建.docx(12页珍藏版)》请在三一办公上搜索。

1、RedHat Linux AS 4下整合安装mysql-5.1.37、apache-2.2.13、php-5.3.0与zendoptions并支持GD库以下所有操作请注意是在root账号权限下执行。一、准备工作:首先查看系统中是否已经安装了GD环境:rootlocalhost #rpm -qa | grep zlibrootlocalhost #rpm -qa | grep libpngrootlocalhost #rpm -qa | grep freetyperootlocalhost #rpm -qa | grep jpegrootlocalhost #rpm -qa | grep gd如

2、果没有安装的话,可以按照下面的步骤手动安装:1.1 安装zlibrootlocalhost #tar zxvf zlib-1.2.2.tar.gzrootlocalhost #cd zlib-1.2.2rootlocalhost #./configurerootlocalhost #makerootlocalhost #make install1.2 安装libpngrootlocalhost #tar zxvf libpng-1.2.7.tar.tarrootlocalhost #cd libpng-1.2.7rootlocalhost #cd scripts/rootlocalhost #

3、mv makefile.linux ./makefilerootlocalhost #cd .rootlocalhost #makerootlocalhost #make install注意,这里的makefile不是用./configure生成,而是直接从scripts/里复制一个。1.3 安装freetyperootlocalhost #tar zxvf freetype-2.1.9.tar.gzrootlocalhost #cd freetype-2.1.9rootlocalhost #./configurerootlocalhost #makerootlocalhost #make i

4、nstall/quote1.4 安装Jpegrootlocalhost #tar zxvf jpegsrc.v6b.tar.gzrootlocalhost #cd jpeg-6b/rootlocalhost #./configure -enable-sharedrootlocalhost #makerootlocalhost #make testrootlocalhost # make install 注意:这里configure一定要带-enable-shared参数,不然,不会生成共享库1.5安装GDrootlocalhost #tar zxvf gd-2.0.33.tar.gzrootl

5、ocalhost # cd gd-2.0.33rootlocalhost # ./configure -with-png -with-freetype -with-jpegrootlocalhost # make install二、安装mysql2.1解压缩rootlocalhost # unzip mysql-5.1.37.zip rootlocalhost # cd mysql-5.1.372.2创建MYSQL用户和组rootlocalhost mysql-5.1.37# groupadd mysqlrootlocalhost mysql-5.1.37# useradd -g mysql

6、mysql2.3编译前配置mysql 安装路径为/usr/local/mysqlrootlocalhost mysql-5.1.37#./configure -prefix=/usr/local/mysql 2.4开始编译rootlocalhost mysql-5.1.37# make2.5安装rootlocalhost mysql-5.1.37# make install2.6数据库初始化相关操作rootlocalhost mysql-5.1.37# cd scripts/rootlocalhost scripts# ./mysql_install_db -user=mysqlrootloc

7、alhost scripts# cp ./support-files/my-f /etc/f编辑/etc/f,加入下面一行内容:user = mysql 更改部分目录权限,增强安全性。rootlocalhost scripts# chown -R root /usr/local/mysql/rootlocalhost scripts# chown -R mysql /usr/local/mysql/varrootlocalhost scripts# chgrp -R mysql /usr/local/mysql/编辑/etc/ld.so.conf并加入以下两行:rootlocalhost sc

8、ripts# vi /etc/ld.so.conf/usr/local/mysql/lib/mysql/usr/local/lib编辑完后载入库rootlocalhost scripts# ldconfig -v2.7启动数据库rootlocalhost scripts# cd /usr/local/mysql/bin/ rootlocalhost bin# ./mysqld_safe -user=mysql &2.8设置数据库root密码rootlocalhost bin# mysqladmin -u root password new password 注意“password”和newpa

9、ssword之间必须有空格。2.9测试安装结果,可有可无的一步*rootlocalhost bin# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or g.Your MySQL connection id is 5 to server version: 5.1.37-logType help; or h for help. Type c to clear the buffer.mysql use mysqlDatabase changed*当你看到以上内容的时候,恭喜你,数据库

10、已经安装成功了。三、安装apache3.1解压缩rootlocalhost #tar -zxvf httpd-2.2.13.tar.gz rootlocalhost #cd httpd-2.2.13 3.2配置安装路径和加载方式,在此选择动态加载方式,以便节约系统资源。rootlocalhost httpd-2.2.13#./configure -prefix=/usr/local/apache -enable-module=so3.3编译rootlocalhost httpd-2.2.13# make3.4安装rootlocalhost httpd-2.2.13# make install

11、3.5测试apacherootlocalhost httpd-2.2.13#/usr/local/apache/bin/apachectl start &rootlocalhost bin# ps -A | grep httpd*17971 ? 00:00:00 httpd17972 ? 00:00:00 httpd17973 ? 00:00:00 httpd17974 ? 00:00:00 httpd17975 ? 00:00:00 httpd17976 ? 00:00:00 httpd*安装apache是整个过程中最简单的,当你看到以上内容的时候表明你的apache已经安装成功了,。下面继

12、续安装PHP,安装完php后再配置apache。四、安装PHP4.1解压缩rootlocalhost # tar -zxvf php-5.3.0.tar.gz 4.2配置PHP安装路径 apache路径和mysql路径,其他内容为支持GD库的配置,如果还需要扩展其他功能的话可以继续添加,不是必要的功能尽量不要安装,减少出现安全漏洞的机会。rootlocalhost # cd php-5.3.0rootlocalhost php-5.3.0# ./configure -prefix=/usr/local/php -with-mysql=/usr/local/mysql -with-apxs2=/

13、usr/local/apache/bin/apxs with -gd -enable-gd-native-ttf -enable-gd-jis-conv -with-freetype-dir -with-jpeg-dir -with-png-dir -with-zlib -enable-xml -enable-mbstring 注意:一行写不开时,请在行尾加上 ”换行,不想一点点敲入,复制粘贴时请先粘贴到记事本中去掉格式。如果没错误的话,你将会看到以下内容。*+-+| License: | This software is subject to the PHP License, availab

14、le in this | distribution in the file LICENSE. By continuing this installation | process, you are bound by the terms of this license agreement. | If you do not agree with the terms of this license, you must abort | the installation process at this point. |+-+Thank you for using PHP.*4.3编译rootlocalho

15、st php-5.3.0# make编译完成后可以运行一下make test看看是否有被忽略的错误。rootlocalhost php-5.3.0# make test4.4安装rootlocalhost php-5.3.0# make install五、安装完php后开始配置apache编辑apache的配置文件httpd.confrootlocalhost php-5.3.0vi /usr/local/apahe/conf/httpd.conf5.1加上AddType application/x-httpd-php .php /让apache将后缀为.php的文件交给PHP处理。5.2找到

16、DirectoryIndex一行修改为:DirectoryIndex index.htm index.php index.html5.3找到Options Index FollowSymLinks一行修改为: Options FollowSymLinks /出于安全性考虑,一般不显示目录文件列表。5.4找到以下两行,修改默认文档存放的位置:DocumentRoot /var/www/html5.5其他设置,如:修改默认服务端口、绑定IP等请参阅apache详细配置文档。重启mysql、apache在/var/www/html下建一个phpinfo.php文件输入用浏览器打开http:/serv

17、er ip/phpinfo.php测试是否安装成功。六、安装zend options注意:本次安装使用的PHP5.3为较新版本,zendOptimizer-3.3.3并不支持,所以在安装完后,看不到zendOptimize安装成功信息,以下只是演示安装过程。rootlocalhost # tar -zxvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz rootlocalhost # cd ZendOptimizer-3.3.3-linux-glibc23-i386rootlocalhost ZendOptimizer-3.3.3-linux-gl

18、ibc23-i386# rootlocalhost ZendOptimizer-3.3.3-linux-glibc23-i386# ./install.sh按照提示一路yes就行了,zend options 安装界面做的很友好。到此安装过程已基本上结束,当然还有许多后续的优化工作需要做,在此暂不详述了。2009年8月11日 原创fc6+apache+mysql+php+gd环境安装经过了2天的实验与总结,fc6+apache+mysql+php+gd环境总算是告一段落了,我一共安装了3次,第三次成功了,其中要说的是在每次安装的过程中都会遇到一些之前没有遇到的问题,所以发了很多时间来分析,网上的

19、一些方法中有一些不是很正确,所以造成了一些错误,下面就把自己安装成功的方法与大家分享!希望对需要这个环境的人有所帮助! 其中如有错误还望指证!一.环境所用到软件及下载地址:apache-2.2.4http:/archive.apache.org/dist/httpd/httpd-2.2.4.tar.gzmysql-5.0.22 . l-5.0.22-0.i386.rpm . r-5.0.22-0.i386.rpm . t-5.0.22-0.i386.rpmphp-5.2.1ZendOptimizer-3.2.8 . glibc21-i386.tar.gzGD-2.0.34http:/www.l

20、ibgd.org/releases/gd-2.0.34.tar.gzGD库支持libpng-1.2.18: . ibpng-1.2.18.tar.gzlibxpm-3.5.5:freetype-2.3.4:http:/download.savannah.gnu.org . eetype-2.3.4.tar.gzjpeg6:ftp:/zlib-1.2.3:libxml-2.6.29ftp:/xmlsoft.org/libxml2/libxml2-2.6.29.tar.gz二,安装步骤前言:为了更好的管理服务器,最好是把它装在一个统一的目录,我的是除了mysql按默认的目录,其它都装在/usr/l

21、ocal目录下此时需要在local下建立以下目录:zlib,php,apache,freetype,gd,jpeg6,libpng,libxml,libXpm1.安装Apachetar xzvf httpd-2.2.4.tar.gzcd httpd-2.2.4./configure -prefix=/usr/local/apache -enable-somakemake install(把/usr/local/apache/bin/httpd拷到/usr/sbin目录下,方便以后启动apache服务器)启动service httpd start2.安装MySQLrpm -ivh MySQL-d

22、evel-5.0.22-0.i386.rpmrpm -ivh MySQL-server-5.0.22-0.i386.rpmrpm -ivh MySQL-client-5.0.22-0.i386.rpm3.安装GD安装libXpmtar -zxf libXpm-3.5.5.tar.bz2cd libXpm-3.5.5./configure -prefix=/usr/local/libxpmmake make install安装libxmltar -zxf libxml2-2.6.29.tar.gzcd libxml2-2.6.29./configure -prefix=/usr/local/li

23、bxmlmake make install安装zlibtar -jxf libxml2-2.6.29.tar.gzcd libxml2-2.6.29./configure -prefix=/usr/local/zlibmake make install安装jpegtar -zxf jpegsrc.v6b.tar.gzcd jpegsrc.v6b./configure -prefix=/usr/local/jpeg6make make install安装freetypetar -zxf freetype-2.3.4.tar.gzcd freetype-2.3.4./configure -pref

24、ix=/usr/local/freetypemake make install安装pngtar -zxf libpng-1.2.18.tar.gzcd libpng-1.2.18./configure -prefix=/usr/local/libpngmake make install安装GDtar -zxf gd-2.0.34.tar.gzcd gd-2.0.34./configure -prefix=/usr/local/gd -with-zlib=/usr/local/zlib/ -with-png=/usr/local/libpng/ -with-jpeg=/usr/local/jpe

25、g6/ -with-freetype=/usr/local/freetype/ (请指定及格插件的安装路径,否则安装php的时候可能出错!)makemake install4.安装PHPtar -jxvf php-5.2.1.tar.bz2cd php-5.2.1./configure -prefix=/usr/local/php -with-zlib-dir=/usr/local/zlib/ -with-apxs2=/usr/local/apache/bin/apxs -with-jpeg-dir=/usr/local/jpeg6/ -with-png-dir=/usr/local/libp

26、ng/ -with-gd=/usr/local/gd/ -with-freetype-dir=/usr/local/freetype/ -with-mysql -enable-trace-varsmakemake installcp php.ini-dist /usr/local/php/lib/php.ini5.编辑apache配置文件httpd.conf#vi /usr/local/apache2/conf/httpd.conf要改的有如下几处:#AddType application/x-tar .tgzAddType application/x-httpd-php .php (需要加的

27、)# Example:# LoadModule foo_module modules/mod_foo.soLoadModule php5_module modules/libphp5.so (需要加的)DirectoryIndex index.html index.php (需要加的)在后面加 index.php 让它把index.php做为默认页 #ServerName把#去掉,后面的IP改成你的IP.DocumentRoot /usr/local/apache2/htdocs把/usr/local/apache2/htdocs改为你存放网页文件的路径保存退出6.测试PHP先重启下apach

28、e服务器就以默认的网页存放目录/usr/local/apache2/htdocs为例编辑phpinfo.php把它放在/usr/local/apache2/htdocs下面以我的为例,我是内网,ip:192.168.1.86在浏览器中输入:http:/192.168.1.86 (这个是测试apache的,会有apache的页面) http:/192.168.1.86/index.php (这样就可以看到php页面了)7.安装ZendOptimizer(不是必须的,这个是加速php)tar -zxvf ZendOptimizer-3.2.8-linux-glibc21-i386.tar.gzcd

29、 ZendOptimizer-3.2.8-linux-glibc21-i386./install.sh里面只有一个比较重要的设置就是要php.ini的路径,以我的配置这里就写/usr/local/php/lib安装完成之后,刷新http:/192.168.1.86/index.php页面就会有如下bannerwith Zend Optimizer v3.2.8, Copyright (c) 1998-2007, by Zend Technologies -2007.6.17 by ttxScreenshot.png (131 KB) 下载次数:02007-6-17 11:51shot收藏 分享

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号