目录

说明

1、magento2.4需要elasticsearch7服务,首先安装elasticsearch7

2、修改elasticsearch配置

3、启动 elasticsearch7

4、验证服务

5、安装 magento2.4

1)下载magento2.4

A、下载安装包

B、composer方式

Access Key获得方式:

2)命令行开始安装magento

6、可能的问题:

1)由于是管理员账户安装的可能有的配置会有权限问题,用下面的命令修复一下。

2)修改目录文件所有权 daemon:daemon 根据实际情况修改 注意后面的 "." 不要忘了

3)刷新静态页面

4)后台登录需要双重验证

5)安装2.4.2版本报错:Declaration of Psr\Log\LoggerInterface\Proxy::emergency 问题解决

6)Failed to initialize global composer: Composer could not find the config file: var/composer_home/composer.json

7)Missing following extensions: 'xsl'


说明

这里只记录了主体部分的安装流程,和碰到的问题解决方式。虚拟站点创建部分没有做说明。目前不建议安装2.4.2版本有坑。

1、magento2.4需要elasticsearch7服务,首先安装elasticsearch7

curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.listsudo apt updatesudo apt install elasticsearch

2、修改elasticsearch配置

sudo nano /etc/elasticsearch/elasticsearch.yml
/etc/elasticsearch/elasticsearch.yml
. . .
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: localhost
. . .

3、启动 elasticsearch7

sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

4、验证服务

curl -X GET 'http://localhost:9200'

说明服务已经正常

安装elasticsearch插件,不安装会有报错

cd /usr/share/elasticsearch
bin/elasticsearch-plugin install analysis-phonetic
bin/elasticsearch-plugin install analysis-icu
sudo service elasticsearch restart

5、安装 magento2.4

我这里使用的是PHP 7.3.23版本,php安装可以参考 ubuntu 20 php-7.4.15 编译安装

PHP 7.3.23 (cli) (built: Oct 16 2020 13:58:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.23, Copyright (c) 1998-2018 Zend Technologieswith the ionCube PHP Loader + ionCube24 v10.4.1, Copyright (c) 2002-2020, by ionCube Ltd.with Zend OPcache v7.3.23, Copyright (c) 1999-2018, by Zend Technologies

1)下载magento2.4

A、下载安装包

下载地址 https://magento.com/tech-resources/download#archive-releases

解压到网站目录,或者FTP上传

tar xvzf magento-ce-2.4.0-2020-07-24-11-15-38.tar.gz

B、composer方式

安装composer1.9.0版本

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/bin/composer --version=1.9.0
All settings correct for using Composer
Downloading...Composer (version 1.9.0) successfully installed to: /usr/bin/composer.phar
Use it: php /bin/composer.phar

为方便使用进行重命名:

mv /bin/composer.phar /bin/composer

如果已经安装了其他版本的可以进行版本切换:

composer self-update 1.9.0

开始下载:

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

如果是第一次升级安装会提示输入验证信息,

Access Key获得方式:

1.打开https://marketplace.magento.com

2.注册账号这里就不说明了

3.打开My Profile

4.打开Access Keys

5.点击Create A New Access Key 创建key

6.输入名称

这里的Public Key 是Username, Private Key 是 Password

直接回车开始下载。

出现类似  pcntl_signal() has been disabled for security reasons  这样的错误是因为PHP禁用了pcntl_signal 命令,打开php.ini找到 disable_functions 这一行,删除对应的名称就可以了。

2)命令行开始安装magento

进入安装目录:

cd magento240

安装用到的的参数查询方式

语言代码列表   sudo php bin/magento info:language:list
货币代码列表 sudo php bin/magento info:currency:list
时区代码列表 sudo php bin/magento info:timezone:list

开始安装:

sudo php bin/magento setup:install --base-url=http://magento.local --db-host=localhost --db-name=magento.local --db-user=magento.local  --db-password=magento.local --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com  --admin-user=admin --admin-password=admin123 --language=it_IT --currency=EUR --timezone=Europe/Rome --use-rewrites=1 --search-engine=elasticsearch7 --elasticsearch-host=127.0.0.1 --elasticsearch-port=9200

安装完成 /admin_miv4ax 是随机产生的后台管理地址,可以在app/etc/env.php中修改

记得要创建虚拟站点我用的是Apache 2.4.46版本

6、可能的问题:

错误提示 Class Magento\Framework\App\ResourceConnection\Proxy does not exist

1)由于是管理员账户安装的可能有的配置会有权限问题,用下面的命令修复一下。

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 {} +
chmod u+x bin/magento

2)修改目录文件所有权

daemon:daemon是运行web服务的用户和组

sudo chown -R daemon:daemon . 

daemon:daemon 根据实际情况修改 注意:后面的 "." 不要忘了

3)刷新静态页面

php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:clean
php bin/magento cache:flush

4)后台登录需要双重验证

