如何安装magento2和测试数据

环境

服务器环境

https://devdocs.magento.com/guides/v2.2/install-gde/system-requirements-tech.html

浏览器环境

https://devdocs.magento.com/guides/v2.2/install-gde/system-requirements_browsers.html

  • Internet Explorer 11 or later, Microsoft Edge, latest–1
  • Firefox latest, latest–1 (any operating system)
  • Chrome latest, latest–1 (any operating system)
  • Safari latest, latest–1 (Mac OS)
  • Safari Mobile for iPad 2, iPad Mini, iPad with Retina Display (iOS 7 or later), for desktop storefront
  • Safari Mobile for iPhone 4 or later; iOS 7 or later, for mobile storefront
  • Chrome for mobile latest–1 (Android 4 or later) for mobile storefront


前提条件

1, 已安装对应版本的php和mysql,以及magento2需要的php扩展库。

2, 已安装apache或者nginx

3, 已安装composer。

   未安装的参考install_composer

4, 改php.ini配置文件

   memory_limit 设为1024M
   max_execution_time 设为180


安装

一,命令行安装

1
composer create-project --repository-url=https: //repo .magento.com/ magento /project-community-edition

会提示输入用户名和密码。

这个用户名和密码需要到

https://marketplace.magento.com/customer/accessKeys/list/

去注册。

我的是:

1
2
Username: 351f04818e0e872f40eae452f594fe8d
Password: caaa64937c8fcc78749feb2a9c91db94

如果下载的文件不全的话,就直接clone github 或者下载对应版本的zip后解压

1
git clone https: //github .com /magento/magento2 .git

注意:
如果命令行安装失败的话,可以直接git clone下载源码(最新版2.2.2)。
国内镜像 速度很快

1
git clone https: //gitee .com /zouhongzhao/magento2 .git


二, 执行完后

1)安装依赖

1
composer  install


2)导入测试数据(主要是联网下载图片和数据,可不导,因为非常慢)

1
php bin /magento  sampledata:deploy

**如果有报错的话 等下面第3步安装完成之后再导入测试数据。

注意,这里也可以直接下载测试数据压缩包安装。

下载地址:

https://magento.com/tech-resources/download


3), 执行完后,在线安装网店

浏览器安装网店(域名后面加/setup):

比如http://test.com

访问:

http://test.com/setup

这里设置中文语言和时区
image /assets/images/1-3rOBgACEPOKhkgmp.png

按照提示安装完成。


4), 最后在更新下系统

1, 给文件权限

1
find  . - type  f - exec  chmod  644 {} \; &&  find  . - type  d - exec  chmod  755 {} \; &&  find  . /var  - type  d - exec  chmod  777 {} \; &&  chmod  777 var/ -R &&  find  . /pub/media  - type  d - exec  chmod  777 {} \; &&  find  . /pub/static  - type  d - exec  chmod  777 {} \; &&  chmod  777 . /app/etc  &&  chmod  644 . /app/etc/ *.xml &&  chmod  u+x bin /magento
1
chown  zou:zou . -hR  (注意:这里的zou换成你的服务器用户名)


2,更新系统

1
2
3
4
5
php bin /magento  setup:upgrade
php bin /magento  setup:di:compile
php bin /magento  setup:static-content:deploy en_US -f
php bin /magento  indexer:reindex
php bin /magento  cache:clean && php bin /magento  cache:flush

如果提示权限问题的话,就切换到root来执行

1
2
3
sudo  php bin  /magento  setup:upgrade
sudo  php bin /magento  setup:di:compile
sudo  php bin /magento  setup:static-content:deploy en_US -f


3,安装中文语言包

1
2
3
4
composer require mageplaza /magento-2-chinese-language-pack :dev-master
php bin /magento  setup:static-content:deploy en_US zh_Hans_CN -f
php bin /magento  cache:clean
php bin /magento  cache:flush


https://www.mageplaza.com/magento-2-chinese-language-pack.html

https://github.com/mageplaza/magento-2-chinese-language-pack


安装包配合命令行安装是装得最快最不容易出错的方式

安装包配合命令行安装是装得最快最不容易出错的方式

安装包配合命令行安装是装得最快最不容易出错的方式


资深phper可以直接在命令行里一键安装并配置magento2

见: https://devdocs.magento.com/guides/v2.2/install-gde/install/cli/install-cli-install.html


5),配置cron

m2发邮件都是通过cron定时发的,然后索引也是定时自动刷新的,如果是上线了的话必须得配置cron。

http://bbs.mallol.cn/?thread-147.htm



疑难杂症

有任何疑难杂症,请猛戳官方安装指南,里面有你意想不到的答案。



演示网站

http://magento2.mallol.cn/


Magento2开发者社区

http://bbs.mallol.cn/

猜你喜欢

转载自blog.csdn.net/aislj/article/details/80858329