magento -- 如何手工安装magento(安装magento就这么简单)

magento -- 如何手工安装magento

(如果觉得可行,需要转载,请注明出处:http://blog.csdn.net/xinhaozheng)

如果网速慢,或者服务器在国外,又或者你买的只是magento 的共享空间,你在安装时肯定会碰到问题多多。magento平台功能强大,采用了EAV的数据库数据方法,在传统的关系数据库基础上以非传统的关系数据库模式组织数据,这样其它功能就非常灵活,也导致了它需要消耗大量的资源,甚至在安装的时候,在数据库安装那一个环节好多人都出现了网页过期的问题。

 

这边介绍的是不通过浏览器来安装magento ,前提是你的系统空间支持运行magento ,如果你不确定,那么请先在服务器上执行下列代码来测试空间是否能够安装magento :

 

extension_check(array( 'curl', 'dom', 'gd', 'hash', 'iconv', 'mcrypt', 'pcre', 'pdo', 'pdo_mysql', 'simplexml' )); function extension_check($extensions) { $fail = ''; $pass = ''; if(version_compare(phpversion(), '5.2.0', '<')) { $fail .= '<li>You need<b> PHP 5.2.0</b> (or greater)</li>'; } else { $pass .='<li>You have<b> PHP 5.2.0</b> (or greater)</li>'; } if(!ini_get('safe_mode')) { $pass .='<li>Safe Mode is <b>off</b></li>'; preg_match('/[0-9]/.[0-9]+/.[0-9]+/', shell_exec('mysql -V'), $version); if(version_compare($version[0], '4.1.20', '<')) { $fail .= '<li>You need<b> MySQL 4.1.20</b> (or greater)</li>'; } else { $pass .='<li>You have<b> MySQL 4.1.20</b> (or greater)</li>'; } } else { $fail .= '<li>Safe Mode is <b>on</b></li>'; } foreach($extensions as $extension) { if(!extension_loaded($extension)) { $fail .= '<li> You are missing the <b>'.$extension.'</b> extension</li>'; } else{ $pass .= '<li>You have the <b>'.$extension.'</b> extension</li>'; } } if($fail) { echo '<p><b>Your server does not meet the following requirements in order to install Magento.</b>'; echo '<br>The following requirements failed, please contact your hosting provider in order to receive assistance with meeting the system requirements for Magento:'; echo '<ul>'.$fail.'</ul></p>'; echo 'The following requirements were successfully met:'; echo '<ul>'.$pass.'</ul>'; } else { echo '<p><b>Congratulations!</b> Your server meets the requirements for Magento.</p>'; echo '<ul>'.$pass.'</ul>'; } }

 

另外,你还需要准备一个数据库和账户,这和正常安装magento 是一样的。

 

接下来:

 

1、设置虚拟主机(通常你如果是注册共享空间,你就不需要设置了)

<VirtualHost 192.168.0.11:80>
    ServerAdmin xinhaozheng#gmail.com
    DocumentRoot "/www/mgweb/mg1.2"
    ServerName www.mg12.com
    ErrorLog "logs/www.mg12.com-error.log"
    CustomLog "logs/www.mg12.com-access.log" common
</VirtualHost>

 

使用httpd -S测试一下没有没有语法错误,然后重启apache ,就可以测试一下域名,当然前提是你的域名

已经指向到这个IP。

 

2、将magento 压缩包解压到你的这个网站的根目录,这里是/www/mgweb/mg1.2

我通常喜欢下载.bz2格式的,因为比较小一点。

 

cd /www/mgweb/mg1.2

tar -xvjf magento-1.3.2.tar.bz2

 

要注意这里会解压出一个magento 文件夹,需要把这个magento 目录下的文件移到网站的根目录下.

mv magento/* ./

mv magento/.ht* ./

rm magento -rf

 

3、手工导入数据库,如果你之前没有安装过magento,你可以使用magento 的样品数据库。如果你只想要一个干净的数据库,不带任何测试数据的,你可以在正常安装magento后做个备份,以备使用

 

mysql db_mag<db_mag.sql -u george -p

 

这边db_mag.sql是我在之前安装时备份的一个magento 数据库。这样的导入只需要一秒就可以。而不需要在浏览器上苦苦等待。

 

4、进入到app/etc目录,执行如下命令,并在local.xml中做magento的基本配置,原本需要在浏览器的几个页面进行的配置只需要在这边填写就OK了。

 

cd app/etc

cp local.xml.template local.xml

vim local.xml

 

<?xml version="1.0"?> <!-- /** * Magento * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE_AFL.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * * @category Mage * @package Mage_Core * @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> <config> <global> <install> <date>{{date}}</date> </install> <crypt> <key>{{key}}</key> </crypt> <disable_local_modules>false</disable_local_modules> <resources> <db> <table_prefix>{{db_prefix}}</table_prefix> </db> <default_setup> <connection> <host>{{db_host}}</host> <username>{{db_user}}</username> <password>{{db_pass}}</password> <dbname>{{db_name}}</dbname> <active>1</active> </connection> </default_setup> </resources> <session_save>{{session_save}}</session_save> </global> <admin> <routers> <adminhtml> <args> <frontName>{{admin_frontname}}</frontName> </args> </adminhtml> </routers> </admin> </config>

 

5.一步其实是最关键的一步了

因为我们之前导入的数据库可能使用的是别的域名安装的magento,那么那个域名会被写入到magento的core_config_data表当中。

 

要么你就通过phpadmin来修改,要么就使用下列的sql语句(当然你要做相应的修改):

 

UPDATE `mg132` . `core_config_data` SET `value` = 'http://www.mg12.com/' WHERE `core_config_data` . `config_id` = 2 LIMIT 1 ;

UPDATE `mg132` . `core_config_data` SET `value` = 'http://www.mg12.com/' WHERE `core_config_data` . `config_id` = 3 LIMIT 1 ;

 

注:最后这一步,你也可以通过后台来修改。system -- configuration -- web - baseurl.

你可能感兴趣的:(数据库,mysql,浏览器,测试,extension,Magento)