第一部分:
一、yum安装LAMP平台 二、部署phpMyAdmin
第二部分: 一、搭建论坛系统Discuz
二、搭建论坛系统PhpWind
三、搭建论坛系统 PhpBB
第三部分
一、部署wordpress个人博客系统
===============================================================================
一、phpMyAdmin简介
1. phpMyAdmin 是以PHP为基础而开发的一个以WEB方式来管理Mysql数据库的工具,phpMyAdmin提供了一个比较人性化的网页界面,操作起来非常简单易用。对于一些对SQL语句不太熟悉的人来使用,是最好不过的一个工具了。
phpMyAdmin官方网站下载地址:2. 安装LAMP平台
1 | # yum -y install http php php-mysql php-mbstring mysql mysql-server |
3. 修改Apache主配置文件,添加默认主页如下:
1 2 3 | # vim /etc/httpd/conf/httpd.conf DirectoryIndex index.php index.html index.html.var ServerName localhost:80 |
4. 启动http与mysql服务
1 2 | # service httpd start # service mysqld start |
5. 在默认网页存放新建一个index.php文件,写一个测试语句,是否能够连接数据库,数据库用户“root”,默认没有密码,我们设置一个密码;如下;
1 2 3 4 5 6 7 8 9 | # mysqladmin -uroot -p password "phpmyadmin" # vim /var/www/html/index.php <h1>www.phpmyadmin.com< /h1 > <?php $Con=mysql_connect( '127.0.0.1' , 'phpmyadmin' , 'phpmyadmin' ); if ($Con) echo "SUCCESS..." ; else echo "FAILURE..." ; |
6. 浏览器测试访问
7. 修改/etc/httpd/conf/httpd.conf文件,为phpmyadmin创建一个虚拟主机;如:
1 2 3 4 5 6 7 8 9 10 11 12 | # cd /etc/httpd/conf # cp httpd.conf httpd.conf.bak # vim httpd.conf 增加以下行 NameVirtualHost 192.168.0.104:80 <VirtualHost 192.168.0.104:80> ServerAdmin zhengyansheng@cdvcloud.com DocumentRoot /var/www/html/phpmyadmin ServerName www.phpmyadmin.com ErrorLog logs /allentuns-error_log CustomLog logs /allentuns-access_log common < /VirtualHost > |
8. 重新载入配置文件
1 | # service httpd reload |
9. 解压phpMyAdmin软件包
1 2 3 | # cd /usr/local/src # tar xf phpMyAdmin-4.1.14-all-languages.tar.bz2 -C /var/www/html/ # mv phpMyAdmin-4.1.14-all-languages phpmyadmin |
10. 由于没有DNS服务器解析,需要在本地Hosts文件中添加如下记录:
1 2 | C:\Windows\System32\Drivers\etc\hosts #打开此文件添加如下内容 192.168.0.104 www.phpmyadmin.com |
11、客户端打开浏览器验证是否能成功登录,如下
12. 登陆后的界面
提示phpMyAdmin 高级功能未设置,部分未激活,然后请点击【这里】查看原因;如下图
13. 首先需要修改/var/www/html/phpmyadmin/config.inc.conf文件;如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 去掉以下行的注释 /* Storage database and tables */ $cfg[ 'Servers' ][$i][ 'pmadb' ] = 'phpmyadmin' ; $cfg[ 'Servers' ][$i][ 'bookmarktable' ] = 'pma__bookmark' ; $cfg[ 'Servers' ][$i][ 'relation' ] = 'pma__relation' ; $cfg[ 'Servers' ][$i][ 'table_info' ] = 'pma__table_info' ; $cfg[ 'Servers' ][$i][ 'table_coords' ] = 'pma__table_coords' ; $cfg[ 'Servers' ][$i][ 'pdf_pages' ] = 'pma__pdf_pages' ; $cfg[ 'Servers' ][$i][ 'column_info' ] = 'pma__column_info' ; $cfg[ 'Servers' ][$i][ 'history' ] = 'pma__history' ; $cfg[ 'Servers' ][$i][ 'table_uiprefs' ] = 'pma__table_uiprefs' ; $cfg[ 'Servers' ][$i][ 'tracking' ] = 'pma__tracking' ; $cfg[ 'Servers' ][$i][ 'designer_coords' ] = 'pma__designer_coords' ; $cfg[ 'Servers' ][$i][ 'userconfig' ] = 'pma__userconfig' ; $cfg[ 'Servers' ][$i][ 'recent' ] = 'pma__recent' ; $cfg[ 'Servers' ][$i][ 'users' ] = 'pma__users' ; $cfg[ 'Servers' ][$i][ 'usergroups' ] = 'pma__usergroups' ; $cfg[ 'Servers' ][$i][ 'navigationhiding' ] = 'pma__navigationhiding' ; |
14. 将phpMyAdmin/examples/create_tables.sql数据库文件导入数据库;如下:
1 | # mysql -uroot -pphpmyadmin < /var/www/html/phpmyadmin/examples/create_tables.sql |
15. 再次重新登录并验证;如下:
===============================================================================
第二部分:
一、搭建Discuz论坛
1. Discuz简介
Discuz! X 是一款以 PHP 为编程语言,以 MySQL 为数据库,并使用 Apache/IIS/Nginx(任意一种即可) 提供 web 服务的产品。要搭建 Discuz! X 站点,服务器必须安装由 PHP、MySQL、Apache/IIS/Nginx 构成的环境。其中,IIS 主要用于 Windows 服务器,Apache、Nginx 多用于 Linux 服务器(即 LAMP 和 LNMP)。
2. 部署流程
1 2 | Linux 服务器部署时,需要按照一定的部署顺序,即: 系统环境初始化 -> Apache /Nginx 、MySQL、PHP 程序包下载 -> Apache /Nginx 、MySQL、PHP 安装 |
3. 软件下载地址:
4. 上传软件包或者本地下载软件包,解压到Apache站点目录 1 2 3 4 5 6 7 8 9 10 11 12 13 | [root@allentuns ~] # yum -y install unzip [root@allentuns ~] # cd /usr/local/src/ [root@allentuns src] # ls Discuz_X3.1_SC_UTF8.zip [root@allentuns src] # unzip Discuz_X3.1_SC_UTF8.zip [root@allentuns src] # ll total 16480 -rw-r--r--. 1 root root 10443521 Apr 29 04:16 Discuz_X3.1_SC_UTF8.zip drwxr-xr-x. 2 root root 4096 Feb 28 14:52 readme drwxr-xr-x. 12 root root 4096 Feb 28 14:52 upload drwxr-xr-x. 4 root root 4096 Feb 28 14:52 utility [root@allentuns src] # cp -r upload /var/www/html/bbs [root@allentuns src] # chown -R apache /var/www/html/bbs/ |
5. 添加虚拟主机,如下
1 2 3 4 5 6 7 8 | [root@allentuns ~] # vim /etc/httpd/conf/httpd.conf <VirtualHost 192.168.1.226:80> ServerAdmin zhengyansheng@cdvcloud.com DocumentRoot /var/www/html/bbs ServerName www.bbs.com ErrorLog logs /bbs-error_log CustomLog logs /bbs-access_log common < /VirtualHost > |
6 . 由于没有DNS服务器解析,需要在本地Hosts文件中添加如下记录:
1 2 | C:\Windows\System32\Drivers\etc\hosts #打开此文件添加如下内容 192.168.0.104 www.bbs.com |
7. 客户端谷歌浏览器访问域名;域名安装如下图
查看授权协议,点击【我同意】,以进行下一步操作;如图
设置好站点下目录的权限,然后全部通过后点击【下一步】,如下图
登陆MySQL数据库,创建论坛库,论坛mysql用户,授权
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | [root@allentuns ~] # mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 96 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and /or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database phpmyadmin #创建论坛数据库 mysql> insert into mysql.user(Host,User,Password) values( "localhost" , "phpmyadmin" ,password( "phpmyadmin" )); #创建论坛数据库管理员 Query OK, 1 row affected, 3 warnings (0.00 sec) mysql> grant all privileges on phpmyadmin.* to phpmyadmin@ '%' ; #赋予phpmyadmin对库有所有权限 Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; #重新载入授权表 Query OK, 0 rows affected (0.00 sec) mysql> select User,Host,Password from user; +------------+-----------+-------------------------------------------+ | User | Host | Password | +------------+-----------+-------------------------------------------+ | root | localhost | *387B36D01A7C5EC3AF24E860C269DAA274EF94EF | | root | allentuns | | | root | 127.0.0.1 | | | | localhost | | | | allentuns | | | phpmyadmin | localhost | *387B36D01A7C5EC3AF24E860C269DAA274EF94EF | #添加成功 | phpmyadmin | % | | +------------+-----------+-------------------------------------------+ 7 rows in set (0.00 sec) |
数据库名:phpmyadmin #新创建的数据库
数据库用户名:phpmyadmin #新创建的用户
数据库密码:phpmyadmin
数据表前缀:默认即可
管理员账号:admin
管理员密码:admin
以上信息输入完毕后,点击【下一步】
如图所示:下一步点击 【继续访问】
Discuz论坛搭建成功,如下图
bbs论坛安装完成后,最好删除或者重命名bbs目录下install目录
1 2 | [root@allentuns ~] # cd /var/www/html/bbs/ [root@allentuns bbs] # mv install install.bak |
重新登陆再次访问bbs论坛
用户登陆界面
到此bbs论坛搭建完成!!!
===========================================================================
二、搭建论坛系统PhpWind
1. phpwind简介
PHPWind 是一套采用 php+mysql 数据库方式运行并可生成 html 页面的全新且完善的强大系统。
2. 软件下载地址
phpwind下载地址:3. 上传软件包或解压对apache下的phpwind目录
1 2 3 4 5 6 7 8 | [root@allentuns ~] # mkdir /var/www/html/phpwind [root@allentuns ~] # cd /var/www/html/phpwind/ [root@allentuns phpwind] # mv /usr/local/src/phpwind_UTF8_8.7.zip . [root@allentuns phpwind] # unzip phpwind_UTF8_8.7.zip [root@allentuns phpwind] # cd .. [root@allentuns www] # chmod -R 777 phpwind/ [root@allentuns ~] # cd /var/www/html/phpwind/phpwind_UTF8_8.7/upload [root@allentuns upload] # mv * /var/www/html/phpwind/ |
4. 添加虚拟主机
1 2 3 4 5 6 7 8 | [root@allentuns ~] # vim /etc/httpd/conf/httpd.conf <VirtualHost 192.168.1.226:80> ServerAdmin zhengyansheng@cdvcloud.com DocumentRoot /var/www/html/phpwind ServerName www.phpwind.com ErrorLog logs /phpwind-error_log CustomLog logs /phpwind-access_log common < /VirtualHost > |
5. 重新载入apache配置文件
1 | [root@allentuns html] # service httpd reload |
6. 谷歌浏览器访问站点;如下图
点击【接受】
点击【下一步】
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 同上discuz创建对应的数据库、用户、授权 [root@allentuns ~] # mysql -uroot -pphpmyadmin Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 120 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and /or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database phpwind; Query OK, 1 row affected (0.00 sec) mysql> insert into mysql.user(Host,User,Password) values( "localhost" , "phpwind" ,password( "phpwind123" )); Query OK, 1 row affected, 3 warnings (0.00 sec) mysql> grant all privileges on phpwind.* to phpwind@ '%' ; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.01 sec) |
管理员登陆;如下图
到此phpwind安装就完成了!是不是so easy 啊!哈哈
====================================================================================================
三、搭建论坛系统 PhpBB
1.phpbb简介
自2000年发布以来, phpBB 已经成为世界上应用最广泛的开源论坛软件. 与早先的版本一样, phpBB 3.0 “Olympus” 拥有易于使用的管理面板和友好的用户安装界面, 您可以轻松地在数分钟内建立起您的论坛.
2. 下载地址:
3. 下载phpbb3.0.7_pl1_zh_phpbbchina.zip
4. 上传,解压,重命名到Apache站点目录
1 2 3 4 | # unzip phpbb3.0.7_zh_phpbbchina # mv phpbb3.0.7_zh_phpbbchina /var/www/html/ # cd /var/www/html/ # mv phpbb3.0.7_zh_phpbbchina phpbb |
5. 添加虚拟主机
1 2 3 4 5 6 7 8 | # vim /etc/httpd/conf/httpd.conf <VirtualHost 192.168.0.103:80> ServerAdmin zhengyansheng@cdvcloud.com DocumentRoot /var/www/html/phpbb ServerName www.phpbb.com ErrorLog logs /phpbb-error_log CustomLog logs /phpbb-access_log common < /VirtualHost > |
6. 重新载入Apache配置文件
1 | # service httpd restart |
7. 本地hosts文件,修改对应的dns记录
1 2 | C:\Windows\System32\Drivers\etc\hosts #打开此文件添加如下内容 192.168.0.104 www.phpbb.com |
7. 谷歌浏览器访问站点
点击【继续进行下一步】
添加对应目录权限,否则读取失败
1 2 | # cd /var/www/html/phpbb/ # chmod o+w cache/ files/ store/ config.php images/avatars/upload/ |
添加权限后如下图所示
然后点击【开始安装】,如下图
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 同上创建对应的数据库,用户授权 [root@allentuns ~] # mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and /or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database phpbb; Query OK, 1 row affected (0.02 sec) mysql> insert into mysql.user(Host,User,Password) values( "localhost" , "phpbb" ,password( "phpbb123" )); Query OK, 1 row affected, 3 warnings (0.03 sec) mysql> grant all privileges on phpbb.* to phpbb@ '%' ; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) |
点击【继续进行下一步】;如下图
默认以下设置,点击继续下一步
完成;如下图
移除install目录
1 2 | [root@allentuns ~] # cd /var/www/html/phpbb/ [root@allentuns phpbb] # mv install install.bak |
再次访问站点却出现错误,如下图
以上错误提示时区错误,需要做以下修改
1 2 3 4 5 6 7 8 9 | # cp /usr/share/doc/php-common-5.3.3/php.ini-production /etc/php.ini cp : overwrite ` /etc/php .ini'? yes # vim /etc/php.ini [Date] ; Defines the default timezone used by the date functions ; http: //php .net /date .timezone ; date .timezone = date .timezone = Asia /Shanghai # service httpd restart |
然后重新刷新页面;如下图
到此phpbb论坛就完成了
==================================================================================================
第三部分
一、部署wordpress个人博客系统
1. wordpress简介
WordPress起初是一款个人,并逐步演化成一款内容软件,它是使用语言和数据库开发的。用户
可以在支持 PHP 和 MySQL的服务器上使用自己的 Blog。
2. 软件下载地址
3. 为wordpress博客系统创建一个数据库名为“wordpress”;如
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [root@allentuns ~] # mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 25 Server version: 5.1.73 Source distribution Copyright (c) 2000, 2013, Oracle and /or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and /or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database wordpress; Query OK, 1 row affected (0.00 sec) mysql> insert into mysql.user(Host,User,Password) values( "localhost" , "wordpress" ,password( "wordpress123" )); Query OK, 1 row affected, 3 warnings (0.00 sec) mysql> grant all privileges on wordpress.* to wordpress@ '%' ; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) |
4. 上传,解压到Apache的站点目录,并修改对应的配置文件 错误1处 密码wordpress123
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | [root@allentuns src] # tar xf wordpress-3.9-zh_CN.tar.gz -C /var/www/html/ [root@allentuns src] # cd /var/www/html/wordpress/ [root@allentuns wordpress] # cp wp-config-sample.php wp-config-sample.php.bak [root@allentuns wordpress] # mv wp-config-sample.php wp-config.php [root@allentuns wordpress] # vim wp-config.php // ** MySQL 设置 - 具体信息来自您正在使用的主机 ** // /** WordPress数据库的名称 */ define( 'DB_NAME' , 'wordpress' ); /** MySQL数据库用户名 */ define( 'DB_USER' , 'wordpress' ); /** MySQL数据库密码 */ define( 'DB_PASSWORD' , 'wordpress' ); /** MySQL主机 */ define( 'DB_HOST' , 'localhost' ); /** 创建数据表时默认的文字编码 */ define( 'DB_CHARSET' , 'utf8' ); /** 数据库整理类型。如不确定请勿更改 */ define( 'DB_COLLATE' , '' ); |
5. 添加虚拟主机;如下
1 2 3 4 5 6 7 8 | [root@allentuns ~] # vim /etc/httpd/conf/httpd.conf <VirtualHost 192.168.0.103:80> ServerAdmin zhengyansheng@cdvcloud.com DocumentRoot /var/www/html/wordpress ServerName www.wordpress.com ErrorLog logs /wordpress-error_log CustomLog logs /wordpress-access_log common < /VirtualHost > |
6. 重新载入配置文件
1 | # service httpd reload |
7. 由于没有DNS服务器解析,需要在本地Hosts文件中添加如下记录:
1 2 | C:\Windows\System32\Drivers\etc\hosts #打开此文件添加如下内容 192.168.0.103 www.wordpress.com |
8. 谷歌浏览器访问域名 来安装博客系统,如下图
输入以下信息 用户名和密码都为zhengyansheng 电子邮件为公司的邮箱 然后单击【安装wordpress】进行下一步
输入用户名和密码【登陆】如下图
安装完成如下图
谷歌浏览器重新访问站点;如下图
到此整套的博客系统就整理完了。剩下来的时间祝大家五一节快乐!