Magento2 快速安装指南

Magento2 快速安装指南
2017年1月10日 浏览量 54 2 min read
Magento2 快速安装指南

很多Magento2新手以及从Magento1来到2的开发人员对于Magento2的安装还不是非常熟悉,对于Magento2的安装步骤也确实是个麻烦的过程,这里我们将Magento2的安装教程写成文档,提供给大家参考。

这篇安装文档适用于条件:

  • 你已经拥有一台Magento服务器(不是共享主机)
  • 使用 composer create-project来进行系统安装操作,这样可以直接获得Magento的最近更新或者安装你自己的插件。
  • Magento2所需要的安装环境都已就绪(数据库,网站运行环境等)
  • 你的服务器安装了Ubuntu或者CentOs操作系统。

  • (本文同样适用于其他UNIX发行版本操作系统如:RedHat Enterprise Linux (RHEL)或者Debian,但是不适用于Mac和Windows操作系统)
  • 你的服务器IP地址为:192.0.2.5
  • 在你的服务器文件目录中安装 magento2 (完整路径如:/var/www/html/magento2)

  •  

    You can optionally set up static routing or a virtual host to install to a host name instead of an IP but that’s beyond the scope of this topic.

我们将安装过程分为以下几个步骤:安装前,安装和安装后。希望能够对你有所帮助;如果对于本文有所疑问,非常希望能够给我们提出建议,我们也将会在第一时间给您反馈。

安装前提:测试你的技术基础

确认自己理解什么是“终端”应用,你的服务器运行的操作系统,理解Apache是什么并且能够熟练设置操作。

如果对于这几个概念还不是很清楚,请阅读这篇文章

安装步骤1:入门

  1. 查看系统安装需求
  2. 如果你的系统不具备安装所需条件,参考以下文档:

  3. 还有一点也很重要,在服务器上创建一个Magento系统文件用户
  4. 切换到要安装Magento软件环境的服务器用户。

下载Magento代码包

完成所有准备工作后,按照以下步骤使用Composer来下载Magento2代码包:

cd <要安装的Magento2路径>
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2

这个过程需要进行身份验证,详情请查看获得身份验证码。这个步骤只是下载Magento2的代码包;并不是帮助你来安装Magento2.

或者,你也可以下载Magento代码包

设置要安装文件的用户权限

这里我们接触了在安装Magento2之前如何获得并设置服务器的读写权限。这也是通过网页安装向导或者服务器命令行安装Magento时写入Magento系统文件的必经步骤。

这个过程的用法是不同的,这取决与你是使用共享主机(你拥有一个用户)还是独立服务器(你拥有两个用户)。

If you're using a Magento version earlier than 2.0.6, see Appendix—Magento file system ownership and appendix (legacy) instead.

设置共享主机权限(一个用户)

接下来学习如何用跟运行Web服务器相同的用户身份登录到Magento服务器来设置预安装权限。 这种设置方式常用语在共享主机系统中。

设置单用户系统的所有权和权限:

设置多用户的所有权和权限

This section discusses how to set ownership and permissions for your own server or a private hosting setup. In this type of setup, you typically cannot log in as, or switch to, the web server user. You typically log in as one user and run the web server as a different user.这部分学习的是如何在你的独立主机或者私人服务器上设置所有权和权限。

设置多用户系统的所有权和权限:

切换到当前Magento2的系统用户

在其他操作都已经完成的情况下,输入以下命令切换到Magento2的管理用户:

  • Ubuntu: su <用户名>
  • CentOS: su - <用户名>

例如:

su magento2_user

安装步骤2:安装Magento2

你可以选择通过网页安装向导或者服务器命令行的方式来安装Magento2。

命令行安装

以下内容用来讲述使用命令行安装Magento2的步骤:

  • Magento2代码路径为 /var/www/html/magento2 ,你的网站前台路径为://192.0.2.5/magento2/

  • 代码和网站数据库存放在同一台服务器。

    数据库名为:magento,用户名和密码也均为:magento

  • 使用服务器重写

  • 后台超级管理员属性如下:

    • 名和姓为Magento User
    • 用户名为admin 密码为:admin123
    • 邮件地址为:user@example.com
  • 默认语言为英语en_US (U.S. English)
  • 默认货币为美元 U.S. dollars
  • 默认时区为U.S. Central (America/Chicago)

    php /var/www/html/magento2/bin/magento setup:install --base-url=http://192.0.2.5/magento2/ \
    --db-host=localhost --db-name=magento --db-user=magento --db-password=magento \
    --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
    --admin-user=admin --admin-password=admin123 --language=en_US \
    --currency=USD --timezone=America/Chicago --use-rewrites=1
    
     

可使用以下命令设置为开发者模式

cd <your Magento install dir>/bin
php magento deploy:mode:set developer

网页安装向导安装

以下为使用网页安装向导安装Magento2的步骤

  • magento2 的代码文件放在网站服务器的文件根目录,在浏览器中输入http://192.0.2.5/magento2/

  • 数据库和网站代码都在同一台服务器。

    数据库名为 magento,用户名和密码均为 magento

  • 后台超级管理员属性如下:

    • 用户名: admin 密码: adminMagento2
    • 邮件地址为 user@example.com
  • 默认语言是英语en_US (U.S. English)
  • 默认货币是美元U.S. dollars
  • 默认时区是美国时区(America/Chicago)

运行网页安装向导:

  1. 在浏览器中输入以下Url来进入Magento2的安装进程

    http://192.0.2.5/magento2
    
     
  2. 在欢饮页面,点击Agree and Setup Magento(同意Magento安装条款)

    You must accept the license agreement to install the Magento software

  3. 第一步:安装前检查用来检查系统是否具备安装Magento2的条件。

    点击 Start Readiness Check(安装前检查)

    The Readiness Check makes sure your system is ready for the Magento software

    • 如果通过安装前检查,点击Next(下一步)继续安装进程。
    • 如果安装前检查失败,请查看Readiness check issues
  4. 第二步:填写网站数据库名称,用来存放网站数据信息。

    Set up your Magento database

  5. 第三步:设置网站前后台链接。

    Enter your storefront and Magento Admin URLs

  6. 第四步:自定义店铺货币,市区和语言。

    Customize the store's language, time zone, currency

  7. 第五步:创建后台超级管理员账户。

    Create a Magento administrator account

  8. 第六步:在你点击Install Now(现在开始安装)后,安装进程开始安装Magento2.

    你也可以选择展开Console Log控制台日志来查看当前安装进程及信息。如果报错,请查看Troubleshooting suggestions

安装步骤3:Magento2安装完成后

Previous article:
Next article:
Comments
发表评论,留下你的足迹
我们不会公开你的邮箱地址

是否允许我们在发布新内容或者进行促销活动向您发送消息?

Remind me later

Thank you! Please check your email inbox to confirm.

Oops! Notifications are disabled.

© 2014-2023 www.magease.com. All Rights Reserved. 寰云网络 版权所有    鲁ICP备 14014975号-1