LAMP搭建论坛

实验环境及所需要的软件包
redhat企业版5.5
以下文件需要从网上下载
phpMyAdmin-2.11.10.1-all-languages.zip               通过页面管理mysql   
phpwind_GBK_8.3.zip                                  phpwind论坛
php-mcrypt-5.1.6-5.el5.i386.rpm                      php的扩展文件       
libmcrypt-2.5.7-5.el5.i386.rpm                       扩展文文件所依赖的库
以下是自带文件
Httpd--2.2.3-43.el5..i386.rpm                        apache http服务器
httpd-devel-2.2.3-43.el5.i386.rpm                    apache http服务器开发工具
httpd-manual-2.2.3-43.el5.i386.rpm                   apache http服务器文档
system-config-httpd-1.3.3.3.el5.noarch.rpm           apache配置工具
php-5.1.6-27.el5.i386.rpm                            php主程序
php-gd-5.1.6-27.el5.i386.rpm                         用于使用gd图形库的php程序模块  
php-mbstring-5.1.6-27.el5.i386.rpm                   包含处理字符集的php模块  
php-pear.noarch-1.4.9-6.el5.noarch.rpm               包含基本PEZR模块
php-xml-5.1.6-27.el5.i386.rpm                        使用xml的模块
php-mysql-5.1.6-27.el5.i386.rpm                      使用mysql的模块
mysql-server-5.0.77-4.el5_4.2.i386.rpm               mysql服务器
LAMP安装
安装apache
安装以下包
[root@localhost ~]# yum list all|grep httpd
httpd.i386                                 2.2.3-43.el5                installed
httpd-devel.i386                           2.2.3-43.el5                installed
httpd-manual.i386                          2.2.3-43.el5                installed
system-config-httpd.noarch                 5:1.3.3.3-1.el5             installed
 
安装php
[root@localhost ~]# yum list all |grep php
php.i386                                   5.1.6-27.el5                server  
php-bcmath.i386                            5.1.6-27.el5                server  
php-cli.i386                               5.1.6-27.el5                server  
php-common.i386                            5.1.6-27.el5                server  
php-dba.i386                               5.1.6-27.el5                server  
php-devel.i386                             5.1.6-27.el5                server  
php-gd.i386                                5.1.6-27.el5                server  
php-imap.i386                              5.1.6-27.el5                server  
php-ldap.i386                              5.1.6-27.el5                server  
php-mbstring.i386                          5.1.6-27.el5                server  
php-mysql.i386                             5.1.6-27.el5                server  
php-ncurses.i386                           5.1.6-27.el5                server  
php-odbc.i386                              5.1.6-27.el5                server  
php-pdo.i386                               5.1.6-27.el5                server  
php-pear.noarch                            1:1.4.9-6.el5               server  
php-pgsql.i386                             5.1.6-27.el5                server  
php-snmp.i386                              5.1.6-27.el5                server  
php-soap.i386                              5.1.6-27.el5                server  
php-xml.i386                               5.1.6-27.el5                server  
php-xmlrpc.i386                            5.1.6-27.el5                server  
[root@localhost ~]# yum install -y php
查看配置文档存放路径
[root@localhost ~]# rpm -ql php
/etc/httpd/conf.d/php.conf
/usr/lib/httpd/modules/libphp5-zts.so
/usr/lib/httpd/modules/libphp5.so
/var/lib/php/session
/var/www/icons/php.gif
查看配置文件以及模块
[root@localhost ~]# vim /etc/httpd/conf.d/php.conf

LAMP搭建论坛_mysql

[root@localhost ~]# cd /etc/httpd/modules/
[root@localhost modules]# ll |grep php
-rwxr-xr-x 1 root root 3015036 2010-01-15 libphp5.so
-rwxr-xr-x 1 root root 3157088 2010-01-15 libphp5-zts.so
查看php版本
[root@localhost html]# php -v
PHP 5.1.6 (cli) (built: Jan 14 2010 13:10:54)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
编辑测试页面
[root@localhost modules]# cd /var/www/html/
[root@localhost html]# vim index.php

LAMP搭建论坛_论坛搭建_02

重启apache服务
[root@localhost html]# service httpd restart
停止 httpd:                                               [确定]
启动 httpd:                                               [确定]
通过浏览器访问,测试成功

