CentOS 5.5 编译安装apache+php+mysql,利用CMS快速建立论坛

晨曦之光 发布于 2012/03/09 14:51
阅读 233
收藏 1
  这个是转来的,细节没有验证,请网友自己斟酌。。。。。。。。。。

 

CentOS 5.5 编译安装apache+php+mysql,利用CMS快速建立论坛

1、安装Apache
[root@bogon tmp]# wget http://labs.renren.com/apache-mirror/httpd/httpd-2.2.15.tar.bz2
[root@bogon tmp]# tar jxvf httpd-2.2.15.tar.bz2
[root@bogon tmp]# cd httpd-2.2.15
[root@bogon tmp]# ./configure
--prefix=/usr/local/apache --enable-so
[root@bogon tmp]# make
[root@bogon tmp]# make install
安装完成!
[root@bogon tmp]# service httpd start //启动apache服务
在主机中访问127.0.0.1(CentOS)
成功
[root@bogon tmp]# vi /etc/rc.d/init.d/httpd
加入
#chkconfig: 2345 10 90
#description:auto_run随便填
[root@bogon tmp]# /sbin/chkconfig --del httpd
[root@bogon tmp]# /sbin/chkconfig --add
httpd
[root@bogon tmp]# reboot
重启,在主机访问成功,说明开机启动没问题
2、安装MySQL
[root@bogon tmp]# wget http://mysql.cdpa.nsysu.edu.tw/Downloads/MySQL-5.1/mysql-5.1.47.tar.gz
[root@bogon tmp]# tar jxvf mysql-5.1.47.tar.gz
[root@bogon tmp]# cd mysql-5.1.47
[root@bogon tmp]# ./configure
--prefix=/usr/local/mysql
[root@bogon tmp]# make
[root@bogon tmp]# make install

[root@bogon tmp]# cp
support-files/my-medium.cnf /etc/my.cnf
[root@bogon tmp]# cd /usr/local/mysql
[root@bogon mysql]# bin/mysql_install_db
--user=mysql
[root@bogon mysql]# chown -R root  .
[root@bogon mysql]# chown -R mysql var
[root@bogon mysql]# chgrp -R mysql .
[root@bogon mysql]# bin/mysqld_safe
--user=mysql & 开启mysql
[root@bogon mysql]# ./bin/mysql –u root –p
密码为空


[root@bogon local]# cp
/usr/local/share/mysql/mysql.server /etc/rc.d/init.d/mysqld
[root@bogon local]# chkconfig --add
mysqld
//增加mysql自启动

[root@bogon local]# mysql –u root –p
mysql> use mysql
Database changed
mysql> update user set
password=password("toor") where user="root";
//设置新密码


3、安装PHP
[root@bogon tmp]# wget http://cn.php.net/distributions/php-5.3.2.tar.bz2
[root@bogon tmp]# tar jxvf php-5.3.2.tar.bz2
[root@bogon tmp]# cd php-5.3.2
[root@bogon php-5.3.2]#
./configure --prefix=/usr/local/php -with-apxs2=/usr/local/apache/bin/apxs
-with-mysql=/usr/local/mysql
-with-apxs2 与 apache的工具apxs配合,产生模块文件到目录/usr/local/apache/modules/,同时也会自动在apache的配置文件中写入一行"LoadModule php5_module
modules/libphp5.so";
-with-mysql=/usr/local/mysql 与mysql整合,如何没装mysql会出错
[root@bogon php-5.3.2]#
make
[root@bogon php-5.3.2]#
make install
[root@server php-5.3.2]#
cp php.ini-development /usr/local/php/lib/php.ini

[root@server php-5.3.2]#
vi /usr/local/apache/conf/httpd.conf
加入AddType application/x-httpd-php .php(.php前有一个空格)
[root@localhost conf]# cd
/usr/local/apache/htdocs/
[root@localhost conf]#
[root@localhost htdocs]# vi test.php
重启apache
[root@localhost htdocs]# service httpd
restart
httpd: Syntax error on line 53 of
/usr/local/apache/conf/httpd.conf: Cannot load
/usr/local/apache/modules/libphp5.so into server:
/usr/local/apache/modules/libphp5.so: cannot restore segment prot after reloc:
Permission denied //重启不成功,是SElinux引起的
[root@localhost htdocs]# vi
/etc/selinux/config
SELINUX=enforcing 改成SELINUX=disabled重启
XP中访问成功



[root@localhost
~]# vi /usr/local/apache/conf/httpd.conf
[root@localhost
~]# service httpd restart

4、建站
[root@bogon ~]# cd
/usr/local/apache/htdocs/
[root@bogon htdocs]# wget
http://download.comsenz.com/DiscuzX/Discuz_X1_SC_UTF8.zip
下载Discuz_X1_SC_GBK.zip,以前用过Discuz! 7.2,试下新东西~
[root@bogon htdocs]# cp -rf /usr/local/apache/htdocs/upload/.*
/usr/local/apache/htdocs/
[root@bogon htdocs]# chmod -R 777 config
[root@bogon htdocs]# chmod -R 777 data
[root@bogon htdocs]# chmod -R 777
uc_client/data/cache/
[root@bogon htdocs]# chmod -R 777
uc_server/data
[root@bogon htdocs]# firefox 127.0.0.1/install/index.php

一路往下,安装成功
在XP中访问成功 http://192.168.65.132/index.php
原文链接:http://blog.csdn.net/21aspnet/article/details/6582033
加载中
返回顶部
顶部