lamp架构下的iwebmall(电子商城的搭建)

apache

[root@localhost yum.repos.d]# yum install -y pcre-devel openssl*  gcc  gcc-c++      // 安装apache所需要的包

[root@localhost httpd-2.2.23]# ./configure --enable-modules=all --enable-mods-shared=all --enable-authz-owner --enable-echo --enable-example --enable-logio --enable-expires --enable-headers --enable-unique-id --enable-ssl --enable-static-ab --enable-http --enable-vhost-alias --enable-so --enable-rewrite --with-pcre=/usr --with-ssl=/usr  --with-mpm=worker

[root@localhost conf]# vi httpd.conf

     o other locations.
    158 #
    159 DocumentRoot "/www"
    160 
    161 #

   185 #
    186 <Directory "/www">
    187     #

Include conf/extra/httpd-languages.conf

Include conf/extra/httpd-vhosts.conf

lamp架构下的iwebmall(电子商城的搭建)_第1张图片

[root@localhost extra]# vi httpd-languages.conf

LanguagePriority zh-CN en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv tr zh-TW


[root@localhost extra]# vi httpd-vhosts.conf

<VirtualHost *:80>
    ServerAdmin test.test.com
    DocumentRoot "/www"
    ErrorLog "/var/log/httpd/apache_error.log"
    CustomLog "/var/log/httpd/apache_access.log" combined
</VirtualHost>

[root@localhost conf]# mkdir /www  /var/log/httpd

[root@localhost conf]# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/apache

[root@localhost conf]# service apache start

[root@localhost htdocs]# mv /usr/local/apache2/htdocs/index.html /www

浏览器访问127.0.0.1

如果看到  

It works!

表示apache成功了!

下面是mysql


[root@localhost mysql-5.6.10]# yum install ncurses-devel

如果你没有安装cmake

[root@localhost cmake-2.8.11.2]# tar xf cmake-2.8.11.2.tar.gz -C /usr/src/

[root@localhost cmake-2.8.11.2]# ./bootstrap

[root@localhost cmake-2.8.11.2]# make  && make install 

[root@localhost softs]# tar xf mysql-5.6.10.tar.gz -C /usr/src/

[root@localhost mysql-5.6.10]# cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql -DMYSQL_DATADIR:PATH=/database -DWITH_DEBUG:BOOL=ON -DWITH_EXTRA_CHARSETS:STRING=ALL -DWITH_INNOBASE_STORAGE_ENGINE:BOOL=ON -DWITH_PARTITION_STORAGE_ENGINE:BOOL=ON

[root@localhost mysql-5.6.10]# make   -------这里当时报了个错,忘记是什么错误了,反正我把/usr/src/mysql-5.6.10/strings/ ctype-ucs2.c中第49行和50行删了就好了

lamp架构下的iwebmall(电子商城的搭建)_第2张图片


[root@localhost mysql-5.6.10]# make install 

lamp架构下的iwebmall(电子商城的搭建)_第3张图片

[root@localhost mysql-5.6.10]# cd /usr/local/mysql/

[root@localhost mysql]# groupadd mysql
[root@localhost mysql]# useradd -g mysql -s /sbin/nologin mysql

[root@localhost mysql]# mkdir /var/run/mysqld /var/log/mysqld /database

[root@localhost mysql]# chown mysql.mysql -R /database /var/log/mysqld /var/run/mysqld  /usr/local/mysql


[root@localhost mysql]# ./scripts/mysql_install_db --datadir=/database --user=mysql
Installing MySQL system tables...2013-10-11 16:55:47 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-10-11 16:55:47 b7f0cad0 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
2013-10-11 16:55:47 b7f0cad0 InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!
2013-10-11 16:55:47 13508 [Note] InnoDB: The InnoDB memory heap is disabled
………………………………………………………………
2013-10-11 16:55:49 13508 [Note] Binlog end
2013-10-11 16:55:49 13508 [Note] InnoDB: FTS optimize thread exiting.
2013-10-11 16:55:49 13508 [Note] InnoDB: Starting shutdown...
2013-10-11 16:55:50 13508 [Note] InnoDB: Shutdown completed; log sequence number 1625977
OK

Filling help tables...2013-10-11 16:55:50 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2013-10-11 16:55:50 b7f0cad0 InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
…………………………
2013-10-11 16:55:52 13531 [Note] InnoDB: Starting shutdown...
2013-10-11 16:55:53 13531 [Note] InnoDB: Shutdown completed; log sequence number 1625987
OK

两个OK表示初始化成功

[root@localhost mysql]# cp support-files/mysql.server  /etc/rc.d/init.d/mysql5

[root@localhost mysql]# vi /etc/init.d/mysql5

214 conf=/usr/local/mysql/etc/my.cnf

46 basedir=/usr/local/mysql
47 datadir=/database

[root@localhost mysql]# mkdir etc

[root@localhost etc]# pwd
/usr/local/mysql

[root@localhost mysql]# mv my.cnf etc/

[root@localhost mysql]# cd etc/

