LAMP的搭建之论坛的实现!
一.搭建lamp:
1.配置yum客户端:
[[email protected] ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo
[rhel-Server]
name=Red Hat Enterprise Linux server
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release
2.安装Apache
[[email protected] ~]# mount /dev/cdrom /mnt/cdrom
mount: block device /dev/cdrom is write-protected, mounting read-only
[[email protected] ~]# yum install httpd –y
3.安装mysql
[[email protected] ~]# yum list all |grep mysql
This system is not registered with RHN.
RHN support will be disabled.
freeradius-mysql.i386 1.1.3-1.4.el5 rhel-Server
libdbi-dbd-mysql.i386 0.8.1a-1.2.2 rhel-Server
mod_auth_mysql.i386 1:3.0.0-3.2.el5_3 rhel-Server
mysql.i386 5.0.77-3.el5 rhel-Server
mysql-bench.i386 5.0.77-3.el5 rhel-Server
mysql-connector-odbc.i386 3.51.26r1127-1.el5 rhel-Server
mysql-devel.i386 5.0.77-3.el5 rhel-Server
mysql-server.i386 5.0.77-3.el5 rhel-Server
mysql-test.i386 5.0.77-3.el5 rhel-Server
php-mysql.i386 5.1.6-23.2.el5_3 rhel-Server
qt4-mysql.i386 4.2.1-1 rhel-Server
rsyslog-mysql.i386 2.0.6-1.el5 rhel-Server
[[email protected] ~]# yum install mysql mysql-server –y
Dependency Installed: (依赖的文件 )
perl-DBD-MySQL.i386 0:3.0007-2.el5 perl-DBI.i386 0:1.52-2.el5
Complete!
[[email protected] ~]# yum list all |grep php
[[email protected] ~]# yum install php php-mysql php-mbstring
Dependency Installed:
php-cli.i386 0:5.1.6-23.2.el5_3 php-common.i386 0:5.1.6-23.2.el5_3
php-pdo.i386 0:5.1.6-23.2.el5_3
Complete!
[[email protected] conf.d]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[[email protected] conf.d]# chkconfig httpd on //开机自动启动
[[email protected] ~]# service mysqld start
Initializing MySQL database: Installing MySQL system tables...
120828 15:37:24 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
120828 15:37:24 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
Filling help tables...
120828 15:37:25 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
120828 15:37:25 [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 gjp99.baidu.com 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
[ OK ]
Starting MySQL: [ OK ]
[[email protected] ~]# chkconfig mysqld on //开机自动启动
4.测试:
[[email protected] conf.d]# cd /var/www/html
[[email protected] html]# vim index.php
<?php
phpinfo();
?>
由于设置了身份验证!
证明:php作为模块被Apache调用
[[email protected] ~]# cd /var/www/html
[[email protected] html]# vim index.php
注意:语句后面都要以分号结束!
证明:apache调用php,php调用mysql
二.搭建phpwind来实现论坛
物理目录的创建:
2.解压缩并配置
[[email protected] ~]# unzip phpwind_GBK_8.3 //解压到当前目录(GBK字体,8.3版本)
用ll 可看到以下蓝色为解压后的文件夹
cd upload/ 查看,里面都是php文件
3.测试并修正:
出现乱码,页面上右击 编码---简体中文
但是每一次都要调整,比较麻烦!
解决:[[email protected] ~]# vim /etc/httpd/conf/httpd.conf
4.安装phpwind 做的准备工作:
[[email protected] ~]# cd /var/www/html
[[email protected] html]# ll
total 12
-rw-r--r-- 1 root root 25 Aug 21 18:30 index.html
-rw-r--r-- 1 root root 117 Aug 28 16:22 index.php
drwxr-xr-x 22 root root 4096 Dec 21 2010 phpwind
[[email protected] html]# cd phpwind/
[[email protected] phpwind]# ll
[[email protected] phpwind]# chmod -R 777 p_w_upload
[[email protected] phpwind]# chmod -R 777 data
[[email protected] phpwind]# chmod -R 777 html
[[email protected] phpwind]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database phpwind;
Query OK, 1 row affected (0.00 sec)
mysql> show database;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| phpwind |
| test |
+--------------------+
4 rows in set (0.00 sec)
mysql> use phpwind;
Database changed
mysql> show tables;
Empty set (0.00 sec)
mysql> quit;
Bye
[[email protected] phpwind]# mysqladmin -u root -p password '123'
Enter password: 旧密码为空,所以在此回车!
进入数据库,测试:
[[email protected] phpwind]# mysql -u root -p
Enter password: //输入设置的密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
[[email protected] phpwind]# ll inst*
-rw-r--r-- 1 root root 32955 Dec 21 2010 install.php
[[email protected] phpwind]# rm install.php
rm: remove regular file `install.php'? y
管理员账号 进入下面界面
添加板块管理:
[[email protected] html]# vim /etc/httpd/conf/httpd.conf
[[email protected] html]# service httpd restart
C:\Windows\System32\drivers\etc
hosts文件修改如下:
192.168.2.100 bbs.gjp.com
三 、搭建wordpress来实现论坛
1.上传wordpress及相应主题:
注意右侧的目录!
2.解压缩,并把它作为物理目录访问
[[email protected] ~]# unzip wordpress_v3.0.5-zh_CN.zip
[[email protected] ~]# cd wordpress-3.0.5-zh_CN/wordpress/
[[email protected] wordpress]# ll
total 320
-rw-r--r-- 1 root root 397 Feb 8 2011 index.php
-rw-r--r-- 1 root root 15410 Dec 6 2008 license.txt
-rw-r--r-- 1 root root 8358 Feb 8 2011 readme.html
-rw-r--r-- 1 root root 4391 Feb 8 2011 wp-activate.php
http://192.168.2.100/wordpresss
访问不到![[email protected] html]# vim /etc/httpd/conf/httpd.conf
[[email protected] wordpress]# ll wp-config*
-rw-r--r-- 1 root root 2972 Feb 8 2011 wp-config-sample.php
-rw-r--r-- 1 root root 2972 Aug 28 18:47 wp-config.php
查看权限,有谁控制,httpd-----php-----wp-config.php(php是模块,被apache调用)
[[email protected] wordpress]# chown apache.apache wp-config.php
[[email protected] wordpress]# ll wp-config*
-rw-r--r-- 1 root root 2972 Feb 8 2011 wp-config-sample.php
-rw-r--r-- 1 apache apache 2972 Aug 28 18:47 wp-config.php
[[email protected] wordpress]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 16
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database wordpress;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| phpwind |
| test |
| wordpress |
+--------------------+
5 rows in set (0.01 sec)
mysql> \q
Bye
[[email protected] wordpress]# vim wp-config.php
注意,apache服务重启!
以管理员登陆,站点管理--外观--安装主题----上传---浏览---现在安装
[[email protected] wp-content]# cd themes
[[email protected] themes]# ll
total 8
-rw-r--r-- 1 root root 30 Feb 8 2011 index.php
drwxr-xr-x 4 root root 4096 Feb 8 2011 twentyten
[[email protected] themes]# cp ../uploads/WireMagazine.zip ./
[[email protected] themes]# ll
total 500
-rw------- 1 root root 497931 Aug 28 19:42 WireMagazine.zip
-rw-r--r-- 1 root root 30 Feb 8 2011 index.php
drwxr-xr-x 4 root root 4096 Feb 8 2011 twentyten
[[email protected] themes]# unzip WireMagazine.zip
四、基于主机头的虚拟主机:
[[email protected] themes]# vim /etc/httpd/conf/httpd.conf
测试机:
[[email protected] html]# ll
total 16
-rw-r--r-- 1 root root 25 Aug 21 18:30 index.html
-rw-r--r-- 1 root root 117 Aug 28 16:22 index.php
drwxr-xr-x 22 root root 4096 Aug 28 17:22 phpwind
drwxr-xr-x 5 root root 4096 Aug 28 19:11 wordpress
只要不是在主目录/var/www/html/ 下,任意地方都可以,只要指明即可!
[[email protected] html]# mv wordpress /var/
[[email protected] html]# mv phpwind /var/
五、搭建Discuz来实现论坛
1.上传的文件
[[email protected] ~]# mkdir Discuz
[[email protected] ~]# mv Discuz_X2.5_SC_GBK.zip Discuz
[[email protected] ~]# ll Discuz
total 9292
-rw-r--r-- 1 root root 9496731 Aug 28 21:05 Discuz_X2.5_SC_GBK.zip
[[email protected] ~]# cd Discuz
[[email protected] Discuz]# unzip Discuz_X2.5_SC_GBK.zip
增加以下信息:
[[email protected] var]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
C:\Windows\System32\drivers\etc
出现以下错误!
都变为可写,下一步:
刷新即可!
(如果喜欢,可以转载!)
转载于:https://blog.51cto.com/guojiping/976277