暴力方式先关了

php bin/magento module:disable Magento_TwoFactorAuth

5)安装2.4.2版本报错:Declaration of Psr\Log\LoggerInterface\Proxy::emergency 问题解决

因为PHP兼容问题,会报错 \\Psr\\Log\\LoggerInterface\\Proxy 的错误

    2.7834   21909600  31. Magento\Framework\App\ObjectManager->get($type = '\\Psr\\Log\\LoggerInterface\\Proxy') /www/wwwroot/magento242/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:1702.7834   21909656  32. Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create($requestedType = 'Psr\\Log\\LoggerInterface\\Proxy', $arguments = ???) /www/wwwroot/magento242/vendor/magento/framework/ObjectManager/ObjectManager.php:702.7834   21909656  33. Magento\Framework\Interception\ObjectManager\Config\Developer->getInstanceType($instanceName = 'Psr\\Log\\LoggerInterface\\Proxy') /www/wwwroot/magento242/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:472.7834   21909656  34. Magento\Framework\Interception\Config\Config->hasPlugins($type = 'Psr\\Log\\LoggerInterface\\Proxy') /www/wwwroot/magento242/vendor/magento/framework/Interception/ObjectManager/Config/Developer.php:612.7834   21909656  35. Magento\Framework\Interception\Config\Config->_inheritInterception($type = 'Psr\\Log\\LoggerInterface\\Proxy') /www/wwwroot/magento242/vendor/magento/framework/Interception/Config/Config.php:1802.7834   21910200  36. Magento\Framework\ObjectManager\Relations\Runtime->has($type = 'Psr\\Log\\LoggerInterface\\Proxy') /www/wwwroot/magento242/vendor/magento/framework/Interception/Config/Config.php:1572.7834   21910200  37. class_exists($classname = 'Psr\\Log\\LoggerInterface\\Proxy') /www/wwwroot/magento242/vendor/magento/framework/ObjectManager/Relations/Runtime.php:382.7834   21910296  38. spl_autoload_call($class_name = 'Psr\\Log\\LoggerInterface\\Proxy') /www/wwwroot/magento242/vendor/magento/framework/ObjectManager/Relations/Runtime.php:382.7835   21910392  39. Magento\Framework\Code\Generator\Autoloader->load($className = 'Psr\\Log\\LoggerInterface\\Proxy') /www/wwwroot/magento242/vendor/magento/framework/ObjectManager/Relations/Runtime.php:382.7835   21910392  40. Magento\Framework\Code\Generator->generateClass($className = 'Psr\\Log\\LoggerInterface\\Proxy') /www/wwwroot/magento242/vendor/magento/framework/Code/Generator/Autoloader.php:532.7848   21936400  41. Magento\Framework\Code\Generator\Io->includeFile($fileName = '/www/wwwroot/magento242/generated/code/Psr/Log/LoggerInterface/Proxy.php') /www/wwwroot/magento242/vendor/magento/framework/Code/Generator.php:1422.7850   21950144  42. include('/www/wwwroot/magento242/generated/code/Psr/Log/LoggerInterface/Proxy.php') /www/wwwroot/magento242/vendor/magento/framework/Code/Generator/Io.php:160

修复方法参考 更新magento 2.4.2 错误 PHP Fatal error:  Declaration of Psr\Log\LoggerInterface\Proxy::emergency 问题解决

6)Failed to initialize global composer: Composer could not find the config file: var/composer_home/composer.json

[Progress: 951 / 1206]
Module 'Magento_ComposerRootUpdatePlugin':
Running data recurring...Reading /www/wwwroot/magento240/composer.json
Loading config file /www/wwwroot/magento240/composer.json
Failed to initialize global composer: Composer could not find the config file: /www/wwwroot/magento240/var/composer_home/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading /www/wwwroot/magento240/vendor/composer/installed.json
Reading /www/wwwroot/magento240/composer.lock
Checking for "magento/composer-root-update-plugin: 1.1.0" for the Web Setup Wizard...
Reading /www/wwwroot/magento240/var/vendor/magento/composer-root-update-plugin/composer.json
Loading config file /www/wwwroot/magento240/var/vendor/magento/composer-root-update-plugin/composer.json
No Web Setup Wizard update needed for magento/composer-root-update-plugin; version 1.1.0 is already in /www/wwwroot/magento240/var.[Progress: 952 / 1206]

解决方法:

禁用magento/composer-root-update-plugin模块

php bin/magento module:disable Magento_ComposerRootUpdatePlugin

直接删除 magento/composer-root-update-plugin 模块

composer remove magento/composer-root-update-plugin 

7)Missing following extensions: 'xsl'

Starting Magento installation:
File permissions check...
[Progress: 1 / 1206]
Required extensions check...In Installer.php line 525:Missing following extensions: 'xsl'  

magento 需要下面这些PHP插件,打开php.ini文件开启对应的插件