[root@localhost etc]# cat my.cnf | grep -v ^# | grep -v ^$
[mysqld]
 basedir = /usr/local/mysql
 datadir = /database
 port = 3306
 socket = /var/run/mysqld/mysql5.socket
 pid-file=/var/run/mysqld/mysql5.pid
 general-log
 general-log-file=/var/log/mysqld/mysql5-access.log
 log-error=/var/log/mysqld/mysql5-error.log
 user=mysql

[root@localhost etc]# service mysql5 start
Starting MySQL..                                           [确定]

[root@localhost etc]# yum install mysql 想要登录mysql,客户端还是要安装的

[root@localhost etc]# cat /etc/my.cnf 

[client]
socket=/var/run/mysqld/mysql5.socket

[root@localhost etc]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.10-debug-log Source distribution


Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


mysql> update mysql.user set password=password('123') where user='root';
Query OK, 4 rows affected (0.14 sec)
Rows matched: 4  Changed: 4  Warnings: 0


mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

安装php

安装php需要安装几个包,

[root@localhost php-5.3.27]# yum install -y zlib-devel curl-devel *snmp-devel*  iconv-devel 

[root@localhost php-5.3.27]# yum install libxml2-devel bzip2-devel


[root@localhost etc]# cd /softs/
[root@localhost softs]# ls
cmake-2.8.11.2.tar.gz  mysql-5.6.10.tar.gz
httpd--2.2.23.tar.gz   php-5.3.27.tar.bz2
[root@localhost softs]# tar xf php-5.3.27.tar.bz2 -C /usr/src/

[root@localhost softs]# cd /usr/src/php-5.3.27/

[root@localhost php-5.3.27]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir=/usr --with-openssl-dir=/usr --with-zlib-dir=/usr --disable-ipv6 --with-zlib=/usr --with-bz2=/usr --with-curl=/usr --enable-ftp --with-mysql=/usr/local/mysql --with-mysql-sock=/var/run/mysqld/mysql5.socket 

--with-mysqli=/usr/local/mysql/bin/mysql_config

[root@localhost php-5.3.27]# make

[root@localhost php-5.3.27]# make install

[root@localhost modules]# ls /usr/local/apache2/modules/libphp5.so 
/usr/local/apache2/modules/libphp5.so

如果能找到这个模块,说明安装成功了,接下来就到了修改apache的配置文件了

  [root@localhost conf]# pwd
/usr/local/apache2/conf
[root@localhost conf]# vi httpd.conf  ---------------在第365 366行加上下面两行

365     AddType application/x-httpd-php .php .phtml

366     AddType application/x-httpd-php-source .phps

重启apache服务

[root@localhost ~]# service apache restart

[root@localhost www]# vi index.php

[root@localhost www]# cat index.php 
<?php
  phpinfo();
?>

[root@localhost www]# cp /usr/src/php-5.3.27/php.ini-production /usr/local/lib/php.ini
[root@localhost www]# vi /usr/local/lib/php.ini 

1229 mysql.default_socket =/var/run/mysqld/mysql5.socket

 1288 mysqli.default_socket =/var/run/mysqld/mysql5.socket

[root@localhost www]# service apache start

浏览器访问http://127.0.0.1/index.php

lamp架构下的iwebmall(电子商城的搭建)_第4张图片

截止目前,应该说整个lamp搭建差不多了,接下来我们可以安装一个电子商务网站来测试一下

下载iwebmall v1.2.rar解压到/www

[root@localhost www]# mv iwebmall\ v1.2/ iwebmall

浏览器访问http://192.168.254.153/iwebmall/install/index.php开始安装

lamp架构下的iwebmall(电子商城的搭建)_第5张图片

在安装的时候就发现问题了,gd模块没有安装,难道我要重新编译??呵呵,不需要的,php可以实现动态扩展,至于下面的allow_call_time_pass_reference 建议开启,那我也可以不开启了,但是防止出错,我还是开启了呵呵。

[root@localhost lib]# vi php.ini

allow_call_time_pass_reference = On

扩展gd模块可以参考我的另一篇文章http://blog.csdn.net/avilifans/article/details/12576813LAMP中PHP功能 的动态扩展,就是介绍gd扩展的。

gd安装好了之后,重启apache,然后再次刷新页面

lamp架构下的iwebmall(电子商城的搭建)_第6张图片

然后就可以执行下一步了

lamp架构下的iwebmall(电子商城的搭建)_第7张图片

问题很明显,权限不够[root@localhost www]# chown -R daemon.daemon /www

再次刷新

lamp架构下的iwebmall(电子商城的搭建)_第8张图片

接受授权协议,开始安装

lamp架构下的iwebmall(电子商城的搭建)_第9张图片

继续

lamp架构下的iwebmall(电子商城的搭建)_第10张图片

lamp架构下的iwebmall(电子商城的搭建)_第11张图片

lamp架构下的iwebmall(电子商城的搭建)_第12张图片

访问页面看一下

lamp架构下的iwebmall(电子商城的搭建)_第13张图片







你可能感兴趣的:(架构,电子商务,lamp)