当前位置: 首页 - System - Linux

RedHat5下Apache+MySQL+PHP的安装


1.Apache的安装

今天帮点击音乐网写完了在LINUX下的资源采集,顺便安装了HTTP服务器,使用的是APACHE,不过安装过程还是挺郁闷的(通过winscp远程连接LINUX在终端下安装)。

首先下载了一个*.tar.gz包,

# tar -zxvf httpd-2.2.6.tar.gz

# cd httpd-2.2.6/
# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so

//这里的—prefix指定apache的安装将安装到:/usr/local/apache目录下,--sysconfdir指定apache配置文件httpd.conf安装到:/etc/httpd目录下。(这两个路径可以自己任意指定指定,但是自己一定要在安装时记清楚,因为这个路径后面还要用到)

另外一些模块的启用也应该在这里configure的时候指定,比如说
--enable-cache  --enable-disk-cache  --enable-file-cache  --enable-mem-cache

# make

# make install

如果不出意外的话,successful!

启动运行apache:

# /usr/local/apache/bin/apachectl start

然后在本机浏览器里面输入:http://127.0.0.1,回车,默认会显示:it works字样,证明apache已经在工作状态中了。


一般安装就上面的过程,不过在START的时候出现了个错误 Could not reliably determine the server's fully qualified domain name ,解决方法是只要把/conf/httpd.conf文件的#ServerName 前的#去掉就好了。

最后在start,没有问题,但是客户端还是无法访问,我想不是配置问题就是防火墙问题,首先检查是否是防火墙问题,的确是。

/root$ ps
PID TTY TIME CMD
1 ? 00:00:00 init
2 ? 00:00:00 migration/0
3 ? 00:00:00 ksoftirqd/0
4 ? 00:00:00 migration/1
5 ? 00:00:00 ksoftirqd/1
6 ? 00:00:00 migration/2
7 ? 00:00:00 ksoftirqd/2
8 ? 00:00:00 migration/3
9 ? 00:00:00 ksoftirqd/3
10 ? 00:00:00 events/0
11 ? 00:00:00 events/1
12 ? 00:00:00 events/2
13 ? 00:00:00 events/3
14 ? 00:00:00 khelper
15 ? 00:00:00 kacpid
50 ? 00:00:00 kblockd/0
51 ? 00:00:00 kblockd/1
52 ? 00:00:00 kblockd/2
53 ? 00:00:00 kblockd/3
63 ? 00:00:00 pdflush
64 ? 00:00:00 pdflush
66 ? 00:00:00 aio/0
67 ? 00:00:00 aio/1
68 ? 00:00:00 aio/2
69 ? 00:00:00 aio/3
54 ? 00:00:00 khubd
65 ? 00:00:08 kswapd0
142 ? 00:00:00 kseriod
213 ? 00:00:00 scsi_eh_0
229 ? 00:00:00 kjournald
507 ? 00:00:00 minilogd
1004 ? 00:00:00 udevd
1325 ? 00:00:00 kauditd
1423 ? 00:00:00 kmirrord
1424 ? 00:00:00 kmir_mon
1477 ? 00:00:00 kjournald
1478 ? 00:00:00 kjournald
1479 ? 00:00:00 kjournald
1747 ? 00:00:00 sshd
1776 ? 00:00:00 xinetd
1794 ? 00:00:00 crond
11728 ? 00:00:00 sshd
29433 ? 00:00:00 httpd
29470 ? 00:00:00 sshd
29472 ? 00:00:00 sftp-server
29490 ? 00:00:00 sshd
29492 ? 00:00:00 bash
29521 ? 00:00:00 ps
/root$ ps
PID TTY TIME CMD
1 ? 00:00:00 init
2 ? 00:00:00 migration/0
3 ? 00:00:00 ksoftirqd/0
4 ? 00:00:00 migration/1
5 ? 00:00:00 ksoftirqd/1
6 ? 00:00:00 migration/2
7 ? 00:00:00 ksoftirqd/2
8 ? 00:00:00 migration/3
9 ? 00:00:00 ksoftirqd/3
10 ? 00:00:00 events/0
11 ? 00:00:00 events/1
12 ? 00:00:00 events/2
13 ? 00:00:00 events/3
14 ? 00:00:00 khelper
15 ? 00:00:00 kacpid
50 ? 00:00:00 kblockd/0
51 ? 00:00:00 kblockd/1
52 ? 00:00:00 kblockd/2
53 ? 00:00:00 kblockd/3
63 ? 00:00:00 pdflush
64 ? 00:00:00 pdflush
66 ? 00:00:00 aio/0
67 ? 00:00:00 aio/1
68 ? 00:00:00 aio/2
69 ? 00:00:00 aio/3
54 ? 00:00:00 khubd
65 ? 00:00:08 kswapd0
142 ? 00:00:00 kseriod
213 ? 00:00:00 scsi_eh_0
229 ? 00:00:00 kjournald
507 ? 00:00:00 minilogd
1004 ? 00:00:00 udevd
1325 ? 00:00:00 kauditd
1423 ? 00:00:00 kmirrord
1424 ? 00:00:00 kmir_mon
1477 ? 00:00:00 kjournald
1478 ? 00:00:00 kjournald
1479 ? 00:00:00 kjournald
1747 ? 00:00:00 sshd
1776 ? 00:00:00 xinetd
1794 ? 00:00:00 crond
11728 ? 00:00:00 sshd
29433 ? 00:00:00 httpd
29470 ? 00:00:00 sshd
29472 ? 00:00:00 sftp-server
29490 ? 00:00:00 sshd
29492 ? 00:00:00 bash
29522 ? 00:00:00 ps
/root$ setup
TERM environment variable needs set.
/root$ Firmware
-bash: line 11: Firmware: command not found
/root$ service iptables on
Usage: /etc/init.d/iptables {start|stop|restart|condrestart|status|panic|save}
/root$ service iptables off
Usage: /etc/init.d/iptables {start|stop|restart|condrestart|status|panic|save}
/root$ /etc/init.d/iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]


