构建LAMP平台

安装Apache
安装配置mysql及相关软件
安装配置php及相关软件
安装论坛软件
安装ECshop软件
安装mysql的图形管理软件

 

1.安装LAMP所需软件包

[root@localhost ~]# yum install httpd mysql mysql-server mysql-devel php php-mysql -y

#修改mysql数据库管理员root的密码

[root@localhost ~]# mysqladmin -u root  password 123[root@localhost ~]# mysql -u root -pEnter password:Welcome to the MySQL monitor.  Commands end with ; or \g.mysql>

#建立bbs论坛的数据库及授权用户

mysql> create database discuz;mysql> grant  all  on  discuz.*  to  discuz@localhost  identified  by '123';Query OK, 0 rows affected (0.00 sec)mysql>

#修改php.ini文件

[root@localhost LAMP]# vim /etc/php.ini[root@localhost LAMP]# grep short_open /etc/php.inishort_open_tag = On

#重启服务

[root@localhost ~]# service mysqld restart[root@localhost ~]# service httpd restart

#测试是否能打开php网页

[root@localhost ~]# vi /var/www/html/yum/test.php

在浏览器上输入

2.安装Discuz!论坛系统

[root@localhost ~]# cd LAMP/

#解压缩并移动到指定目录

[root@localhost LAMP]# unzip upload_bbs.zip[root@localhost LAMP]# mv upload /var/www/html/bbs

#修改bbs目录的所有者为apache用户

[root@localhost LAMP]# chown -R apache:apache /var/www/html/bbs

#添加虚拟主机

[root@localhost LAMP]# vim /etc/httpd/conf.d/vhost.conf[root@localhost LAMP]# tail -5 /etc/httpd/conf.d/vhost.conf
DocumentRoot /var/www/html/bbsServerName www.bbs.comAddDefaultCharset GB18030

#修改dns文件使其能解析www.bbs.com

#修改DNS主配置文件

[root@localhost LAMP]# vim /etc/named.conf[root@localhost LAMP]# tail -4 /etc/named.confzone "bbs.com" IN{type master;file "bbs.com.zone";};

#添加DNS区域数据文件

[root@localhost LAMP]# cp -a /var/named/163.com.zone  /var/named/bbs.com.zone[root@localhost LAMP]# vim /var/named/bbs.com.zone[root@localhost LAMP]# cat /var/named/bbs.com.zone$TTL 1D@       IN      SOA     www.bbs.com. root  (3 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimum@       IN      NS      www.bbs.com.@       IN      A       10.0.1.88www     IN      A       10.0.1.88

#重启服务 

[root@localhost LAMP]# service named restartStopping named: .                                          [  OK  ]Starting named:                                            [  OK  ][root@localhost LAMP]# service httpd restartStopping httpd:                                            [  OK  ]Starting httpd: httpd:                             [  OK  ]

打开网页安装向导
http://www.bbs.com/install.php

 

 

3.安装ECShop软件

#解压并移动到指定目录

root@localhost LAMP]# unzip ECShop_V2.7.3_UTF8_release0411.zip[root@localhost LAMP]# mv upload /var/www/html/shop

#修改目录属组和属主

[root@localhost LAMP]# chown -R apache:apache /var/www/html/shop

#添加虚拟主机

[root@localhost LAMP]# vim /etc/httpd/conf.d/vhost.conf[root@localhost LAMP]# tail -4 /etc/httpd/conf.d/vhost.conf
DocumentRoot /var/www/html/shopServerName www.shop.com

#修改DNS文件

[root@localhost LAMP]#  vim /etc/named.conf[root@localhost LAMP]# tail -4 /etc/named.confzone "shop.com" IN{type master;file "shop.com.zone";};
[root@localhost LAMP]# cp -a /var/named/bbs.com.zone  /var/named/shop.com.zone[root@localhost LAMP]# vim  /var/named/shop.com.zone[root@localhost LAMP]# cat /var/named/shop.com.zone$TTL 1D@       IN      SOA     www.shop.com. root  (3 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimum@       IN      NS      www.shop.com.@       IN      A       10.0.1.88www     IN      A       10.0.1.88

修改php.ini文件中的时区设置

[root@localhost LAMP]# vim /etc/php.ini[root@localhost LAMP]# grep date.time /etc/php.inidate.timezone = "Asia/Shanghai"

 打开网页安装向导

 

4.安装mysql的图形管理软件

[root@localhost LAMP]# tar xf phpMyAdmin-3.4.3.2-all-languages.tar.gz[root@localhost LAMP]# mv phpMyAdmin-3.4.3.2-all-languages /var/www/html/phpmysql[root@localhost LAMP]# cd /var/www/html/phpmysql/[root@localhost phpmysql]# cp config.sample.inc.php config.inc.php[root@localhost phpmysql]# vim config.inc.php[root@localhost phpmysql]# grep http config.inc.php$cfg['Servers'][$i]['auth_type'] = 'http';[root@localhost phpmysql]# vim /etc/httpd/conf.d/vhost.conf[root@localhost phpmysql]# tail -4 /etc/httpd/conf.d/vhost.conf
DocumentRoot /var/www/html/phpmysqlServerName www.mysql.com
[root@localhost phpmysql]# vim /etc/named.conf[root@localhost phpmysql]# tail -4 /etc/named.confzone "mysql.com" IN{type master;file "mysql.com.zone";};[root@localhost phpmysql]# cp -a /var/named/bbs.com.zone /var/named/mysql.com.zone[root@localhost phpmysql]# vim /var/named/mysql.com.zone[root@localhost phpmysql]# cat /var/named/mysql.com.zone$TTL 1D@ IN SOA www.mysql.com. root (3 ; serial1D ; refresh1H ; retry1W ; expire3H ) ; minimum@ IN NS www.mysql.com.@ IN A 10.0.1.88www IN A 10.0.1.88[root@localhost phpmysql]# service named restartStopping named: . [ OK ]Starting named: [ OK ][root@localhost phpmysql]# service httpd restartStopping httpd: [ OK ]Starting httpd: [ OK ]