linux下网站平台的搭建——apache +PHP+mysql
实验环境 VMware 6.5.2+redhat Enterprise 5 AS
我的内核版本
本文实验基础环境已经做好了一个dns的解析
本文中的几个组件均为源码包安装 ,介于可能有版本的不同安装略有差异
本文大致可以分为以下步骤
mysql的安装与简单配置
apache的安装与简单配置
PHP的安装
论坛的配置
由于之前已经有一篇关于 mysql 源码包的安装 所以 再此不在详细讲述
具体请参考
http://yuzeying.blog.51cto.com/644976/154611
下面安装 apache的源码包
[root@localhost tmp]# tar zxvf httpd-2.0.58.tar.gz
解压之后
进入源码目录
[root@localhost tmp]# cd httpd-2.0.58
[root@localhost httpd-2.0.58]# ls
ABOUT_APACHE CHANGES InstallBin.dsp os
acconfig.h config.layout LAYOUT README
acinclude.m4 configure libhttpd.dsp README.platforms
Apache.dsp configure.in LICENSE server
Apache.dsw docs Makefile.in srclib
apachenw.mcp.zip emacs-style Makefile.win support
build httpd.spec modules test
BuildBin.dsp include NOTICE VERSIONING
buildconf INSTALL NWGNUmakefile
[root@localhost httpd-2.0.58]#
编译前的准备
[root@localhost httpd-2.0.58]# ./configure --prefix=/usr/local/apache --enable-module=so
# apache 动态调用mysql
下一步 编译
[root@localhost httpd-2.0.58]# make
这个过程稍显缓慢
下一步 编译安装
[root@localhost httpd-2.0.58]# make install
安装完成
启动一下看看
[root@localhost httpd-2.0.58]#/usr/local/apache/bin/apachectl start
下一步 PHP的安装
拷贝 或下载 php源码包
[root@localhost tmp]# tar zxvf php-4.4.9.tar.gz
解压 完毕 进入源码目录
[root@localhost tmp]# cd php-4.4.9
[root@localhost php-4.4.9]# ls
acconfig.h NEWS
acconfig.h.in pear
acinclude.m4 php4.spec.in
aclocal.m4 php.gif
build php.ini-dist
buildconf php.ini-recommended
CODING_STANDARDS README.CVS-RULES
config.guess README.EXTENSIONS
config.sub README.EXT_SKEL
configure README.PARAMETER_PARSING_API
configure.in README.QNX
CREDITS README.SELF-CONTAINED-EXTENSIONS
cvsclean README.STREAMS
ext README.SUBMITTING_PATCH
EXTENSIONS README.TESTING
footer README.UNIX-BUILD-SYSTEM
generated_lists README.Zeus
genfiles regex
header run-tests.php
INSTALL sapi
install-sh scripts
LICENSE server-tests.php
ltmain.sh snapshot
main stamp-h.in
makedist stub.c
Makefile.frag tests
Makefile.global TODO
makerpm TODO_SEGFAULTS
missing TSRM
mkinstalldirs win32
netware Zend
编译前的准备
[root@localhostphp-4.4.9]#./configure --prefix=/usr/local/php --with-mysql --with-apxs2=/usr/local/apache/bin/apxs
等待
[root@localhost php-4.4.9]# make
编译
编译安装
[root@localhost php-4.4.9]# make install
Installing PHP SAPI module: cgi
Installing PHP CGI into: /usr/local/bin/
Installing PEAR environment: /usr/local/lib/php/
[PEAR] Archive_Tar - installed: 1.3.2
[PEAR] Console_Getopt - installed: 1.2.1
[PEAR] HTML_Template_IT- installed: 1.1
[PEAR] Net_UserAgent_Detect- installed: 2.0.1
warning: pear/PEAR requires package "pear/Structures_Graph" (recommended version 1.0.2)
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
[PEAR] PEAR - installed: 1.5.0
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
[PEAR] Structures_Graph- installed: 1.0.2
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/man/man1/
page: phpize.1
page: php-config.1
[root@localhost php-4.4.9]#
下一步 复制PHP配置文件,注意路径
[root@localhost php-4.4.9]# cp /tmp/php-4.4.9/php.ini-dist /usr/local/lib/php.ini
[root@localhost php-4.4.9]#
这里注意大小写
修改apache配置文件 使其能够识别.PHP结尾的网页文件
[root@localhost php-4.4.9]# vi /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
注意大小写和空格
[root@localhost php-4.4.9]# vi /usr/local/apache/htdocs/index.php
回车继续
这里呢是一个很简单的测设语句 注意是以分号结束的
[root@localhost php-4.4.9]#/usr/local/apache/bin/apachectl stop
[root@localhost php-4.4.9]#/usr/local/apache/bin/apachectl start
重启apache服务
我的ip设置
在浏览器里输入
如果这里出现nofound的话 参考以下解决方法
我们先用/usr/local/apache/bin/apachectl start启动apache服务,起不来的话
[root@localhost ~]# /usr/local/apache/bin/apachectl start
(98)Address already in use: make_sock: could not bind to address [::]:80
no listening sockets available, shutting down
Unable to open logs
[root@localhost ~]# killall -9 httpd
[root@localhost ~]# /usr/local/apache/bin/apachectl start
[root@localhost ~]#
确信步骤没有错误,配置文件没有其他改动的话
建议把进程结束 在启动一次
killall -9 httpd
/usr/local/apache/bin/apachectl start
/usr/local/apache/bin/apachectl start
下一步
由于之前的介绍mysql的安装的文章没有 设置远程密码
所以我们现在需要设置一个给予Mysql数据库远程访问权限
[root@localhost ~]# /usr/local/mysql/bin/mysqladmin -u root password Ccjsj1200
[root@localhost ~]#
我的本地计算机的密码为Ccjsj1200 远程的同样是这个
不要把远程密码设置成别的,不然本地登录会出问题的,我已经试过了,大家就不用在试了
[root@localhost ~]# /usr/local/mysql/bin/mysql
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
[root@localhost ~]#
如果我们现在这样登录的话是会出现错误的,所以要这样登录
[root@localhost ~]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
####注释一下这里输入你的密码Ccjsj1200
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 4.0.27-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
这时我们成功登陆数据库
设置MySQL远程管理员密码,在MySQL提示符中输入
mysql> grant all on *.* to root@'%' identified by 'Ccjsj1200' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql>
在MySQL库中建立phpbb数据库
mysql> create database phpbb;
####注意以分号结尾
Query OK, 1 row affected (0.00 sec)
mysql>
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| phpbb |
| test |
+----------+
3 rows in set (0.00 sec)
mysql>
把语言包和论坛源代码拷贝至/tmp目录下
mysql>quit
Bye
[root@localhost ~]# cd /tmp
[root@localhost tmp]# ls
gconfd-root scim-bridge-0.3.0.lockfile-0@localhost:0.0
httpd-2.0.58 scim-bridge-0.3.0.socket-0@localhost:0.0
httpd-2.0.58.tar.gz scim-helper-manager-socket-root
keyring-hVSZal scim-panel-socket:0-root
lang_chinese_simplified.tar.gz scim-socket-frontend-root
mapping-root sealert.log
mysql-4.0.27 ssh-fRrzDL3480
mysql-4.0.27.tar.gz virtual-root.Xh7y9O
mysql.sock VMwareDnD
orbit-root vmware-root
php-4.4.9 VMwareTools-7.8.4-126130.tar.gz
php-4.4.9.tar.gz vmware-tools-distrib
[root@localhost tmp]# tar zxvf lang_chinese_simplified.tar.gz
[root@localhost tmp]# tar zxvf phpBB-2.0.20.tar.gz
复制语言包内容到phpBB2的language目录下
[root@localhost tmp]# cp -r /tmp/lang_chinese_simplified /tmp/phpBB2/language/
[root@localhost tmp]#
复制论坛安装源代码包内容到apache主页目录下
[root@localhost tmp]# cp -r /tmp/phpBB2 /usr/local/apache/htdocs
[root@localhost tmp]#
这里注意你安装的目录即可
开始安装phpbb,
浏览器里输入
填写相关信息
之后选择开始安装
您的系统设定档无法写入, 您可以点击下方按钮下载设定文件, 再将这个文件上传至 phpBB 2 论坛的资料夹. 在完成后您必须使用管理员帐号跟密码登陆并进入系统管理控制面板 (在您登陆后, 下方将出现一个进入"系统管理控制面板"的链接) 检查您的基本配置设定. 最后感谢您选择使用安装 phpBB 2 论坛系统.
我们打开看一下
用新下载的config.conf文件覆盖原有的旧config.conf文件
[root@localhost ~]# cd /root/Desktop
[root@localhost Desktop]#
[root@localhost Desktop]# cp config.php /usr/local/apache/htdocs/phpBB2
cp:是否覆盖“/usr/local/apache/htdocs/phpBB2/config.php”? y
[root@localhost Desktop]#
####是否覆盖这里选择y
进入到phpBB2目录下,删除安装文件contrib和install,以便正常访问
[root@localhost Desktop]# cd /usr/local/apache/htdocs/phpBB2
[root@localhost phpBB2]# ll
总计 432
drwxr-xr-x 2 root root 4096 08-23 17:35 admin
drwxr-xr-x 2 root root 4096 08-23 17:35 cache
-rw-r--r-- 1 root root 6660 08-23 17:35 common.php
-rw-r--r-- 1 root root 273 08-23 19:00 config.php
drwxr-xr-x 2 root root 4096 08-23 17:35 contrib
drwxr-xr-x 2 root root 4096 08-23 17:35 db
drwxr-xr-x 2 root root 4096 08-23 17:35 docs
-rw-r--r-- 1 root root 810 08-23 17:35 extension.inc
-rw-r--r-- 1 root root 3643 08-23 17:35 faq.php
-rw-r--r-- 1 root root 45807 08-23 17:35 groupcp.php
drwxr-xr-x 4 root root 4096 08-23 17:35 images
drwxr-xr-x 2 root root 4096 08-23 17:35 includes
-rw-r--r-- 1 root root 14706 08-23 17:35 index.php
drwxr-xr-x 3 root root 4096 08-23 17:35 install
drwxr-xr-x 4 root root 4096 08-23 17:35 language
-rw-r--r-- 1 root root 9492 08-23 17:35 login.php
-rw-r--r-- 1 root root 12208 08-23 17:35 memberlist.php
-rw-r--r-- 1 root root 39011 08-23 17:35 modcp.php
-rw-r--r-- 1 root root 34911 08-23 17:35 posting.php
-rw-r--r-- 1 root root 73811 08-23 17:35 privmsg.php
-rw-r--r-- 1 root root 3428 08-23 17:35 profile.php
-rw-r--r-- 1 root root 43661 08-23 17:35 search.php
drwxr-xr-x 3 root root 4096 08-23 17:35 templates
-rw-r--r-- 1 root root 23154 08-23 17:35 viewforum.php
-rw-r--r-- 1 root root 7233 08-23 17:35 viewonline.php
-rw-r--r-- 1 root root 45235 08-23 17:35 viewtopic.php
[root@localhost phpBB2]#
[root@localhost phpBB2]# rm -rf contrib
[root@localhost phpBB2]# rm -rf install
[root@localhost phpBB2]#
再次访问改论坛
登陆一下
后面的这些创建 就变得很简单了,就不在此详细的描述了,截几个图大家看看吧
这是仿照maxpda 做的粗糙的页面,反正有那么点意思
这个是注册用户的时候的画面
这是回复帖子的画面
参考两篇博文
原帖地址
双洋 兄
老杨
本文转自 yuzeying1 51CTO博客,原文链接:http://blog.51cto.com/yuzeying/219048