【翻译】使用composer 安装Magento 2.3.x

官方原文链接

RoadMap

We use Composer to manage Magento components and their dependencies. Using Composer to get the Magento software metapackage provides the following advantages:

我们使用Composer来管理Magento组件及其依赖项。使用Composer获得Magento软件metapackage有以下优势:

  • Reuse third-party libraries without bundling them with source code
  • Reduce extension conflicts and compatibility issues by using a component-based architecture with robust dependency management
  • Adhere to PHP-Framework Interoperability Group (FIG) standards
  • Repackage Magento Open Source with other components
  • Use the Magento software in a production environment

– 重用第三方库,而不用将它们与源代码绑定
-通过使用基于组件的体系结构和健壮的依赖关系管理,减少扩展冲突和兼容性问题
-遵守PHP框架互操作性组(FIG)标准
-可以用其他组件重新打包Magento开源代码
-在生产环境中使用Magento软件

You must create a Composer project from our metapackage if you want to use the Magento Web Setup Wizard to upgrade the Magento software and third-party extensions.

如果您想使用Magento Web安装向导升级Magento软件和第三方扩展,则必须从我们的集合包中创建Composer项目。 (这也是我首先翻译这个文章的意图,因为手动向导安装无法在网页前端升级操作,官方有讲)

Prerequisites

Before you continue, you must do the following:

先决条件
在你继续之前,你必须做以下事情:
-设置一个满足系统需求的服务器(2G以上内存,apache 2.2 or 2.4,
MySQL 5.6, 5.7 /MariaDB 10.0, 10.1, 10.2,PHP 7.1.3+/ 7.2.x 及扩展/OPcache/PHP配置设置 ,SSL 1.1以上/不支持自签名,系统依赖,MAT/SMTP 邮箱服务,Redis3.2/Varnish 4.x 5.2/ Elasticsearch 5.2.x 2.x/ RabbitMQ 3.7.x )
-创建Magento文件系统所有者(详细)
-安装Composer
-获取Magento代码存储库的身份验证密钥 (详细

Get the metapackage

To get the Magento metapackage:

  1. Log in to your Magento server as, or switch to, the Magento file system owner.
  2. Change to the web server docroot directory or a directory that you have configured as a virtual host docroot.
  3. Create a new Composer project using the Magento Open Source or Magento Commerce metapackage.

获取安装包

-以Magento文件系统所有者(详细)的身份登录Magento服务器,或切换到该服务器。
-更改到web服务器docroot目录或已配置为虚拟主机docroot的目录。
-使用Magento开源或Magento 商业版的 metapackage 创建一个新的Composer项目。

开源版

composer create-project --repository=https://repo.magento.com/ magento/project-community-edition <install-directory-name>

商业版

composer create-project --repository=https://repo.magento.com/ magento/project-enterprise-edition <install-directory-name>

When prompted, enter your Magento authentication keys. Your public key is your username; your private key is your password.

If you encounter errors, such as Could not find package... or ...no matching package found, make sure there are no typos in your command. If you still encounter errors, you may not be authorized to download Magento Commerce. Contact Magento support for help.

See troubleshooting for help with more errors.

当提示时,输入Magento身份验证密钥。你的公钥是你的用户名;您的私钥是您的密码。
如果遇到错误,比如找不到包…还是……没有找到匹配的包,请确保您的命令中没有输入错误。如果您仍然遇到错误,您可能没有授权下载Magento Commerce。联系Magento寻求帮助。
有关更多错误,请参见疑难解答。

Set file permissions设置文件权限

You must set read-write permissions for the web server group before you install the Magento software. This is necessary so that the Setup Wizard and command line can write files to the Magento file system.

在安装Magento软件之前,必须为web服务器组设置读写权限。这是必要的,以便安装向导和命令行可以将文件写入Magento文件系统。

cd /var/www/html/<magento install directory>
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data . # Ubuntu
chmod u+x bin/magento

安装magento 一种是命令行一种是页面安装向导

(已经到这一步了,别折腾自己了,选择页面向导安装吧)

http://<Magento-host-or-IP>/<path-to-magento-root>/setup
For example: http://localhost/magento2ee/setup

命令行方式

This example assumes that the Magento install directory is named magento2ee, the db-host is on the same machine (localhost), and that the db-namedb-user, and db-password are all magento:

假设文件夹名为 magento2ee ,数据库在同一台服务器,数据库链接参数如上。

bin/magento setup:install \
--base-url=http://localhost/magento2ee \
--db-host=localhost \
--db-name=magento \
--db-user=magento \
--db-password=magento \
--backend-frontname=admin \
--admin-firstname=admin \
--admin-lastname=admin \
[email protected] \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1

命令行更多官方细节