{"id":1646,"date":"2023-03-25T21:46:16","date_gmt":"2023-03-25T13:46:16","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1646"},"modified":"2023-04-23T21:57:45","modified_gmt":"2023-04-23T13:57:45","slug":"install-magento-2-4-using-composer","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/install-magento-2-4-using-composer\/","title":{"rendered":"\u4f7f\u7528Composer\u5b89\u88c5Magento 2.4"},"content":{"rendered":"<p>\u9996\u5148\u5230<code>https:\/\/marketplace.magento.com\/<\/code>\u83b7\u53d6username\u548cpassowd<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/PHP\/Magento-Marketplace-Key.png\" alt=\"Magento Marketplace \u83b7\u53d6 Public key \u53ca Private key\" \/><\/p>\n<p><!-- more --><\/p>\n<p><code>Public key<\/code>\u5373username\uff0c<code>Private key<\/code>\u5373password<\/p>\n<h3>\u5b89\u88c5composer<\/h3>\n<pre><code class=\"language-bash\">curl \\-sS https:\/\/getcomposer.org\/installer | php\nmv composer.phar \/usr\/local\/bin\/composer\ncomposer -v<\/code><\/pre>\n<h3>\u4f7f\u7528composer\u83b7\u53d6\u4ee3\u7801<\/h3>\n<pre><code class=\"language-bash\">cd \/var\/www\/html\nmkdir magento\nchown -R www.www magento\ncd magento\nsu www\ncomposer create-project --repository-url=https:\/\/repo.magento.com\/ magento\/project-community-edition .\n# \u5982\u679c\u4e2d\u9014\u4e2d\u65ad\u4e86\uff0c\u4e0d\u8981\u518d\u7528\u4e0a\u9762\u7684\u547d\u4ee4\uff0c\u6539\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u7ee7\u7eed\u83b7\u53d6\u4ee3\u7801\ncomposer update<\/code><\/pre>\n<h3>\u5b89\u88c5Magento<\/h3>\n<p>Magento 2.4\u5f00\u59cb\u53ea\u80fd\u901a\u8fc7\u547d\u4ee4\u884c\u5b89\u88c5\u3002\u53c2\u8003\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"language-bash\">bin\/magento setup:install \\\n--base-url=http:\/\/test.magento.com \\\n--db-host=localhost \\\n--db-name=magento \\\n--db-user=magento \\\n--db-password=magento \\\n--admin-firstname=admin \\\n--admin-lastname=admin \\\n--admin-email=admin@admin.com \\\n--admin-user=admin \\\n--admin-password=admin123 \\\n--language=en_US \\\n--currency=USD \\\n--timezone=America\/Chicago \\\n--use-rewrites=1<\/code><\/pre>\n<p>\u6839\u636e\u81ea\u5df1\u7684\u60c5\u51b5\uff0c\u4fee\u6539\u53c2\u6570\u7684\u503c\u3002<\/p>\n<p>\u5b89\u88c5\u5b8c\u6bd5\u540e\uff0c\u4f1a\u51fa\u73b0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n<pre><code>[SUCCESS]: Magento installation complete.\n[SUCCESS]: Magento Admin URI: \/admin_vvxyuo\nNothing to import.<\/code><\/pre>\n<p>\u4ece\u4e2d\u83b7\u53d6\u540e\u53f0\u5165\u53e3\uff0c\u8fd9\u91cc\u7684\u5165\u53e3\u662f<code>admin_vvxyuo<\/code><\/p>\n<h3>Nginx\u914d\u7f6e<\/h3>\n<pre><code class=\"language-bash\">su root\ncd \/etc\/nginx\/conf.d\nvim test.magento.com.conf<\/code><\/pre>\n<pre><code>upstream fastcgi_backend {\n    server 127.0.0.1:9000;\n}\n\nserver {\n    listen 80;\n    server_name test.magento.com;\n\n    access_log  \/var\/log\/nginx\/magento.access.log main;\n    error_log  \/var\/log\/nginx\/magento.error.log error;\n\n    set $MAGE_ROOT \/var\/www\/html\/magento;\n    include \/var\/www\/html\/magento\/nginx.conf;\n}<\/code><\/pre>\n<pre><code class=\"language-bash\">cp \/var\/www\/html\/magento\/nginx.conf.sample \/var\/www\/html\/magento\/nginx.conf\nnginx -t\n# \u91cd\u542fnginx\nnginx -s reload\n# \u542f\u52a8php-fpm\n\/usr\/sbin\/php-fpm<\/code><\/pre>\n<p>\u8bbf\u95ee\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/test.magento.com\/\">http:\/\/test.magento.com\/<\/a><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/PHP\/Magento-HomePage.png\" alt=\"Magento \u4e3b\u9875\" \/><\/p>\n<p>\u8bbf\u95ee\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/test.magento.com\/admin_vvxyuo\">http:\/\/test.magento.com\/admin_vvxyuo<\/a><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/PHP\/Magento-Admin-Login.png\" alt=\"Magento \u7ba1\u7406\u767b\u5f55\" \/><\/p>\n<p>Magento 2.4\u540e\u53f0\u589e\u52a0\u4e86\u4e8c\u6b21\u9a8c\u8bc1\u529f\u80fd\uff0c\u767b\u5f55\u540e\uff0c\u8981\u51fa\u73b0\u4ee5\u4e0b\u63d0\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/PHP\/Magento-Admin-Login-TwoFactorAuth.png\" alt=\"Magento \u7ba1\u7406\u767b\u5f55\u4e8c\u6b21\u9a8c\u8bc1\" \/><\/p>\n<p>\u5982\u679c\u4e0d\u9700\u8981\u8fd9\u4e2a\u529f\u80fd\uff0c\u53ef\u4ee5\u7981\u7528<code>Magento_TwoFactorAuth<\/code>\u6a21\u5757\u3002<\/p>\n<pre><code class=\"language-bash\">cd \/var\/www\/html\/magento\/\nbin\/magento module:disable Magento_TwoFactorAuth<\/code><\/pre>\n<p>\u518d\u6b21\u5c1d\u8bd5\u767b\u5f55\uff0c\u6210\u529f\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.yezhou.me\/AppBlog\/images\/PHP\/Magento-Admin-Welcome.png\" alt=\"Magento \u7ba1\u7406\u540e\u53f0\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9996\u5148\u5230https:\/\/marketplace.magento.com\/\u83b7\u53d6username\u548cpassowd P [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[78],"tags":[397],"class_list":["post-1646","post","type-post","status-publish","format-standard","hentry","category-magento","tag-composer"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1646"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1646\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}