这样就OK了,客户端也能正常访问了。


PS:

linux 下 apache启动、停止、重启命令
基本的操作方法:
本文假设你的apahce安装目录为/usr/local/apache2,这些方法适合任何情况

apahce启动命令:
推荐/usr/local/apache2/bin/apachectl start apaceh启动

apache停止命令
/usr/local/apache2/bin/apachectl stop 停止

apache重新启动命令:
/usr/local/apache2/bin/apachectl restart 重启

要在重启 Apache 服务器时不中断当前的连接,则应运行:

/usr/local/sbin/apachectl graceful

如果apache安装成为linux的服务的话,可以用以下命令操作:

service httpd start 启动

service httpd restart 重新启动

service httpd stop 停止服务



如果你想一开机就让apache自动运行的话,那么进行如下操作:

编辑etc/rc.d/rc.local

# vi /etc/rc.d/rc.local

在最后加上一句: /usr/local/apache/bin/apachectl start

看这里的/usr/local/apache的安装路径用到了吧,所以大家装的时候一定要记清楚哦。。。。






2.MySQL的安装


用tar.gz的文件安装,也就是那个样子,重要的是注意./configure的时候

./configure \
"--prefix=/usr/local/mysql" \
"--localstatedir=/data/mysql/data" \
"--with-comment=Source" \
"--with-server-suffix=-Linuxtone.Org" \
"--with-mysqld-user=mysql" \
"--without-debug" \
"--with-big-tables" \
"--with-charset=gbk" \
"--with-collation=gbk_chinese_ci" \
"--with-extra-charsets=all" \
"--with-pthread" \
"--enable-static" \


特别是DATA的文件夹路径一定要指定




引用通告: 查看所有引用 | 我要引用此文章
文章标签: Linux  Apache  iptables 
相关文章:


上一篇: Linux下的Apache缓存系统
下一篇: linux系统下,11款常见远程桌面控制软件

分类: System | Linux  引用: 0  评论: 2  点击:
(如果您刚刚提交过留言,但是还没有被显示出来,请点击这里刷新一下: 刷新评论)
发表评论
昵称:
QQ:
邮箱:
主页:
邮件通知: 当回复时通知我(需要填写邮件地址)
评论内容:
(MAX:1000)
验证号码: (点击获取)