ext-bcmath
ext-ctype
ext-curl
ext-dom
ext-gd
ext-hash
ext-iconv
ext-intl
ext-mbstring
ext-openssl
ext-pdo_mysql
ext-simplexml
ext-soap
ext-xsl
ext-zip

ubuntu 20 安装 magento2.4相关推荐

  1. ubuntu 20 安装mysql workbench 过程

    ubuntu 20 安装mysql workbench 过程,参考网站为https://phoenixnap.com/kb/mysql-workbench-ubuntu 步骤1:sudo apt up ...

  2. [tips] 1.2 优麒麟ubuntu 20安装ROS2 Foxy版本

    文件信息 about: 如何安装ros2 foxy版本,如何跑出小乌龟. email: jfq3301@163.com date: 2022.6.19 版本对应关系 ubuntu ros versio ...

  3. ubuntu 20 安装vnc_Windows 远程控制 Ubuntu 系统

    本文来自互联网上的小蜘蛛,分享给大家,希望对大家的学习有帮助. 有时需要在实际的电脑上安装Ubuntu的操作系统来搭建免费的网站平台.这就需要使用远程的客户端Windows系统来控制Ubuntu的电脑 ...

  4. Ubuntu 20安装 Qt5.9

    文章目录 安装Qt 1.安装包下载 2.修改权限进行安装 3.开始安装 4.在新窗口中选择next,然后输入安装路径进行安装 5.配置系统路径 6.测试配置 其他安装配置 创建桌面快捷方式 安装Qt ...

  5. Ubuntu 20 安装 pyodbc 数据库驱动

    pyodbc 是 python 常用的SQL Server驱动,但是这个包在 Ubuntu 下无法直接安装,需要先安装数据库驱动. sudo curl https://packages.microso ...

  6. Ubuntu 20安装微信3.0版本的方法 v2022

    相比之前使用QQ繁琐的操作步骤,微信简单很多.本文介绍的是优麒麟封装的第三方微信wine版本.注意这个wine必须安装,和之前介绍的QQ安装的wine不一样,要用的话两个都装.下图是使用效果: 1.下 ...

  7. ubuntu 20 安装 velodyne_simulator

    在github上 lmark1 /velodyne_simulator 上下载的velodyne_simulator编译后会有点问题,最终在 ROS wiki上找到了 git clone https: ...

  8. ubuntu系统怎么安装ssh服务器配置,如何在Ubuntu 20.04 LTS上安装SSH服务器

    Terminal Linux Logo 在 步骤1.首先,通过apt在终端中运行以下以下命令,确保所有系统软件包都是最新的. sudo apt update sudo apt upgrade 步骤2. ...

  9. 【SVO2.0 安装编译】Ubuntu 20.04 + Noetic

    ways one 链接: https://pan.baidu.com/s/1ZAkeD64wjFsDHfpCm1CB1w 提取码: kxx2 (downloads and use idirectly) ...

最新文章

  1. linux 内核调试信息在哪里,Linux kernel debug技巧----开启DEBUG选项
  2. 《WinForm开发系列之高级篇》Item2 TCP异步传输
  3. C#与VB.NET代码互相转换在线工具
  4. asp 调用java文件上传_用asp实现文件浏览、上传、下载的程序
  5. 模拟真实环境之内网漫游
  6. matlab 符号 推倒,【MATLAB】符号数学计算(四):符号表达式操作
  7. 报警服务器物理内存,服务器内存使用率优化
  8. html背景图片半透明遮罩,巧用CSS cross-fade()实现背景图像半透明效果
  9. 01.【设计模式】工厂模式
  10. 解决“error C1083: 无法打开包括文件: “HPSocket.h”: No such file or directory”
  11. Apache FtpServer详解
  12. python中axis=0和axis=1的理解
  13. 从身家500万到两手空空,看她如何再次成功翻身
  14. Swift 基本知识点之三流程控制
  15. 物联网平台由哪些架构组成
  16. 运用docker部署nessus+awvs
  17. 牛客小白月赛20 E.区区区间
  18. 【游戏策划】之神仙道的计算公式
  19. 2维旋转矩阵的推导方式
  20. NYOJ T485 A*B Problem

热门文章

  1. Sitecore开发之组件渲染
  2. 微软MSDN文档及应用加速下载
  3. python 美化ppt_用python做ppt服务用于导入图片
  4. 中式红木装修,最适合别墅的装修风格!
  5. 极客日报第124期:脉脉因“App 整改下架”事件致歉;阿里云全年营收超 600 亿;腾讯防大量群消息骚扰专利获授权
  6. pythonchallenge闯关游戏_PythonChallenge闯关游戏——第16-20关
  7. 天梯赛模拟训练【3】
  8. 牛客网练习题 - 下厨房(Java)
  9. 算法 — 纸牌三角形
  10. 转帖]成功创业家的心理