ubuntu 20 安装 magento2.4

一、magento2.4须要elasticsearch7服务,首先安装elasticsearch7php

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.list

sudo apt update

sudo apt install elasticsearch

二、修改配置app

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
. . .

三、启动 elasticsearch7curl

sudo systemctl start elasticsearch
sudo systemctl enable elasticsearch

四、验证服务elasticsearch

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

 

说明服务已经正常网站

五、安装 magento2.4 url

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

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

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

  安装用到的的参数查询3d

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

命令行开始安装magentocode

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_aidf67是随机产生的后台管理地址

可能的问题:

一、因为是管理员帐户安装的可能有的配置会有权限问题,用下面的命令修复一下。

sudo find . -type d -exec chmod 755 {} \; 
sudo find . -type f -exec chmod 664 {} \;
sudo find . -type f -name "*.sh" -exec chmod 774 {} \;
sudo find var generated vendor pub/static pub/media app/etc var/page_cache -type f -exec chmod g+w {} + && sudo find var generated vendor pub/static pub/media app/etc var/page_cache -type d -exec chmod g+ws {} + && sudo chmod u+x bin/magento

二、修改目录文件全部权 daemon:daemon 根据实际状况修改 注意后面的 "." 不要忘了

sudo chown -R daemon:daemon .

三、 刷新静态页面

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

四、后台登陆须要双重验证

 暴力方式先关了

php bin/magento module:disable Magento_TwoFactorAuth