Chinaunix首页 | 论坛 | 博客
  • 博客访问: 187100
  • 博文数量: 30
  • 博客积分: 4115
  • 博客等级: 上校
  • 技术积分: 930
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-11 10:02
文章分类

全部博文(30)

文章存档

2010年(3)

2009年(20)

2008年(7)

我的朋友
最近访客

分类: 系统运维

2010-08-26 17:59:42

RHEL 5下设置装备摆设Apache,Mysql,Php


第一步:体系与软件的筹办
体系版本 redhat enterprise linux 5 ,内核版本 2.6.18
体系安置组件选择:GNOME,图形化互联网,编纂器,开辟东西,根基体系,体系东西,办理东西,X窗口情况
(由于机械有限,要从本机测试,以是安置GNOME和互联网情况)


第二步:软件包的筹办
httpd软件包:httpd-2.2.8.tar.bz2
mysql软件包从mysql官方网站下载,我选用的是ehel5的rpm包
MySQL-server-community-5.0.51a-0.rhel5.i386.rpm
MySQL-client-community-5.0.51a-0.rhel5.i386.rpm
MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm
MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm
php5软件包:php-5.2.5.tar.bz2
其他库文件:
curl-7.15.0.tar.gz
freetype-2.3.5.tar.gz
gd-2.0.35.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.26.tar.gz
libxml2-2.6.31.tar.gz
PDFlib-7.0.3-Linux-php.tar.gz
t1lib-5.0.0.tar.gz
xpm-3.4k.tar.gz
zlib-1.2.3.tar.gz
gettext-0.16.tar.gz
其他办理软件包:
phpMyAdmin-2.11.6-rc1-all-languages.tar.gz
webmin-1.410.tar.gz


若是你已经随体系安置了自带的http和php那么起首卸掉
rpm -qa这个号令盘问体系上是否安置过某个软件(linux体系中httpd便是apache)
先查找apache的安置包 近似

[root@linuxsir01 root]# rpm -qa | grep httpd
redhat-config-httpd-1.1.0-5
httpd-devel-2.2.13
httpd-manual-2.2.13
httpd-2.2.13

卸载一个软件包用rpm -e
好比要卸载httpd-2.2.13 只要号令
rpm -e httpd 背面的是版本号 不必要的

删除的时辰大概会提醒 某些软件必要 不妨
将全部与之相干联的软件包删撤除就可以了


第三步起头安置:
安置的挨次,httpd和mysql的安置,从这个情况而言是无所谓的,只是php5软件包要末了安置,先安置httpd
扼要步调如下,#号提醒符背面为号令,复制全部软件包到一个位置,我这里是在/usr/local/src目次下建立lamp目次,然后复制全部软件包到lamp下
#cd /usr/local/src/lamp
#tar zxvf httpd-2.2.8.tar.bz2
#cd http-2.2.8
#./configure --prefix=/usr/local/apache2 --enable-rule=SHARED_CORE --enable-module=so
#make
#make install
安置apache完成,输入号令
#/usr/local/apache2/bin/apachectl -k start
apache设置成开机自启动
在/etc/rc.d/rc.local文件中插手一行
/usr/local/apache/bin/apachectl start
如许每次从头启动体系今后,apache也会随体系一路启动.
从当地或别的机械打开Firefox欣赏器(我的钟爱),输入地点http://你的办事器ip地点,记得开放办事器的80端口,否则大概会提醒错误,若是准确的话会呈现一个"It works !"的提醒页面,此时,apache2根基安置完成。

