一、首先是服务器环境要支持magento2.4的安装要求
# yum -y update
查看系统版本
cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
升级到最新
php版本要用7.3-7.4
# mysql -V
mysql Ver 15.1 Distrib 10.4.12-MariaDB, for Linux (x86_64) using readline 5.1
[root@riben ~]# php -v
PHP 7.3.21 (cli) (built: Aug 11 2020 15:36:15) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.21, Copyright (c) 1998-2018 Zend Technologies
mysql版本
#mysql -V
mysql Ver 15.1 Distrib 10.4.12-MariaDB, for Linux (x86_64) using readline 5.1
apache版本
# httpd -v
Server version: Apache/2.4.46 (Unix)
Server built: Sep 5 2020 15:10:25
elasticsearch版本
# curl -XGET localhost:9200
{
"name" : "node-1",
"cluster_name" : "my-application",
"cluster_uuid" : "Tno9juGQQxS1De87hK59LA",
"version" : {
"number" : "7.9.1",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "083627f112ba94dffc1232e8b42b73492789ef91",
"build_date" : "2020-09-01T21:22:21.964974Z",
"build_snapshot" : false,
"lucene_version" : "8.6.2",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
二、升级步骤
php bin/magento deploy:mode:set developer
或修改.htaccess SetEnv MAGE_MODE developer
1.查看当前可升级的版本
# su www
[www@riben www.xxx.com]$ composer show magento/product-community-edition 2.4.* --all | grep -m 1 versions
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/usr/bin/composer self-update" to get the latest version.
versions : * 2.4.0
Public Key: 439be94e9e5d38add408b7807175bcb5
Private Key: ac1b2e78eaae12a631a19461f1e4b5c0
2.备份一下composer.json
cp composer.json composer.json.bak
3.升级到的Magento软件包,选择最新的2.4.0
$composer require magento/product-community-edition=2.4.0 --no-update
提示:You are running Composer with SSL/TLS protection disabled.
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/usr/bin/composer self-update" to get the latest version.
#/usr/bin/composer self-update
--------$composer global require "fxp/composer-asset-plugin:~1.1.1"
#composer self-update --stable
---------#composer self-update --preview
把composer.json改以上面版本
4.升级
su www
----------composer update --no-plugins
composer update
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
bin/magento cache:clean
三、登陆遇到收邮件问题
https://magento.stackexchange.com/questions/318485/you-need-to-configure-two-factor-authorization-in-order-to-proceed
$bin/magento module:disable Magento_TwoFactorAuth
Problem 1
- Root composer.json requires magento/magento2-functional-testing-framework ~2.3.14 -> satisfiable by magento/magento2-functional-testing-framework[2.3.14].
- magento/magento2-functional-testing-framework 2.3.14 requires php 7.0.2|7.0.4|~7.0.6|~7.1.0|~7.2.0 -> your php version (7.3.22) does not satisfy that requirement.
Problem 2
- laminas/laminas-dependency-plugin[1.0.0, ..., 1.0.4] require composer-plugin-api ^1.1 -> found composer-plugin-api[2.0.0] but it does not match the constraint.
- magento/product-community-edition 2.4.0 requires laminas/laminas-dependency-plugin ^1.0 -> satisfiable by laminas/laminas-dependency-plugin[1.0.0, ..., 1.0.4].
- Root composer.json requires magento/product-community-edition 2.4.0 -> satisfiable by magento/product-community-edition[2.4.0].
[Composer\Downloader\FilesystemException]
Filesystem exception:
Composer update failed: "/www/server/php/73/bin/composer" could not be writ
ten.
rename(/home/www/.cache/composer/composer-temp.phar,/www/server/php/73/bin/
composer): Permission denied
composer self-update --stable
Upgrading to version 1.10.13 (stable channel).
Use composer self-update --rollback to return to version 2.0.0-RC1
$ composer update --no-plugins
修改数据库 config_data
catalog/search/engine | elasticsearch7 |
需要自己动手解决插件不兼容问题
Could not validate a connection to Elasticsearch. No alive nodes found in your cluster
systemctl status elasticsearch
systemctl restart elasticsearch