LAMP搭建论坛_php_03

 
安装mysql
[root@localhost html]# yum list mysql*
mysql.i386                                5.0.77-4.el5_4.2                    server
mysql-bench.i386                          5.0.77-4.el5_4.2                    server
mysql-connector-odbc.i386                 3.51.26r1127-1.el5                  server
mysql-devel.i386                          5.0.77-4.el5_4.2                    server
mysql-server.i386                         5.0.77-4.el5_4.2                    server
mysql-test.i386                           5.0.77-4.el5_4.2                    server
[root@localhost html]# yum install mysql-server
启动服务
[root@localhost html]# service mysqld start
初始化 MySQL 数据库: Installing MySQL system tables...
120319 13:12:51 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
120319 13:12:51 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
Filling help tables...
120319 13:12:51 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
120319 13:12:51 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
 
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
 
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
 
Alternatively you can run:
/usr/bin/mysql_secure_installation
 
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
 
See the manual for more instructions.
 
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
 
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
 
Please report any problems with the /usr/bin/mysqlbug script!
 
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
                                                                                                                                                          [确定]
启动 MySQL:                                        [确定]
查看端口
[root@localhost html]# netstat -tupln |grep mysql
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      4767/mysqld 
进入mysql,查看mysql状态
[root@localhost html]# mysql
mysql> status
--------------
mysql Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (i386) using readline 5.1
 
Connection id:          2
Current database:       test
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.0.77 Source distribution
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    latin1
Conn. characterset:    latin1
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 4 min 56 sec
 
Threads: 1 Questions: 13 Slow queries: 0 Opens: 12 Flush tables: 1 Open tables: 6 Queries per second avg: 0.044
--------------
mysql> \q
Bye
 
为mysql管理员设置密码
[root@localhost ~]# mysqladmin -u root -p password '123456'
Enter password: ---->什么都不用输入
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
此时无法使用mysql进入需要使用密码登录
[root@localhost ~]# mysql -u root -p
Enter password: ---->输入密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.0.77 Source distribution 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 
mysql> \q
Bye
删除密码
[root@localhost ~]# mysqladmin -u root -p password ''
Enter password: ----->此时输入空格
[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.0.77 Source distribution 
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. 
mysql> \q
Bye
 
phpmysql的连接
安装连接文件
[root@localhost html]# yum install -y php-mysql
编辑测试页面
[root@localhost html]# vim index.php

LAMP搭建论坛_apache_04

重启服务apache
[root@localhost html]# service httpd restart
停止 httpd:                                               [确定]
启动 httpd:                                               [确定]
访问测试页面,mysql连接成功

LAMP搭建论坛_lamp_05

 
安装mysql网页管理工具
[root@localhost ~]# unzip phpMyAdmin-2.11.10.1-all-languages.zip
做成虚拟目录
[root@localhost ~]# mv phpMyAdmin-2.11.10.1-all-languages /var/www/html/phpmyadmin
通过网页访问

LAMP搭建论坛_apache_06

使用密码登录
创建用户密码
[root@localhost phpmyadmin]# mysqladmin -u root -p password '123456'
Enter password: ---->什么都不用输入
修改cookie验证码,否则不能使用密码登陆
[root@localhost html]# cd phpmyadmin/
[root@localhost phpmyadmin]# cp config.sample.inc.php config.inc.php
[root@localhost phpmyadmin]# vim config.inc.php

LAMP搭建论坛_php_07

重启服务
[root@localhost phpmyadmin]# service httpd restart
停止 httpd:                                               [确定]
启动 httpd:                                               [确定]
访问网页,提示需要登录,但是页面有错误

LAMP搭建论坛_lamp_08

安装所需要的库文件
[root@localhost ~]# rpm -ivh libmcrypt-2.5.7-5.el5.i386.rpm
[root@localhost ~]# rpm -ivh php-mcrypt-5.1.6-5.el5.i386.rpm
进一步安装php所需要的支持模块
[root@localhost ~]# yum -y install php-mbstring php-gd php-pear php-xml

LAMP搭建论坛_php_09

 

安装论坛
解压缩文件
[root@localhost ~]# unzip phpwind_GBK_8.3.zip
制作虚拟目录
[root@localhost ~]# cd phpwind_GBK_8.3
[root@localhost phpwind_GBK_8.3]# mv upload/ /var/www/html/phpwind
修改apache配置文档
[root@localhost html]# vim /etc/httpd/conf/httpd.conf

LAMP搭建论坛_论坛搭建_10

此时访问网页

LAMP搭建论坛_mysql_11

根据网页提示修改相应目录的权限,如
[root@localhost phpwind]# cd p_w_upload/
[root@localhost p_w_upload]# chmod -R 777 cn_img/
安装论坛

LAMP搭建论坛_apache_12

LAMP搭建论坛_apache_13

删除install.php
[root@localhost phpwind]# rm install.php
rm:是否删除 一般文件 “install.php”? y
此时论坛已完全安成

LAMP搭建论坛_apache_14 LAMP搭建论坛_论坛搭建_15