Mysql的安置
我先安置mysql-server的安置包,提醒必要perl-DBI包,从安置光盘上即可找到,DVD安置的直接就去光盘上的Server文件夹去找就可以了,若是是cd安置,就去cd-2上去同样的目次。
#mount /dev/cdrw    /media
#rpm -ivh /media/Server/perl-DBI-1.52-1.fc6.i386.rpm
安置完成后再依次安置mysql的其他包
#rpm -Uvh MySQL-server-community-5.0.51a-0.rhel5.i386.rpm
#rpm -Uvh MySQL-client-community-5.0.51a-0.rhel5.i386.rpm
#rpm -Uvh MySQL-devel-community-5.0.51a-0.rhel5.i386.rpm
#rpm -Uvh MySQL-shared-community-5.0.51a-0.rhel5.i386.rpm
安置完成后点窜mysql的root用户暗码,默以为空,点窜号令如下
#/usr/bin/mysqladmin -u root password '暗码字符串'
今后再服从令行登录mysql的就输入
#mysql -u root -p
会提醒输入暗码,Mysql的根基安置完成。
接下来是其他库文件的安置,这些软件包的安置挨次应该可以自由选择(zlib在libpng前安置),不外我以为可以先把Zlib安置上,仅作参考。
我此次的挨次就没有先安置zlib,就任意选择来安置了,先是Curl,
#tar zxvf curl-7.15.0.tar.gz
#cd curl-7.15.0
#./configure --prefix=/usr/local/curl
(我以为可以加上--with-zlib开关,只是此次我没有效)
#make
#make install
jpeg的安置,jpeg不克不及本身建立安置所需的目次,要提前建立好
#mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1}
#./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
#make
#make install
libxml2的安置
#tar zxvf libxml2-2.6.31.tar.gz
#cd libxml2
#./configure --prefix=/usr/local/libxml2
(可以测验考试打开zlib开关,--with-zlib)
#make(时候大概轻微长些)
#make install
#cp xml2-config /usr/bin
LibPDF的安置
#tar zxvf PDFlib-7.0.3-Linux-php.tar.gz
#cd pdflib
#cp bind/php5/php520mt/libpdf-php.so /usr/local/lib/
(上面的php520mt目次的同级目次中有php503,php510,php520目次,不知道是不是版本的区别)
T1lib的安置
#tar zxvf t1lib-5.0.0.tar.gz
#cd t1lib
#./configure --prefix=/usr/local/t1lib
#make without-doc
#make install
Freetype的安置
#tar zxvf freetype-2.3.5.tar.gz
#cd freetype
#./configure --prefix=/usr/local/freetype
#make
#make install
Zlib的安置
#tar zxvf zlib-1.2.3.tar.gz
#./configure --shared
#make
#make install
Libpng的安置
#tar zxvf libpng-1.2.26.tar.gz
#cd libpng
#cp scripts/makefile.linux ./makefile
#./configure --prefix=/usr/local/libpng
#make
#make install
GDlib的安置,大概会呈现 AM_ICON 的错误提醒,此时必要安置 gettext 软件包
#tar zxvf gettext-0.16.tar.gz
#cd gettext
#./configure --prefix=/usr/local/gettext
#make
#make install(时候稍长)
接下来是gdlib的安置
#tar zxvf gd-2.0.35.tar.gz
#cd gd
#./configure --with-png=/usr/local/lib \
--with-zlib=/usr/local/lib \
--with-freetype=/usr/local/freetype/lib \
--with-jpeg=/usr/local/jpeg/lib
#make
#make install
PHP5的安置
#tar zxvf php-5.2.5.tar.bz2
#cd php
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs \
--enable-track-vars --with-sockets --enable-sockets --with-sysvshm --with-sysvsem \
--with-pdflib-dir=/usr/local/lib --with-jpeg-dir=/usr/local/jpeg \
--with-png-dir=/usr/local/lib --with-zlib-dir=/usr/local/lib \
--with-freetype-dir=/usr/local/freetype --with-curl=/usr/local/curl \
--with-libxml-dir=/usr/locallibxml2/lib --with-t1lib=/usr/localt1lib \
--with-gettext=/usr/localgettext/lib --with-gd --with-mysql
(最好加上mbstring 和 mcypt ,不知道是不是必需)
configure后若是乐成会提醒PHP接待界面: Thank you for using PHP.
#make
#make test
(约莫3000多项测试吧)
# make install
Php.ini文件的点窜
#cp php.ini.dist /usr/local/lib/
查找点窜extension_dir='./'的内容
extension_dir = /usr/local/lib
extension=libpdf_php.so
保留退出
  
末了点窜apache设置装备摆设文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
查找AddType 约莫在DefaultType text/plain

输入如下内容
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php-source .phps
(不清晰是不是必需输入这么多项)
查找DirectoryIndex index.html 在厥后输入 index.php
保留文件,退出。
测试php,建立info.php文件放到网站的目次下,我这里是/usr/local/apapche2/htdocs
内容如下
echo phpinfo();
?>
从头启动apache办事,从本机或别的机械测试
输入http;//ip地点/info.php
若是你可以看到php设置装备摆设信息的输出,那php的根基安置可以了。

   本文来自网络转载(),随着时间的变化,有些组件的版本已经更新,安装步骤或内容也会发生一些变化,因此本文只做参考!

阅读(1684) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-08-29 08:31:12

Download More than 1000 free IT eBooks: http://free-ebooks.appspot.com