RedHat Enterprise Linux 5下配置Apache+Mysql+Php

第一步:系统与软件的准备

系统版本 redhat enterprise linux v5.3 ,内核版本 2.6.18

第二步:软件包的准备

Apache2软件包:httpd-2.2.13.tar.gz

php5软件包:php-5.3.0.tar.gz

第三步, 架设YUM仓库

由于系统连GCC都没有给我们安装,因此是无法直接去make安装上述源代码的,必须先使用系统光盘架设一个YUM代码仓库,从中安装我们所需要的各种软件。

首先,我们按照系统安装光盘上所有的文件拷贝一份到RHEL5中(假设放置目录为/home/phinecos/back)

然后,我们要先安装一个RPM包才能开始架设YUM仓库

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> # cd / home / phinecos / back / Server
# rpm-ihvcreaterepo- 0.4 . 4 - 2 . fc6 . noarch . rpm

这个包安装之后,会生成一个新的命令:/usr/bin/createrepo,而这个命令是我下面必须要用到的。

RHEL5 所有的 Package 主要位于 Server, VT, Cluster, ClusterStorage 等目录, 该目录内有 repodata/ 目录放置 yum 程序所需要的索引信息档案, 包含 GUI 的套件新增移除所需要的大项分类信息. 不过由于该档案预设提供的是 cd disc 的方式安装使用, 所以需要手动建立新的档案提供 yum 与 GUI Packager 正常运作使用.

首先先复制出来 Server, VT, Cluster, ClusterStorage 目录内位于 repodata/ 内 comps-rhel5-*.xml 档案到暂存目录内提供后续要使用, 然后删除 repodata 目录, 重新建立新的 repodata 目录结构与必要索引档案.

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> cd / home / phinecos / back
for nameinServerVTClusterClusterStorage
do
cp
$ name / repodata / comps-rhel5-* . xml / tmp
done

# Server
cd / home / phinecos / back / Server
rm-rfrepodata
createrepo-g
/ tmp / comps-rhel5-server-core . xml .

# VT
cd / home / phinecos / back / VT
rm-rfrepodata
createrepo-g
/ tmp / comps-rhel5-vt . xml .

# Cluster
cd / home / phinecos / back / Cluster
rm-rfrepodata
createrepo-g
/ tmp / comps-rhel5-cluster . xml .

# ClusterStorage
cd / home / phinecos / back / ClusterStorage
rm-rfrepodata
createrepo-g
/ tmp / comps-rhel5-cluster-st . xml .

我们的YUM仓库到这里也就建好了。接下来,我们要做的就是要设置/etc/yum.repo.d里面的内容了,首先创建一个rhel-server.repo文件,在其中写入下述内容:

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> [Server]
name
= RedHatEnterpriseLinuxServerCore
baseurl
= file: /// home / phinecos / back / Server
enabled
= 1
gpgcheck
= 0
gpgkey
= file: /// etc / pki / rpm-gpg / RPM-GPG-KEY-redhat-release
[VT]
name
= RedHatEnterpriseLinuxVirtualTechnology
baseurl
= file: /// home / phinecos / back / VT
enabled
= 1
gpgcheck
= 0
gpgkey
= file: /// etc / pki / rpm-gpg / RPM-GPG-KEY-redhat-release
[Cluster]
name
= RedHatEnterpriseLinuxCluster
baseurl
= file: /// home / phinecos / back / Cluster
enabled
= 1
gpgcheck
= 0
gpgkey
= file: /// etc / pki / rpm-gpg / RPM-GPG-KEY-redhat-release
[ClusterStorage]
name
= RedHatEnterpriseLinuxClusterStorage
baseurl
= file: /// home / phinecos / back / ClusterStorage
enabled
= 1
gpgcheck
= 0
gpgkey
= file: /// etc / pki / rpm-gpg / RPM-GPG-KEY-redhat-release

当然,你也可以通过http与ftp方式把这个目录发布出去,那只要把相关的file:/// home/phinecos/back/这部分修改一下就可以了。

第四步,安装图形化互联网,开发工具等必须的软件

