LAMP搭建論壇

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

[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

重啓apache服務
[root@localhost html]# service httpd restart
停止 httpd:                                               [確定]
啓動 httpd:                                               [確定]
通過瀏覽器訪問,測試成功

 
安裝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

重啓服務apache
[root@localhost html]# service httpd restart
停止 httpd:                                               [確定]
啓動 httpd:                                               [確定]
訪問測試頁面,mysql連接成功

 
安裝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
通過網頁訪問

使用密碼登錄
創建用戶密碼
[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

重啓服務
[root@localhost phpmyadmin]# service httpd restart
停止 httpd:                                               [確定]
啓動 httpd:                                               [確定]
訪問網頁,提示需要登錄,但是頁面有錯誤

安裝所需要的庫文件
[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

 

安裝論壇
解壓縮文件
[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

此時訪問網頁

根據網頁提示修改相應目錄的權限,如
[root@localhost phpwind]# cd attachment/
[root@localhost attachment]# chmod -R 777 cn_img/
安裝論壇

刪除install.php
[root@localhost phpwind]# rm install.php
rm:是否刪除 一般文件 “install.php”? y
此時論壇已完全安成

 
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章