“Applications”à”Add/Remove Software”里面安装所需的基本工具软件,如gcc等。

第五步,安装Apache2

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> # tarzxvfhttpd- 2.2 . 8 . tar . bz2
# cd http- 2.2 . 8
#./ configure--prefix =/ usr / local / apache2--enable-rule = SHARED_CORE--enable-module = so
# make
# makeinstall

安装apache完成,输入命令

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> #/ usr / local / apache2 / bin / apachectl-k start

从本地或其它机器打开Firefox浏览器,输入地址http://127.0.0.1/,如果正确的话会出现一个"It works !"的提示页面,此时,apache2基本安装完成。

第五步,安装MySQL

“Applications”à”Add/Remove Software”里面找到MySql,进行安装,如果安装后发现启动mysql时出现:

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> StartingMySQL .. [FAILED]

这是SELINUX在作怪,解决办法:

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> / etc / selinux然后viconfig把SELINUX = enforcing这一行
改为:SELINUX
= disabled

然后保存,电脑重启,然后再把以前装的MYSQL删除重装下

启动mysql

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> / etc / init . d / mysql start 或servicemysql start

停止mysql

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> / etc / init . d / mysqlstop或servicemysqlstop

或者也可以采用rpm的方式来安装.首先从安装光盘中安装perl-DBI包,在Server文件夹中可以找到

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> # rpm-ivh / Server / perl-DBI- 1.52 - 1 . fc6 . i386 . rpm

安装完成后再依次安装mysql的其他包

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> # rpm-ivhMySQL-server-community- 5.0 . 51a- 0 . rhel5 . i386 . rpm
# rpm-ivhMySQL-client-community- 5.0 . 51a- 0 . rhel5 . i386 . rpm
# rpm-ivhMySQL-devel-community- 5.0 . 51a- 0 . rhel5 . i386 . rpm
# rpm-ivhMySQL-shared-community- 5.0 . 51a- 0 . rhel5 . i386 . rpm

安装完成后修改mysql的root用户密码,默认为空,修改命令如下

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> #/ usr / bin / mysqladmin-urootpassword'密码字符串'

以后再从命令行登录mysql的就输入

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> # mysql-uroot-p

会提示输入密码,Mysql的基本安装完成。

第六步,安装Php

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> # cd home / src / php- 5.2 . 0
# ./ configure--prefix =/ usr / local / php--with-mysql--with-apxs2 =/ usr / local / apache2 / bin / apxs
# make
# makeinstall
# cpphp . ini-dist / usr / local / php / lib / php . ini

对php.ini进行修改,把short_open_tag = Off改为short_open_tag = On

编辑Apache配置文件即/usr/local/apache/conf/httpd.conf,并添加以下一行:

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> AddTypeapplication / x-httpd-php . php
AddTypeapplication
/ x-httpd-php-source . phps

并在 DirectoryIndex 一行加上 index.php

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> / *添加php5模块* /
LoadModulephp5_modulemodules
/ libphp5 . so

保存并退出

建立test.php文件放在apache目录下的htdocs下,内容如下:

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> <? php
phpinfo ();
?>

通过浏览器查看http://127.0.0.1/test.php
Redhat添加中文支持

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> yumgroupinstall " ChineseSupport "

然后在系统”—“语言中选择中文简体
第七步,安装discuz

下载Discuz安装包

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> $ cd ~
$ mkdir discus
$ wgethttp: // download2 . comsenz . com / Discuz / 7.0 . 0 / Discuz_7 . 0 . 0_FULL_SC_GBK . zip

解压

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> $ unzipDiscuz_7 . 0 . 0_FULL_SC_GBK . zip

/usr/local/apache2/htdocs下新建bbs目录,将前面解压出的upload目录下所有文件复制到 bbs目录中

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> cp–aupload / * / usr / local / apache2 / htdocs / bbs /

htdocs文件夹777属性,

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> chmod-R 777 / usr / local / apache2 / htdocs

打开浏览器,输入:

<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> http: // 127.0 . 0.1 / bbs / install / index . php

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值