宝塔 magento2.4.6 安装(自用版)

magento 流程:

安装Java 配置Java环境 (es8 内置java环境 不需要配置)

安装elasticsearch8 版本 (版本一定要符合否则会有索引错误)

php 8.1

mysql 8.0

卸载宝塔
wget http://download.bt.cn/install/bt-uninstall.sh
 
sh bt-uninstall.sh

1.宝塔配置java环境

(1)创建安装目录
mkdir /usr/local/java/
(2)上传jdk 压缩包 解压压缩包
(3)进入解压目录 pwd 获取路径
(4)设置环境变量
首先在/etc/profile.d目录下新建一个java.sh脚本,
sudo touch /etc/profile.d/java.sh
然后给该文件赋上可写和可执行权限
sudo chmod a+wx /etc/profile.d/java.sh
打开文件编辑脚本
export JAVA_HOME=/usr/local/java/jdk-17.0.6
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

(5)使环境变量生效
source /etc/profile
(6)添加软链接
ln -s /usr/local/java/jdk1.8.0_251/bin/java /usr/bin/java
(7)检查
java -version

unlink /usr/local/java/jdk1.8.0_251/bin/java /usr/bin/java

sudo shutdown -r now  (重启服务器)

2.安装es8

用户名esuser 密码:trhhty@123

新版内置java环境 不需要配置了 在www目录下安装

//创建用户组 
groupadd esgroup

//创建用户
useradd -g esgroup esuser

//设置权限
chown -R esuser:esgroup /www/wwwroot/es

//设置密码
passwd esuser

//切换用户
su  esuser

下载Elasticsearch8.4.0,并安装运行
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.4.0-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-8.4.0-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-8.4.0-linux-x86_64.tar.gz.sha512 
tar -xzf elasticsearch-8.4.0-linux-x86_64.tar.gz
cd elasticsearch-8.4.0/ 

//启动es
./bin/elasticsearch

//后台启动es
./bin/elasticsearch -d -p pid

//查找es进程
ps -ef | grep elastic

//杀死进程
kill -9 2382(进程号)

直接访问
http://ip:9200


//需要修改的文件

修改linux 内核参数
修改/etc/security/limits.conf 增加下面内容
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 131072

修改/etc/sysctl.conf 增加下面内容
vm.max_map_count=655360

然后执行命令,使配置生效
sysctl -p

/config/elasticsearch.yml  修改或者取消注释
启动前:
cluster.name: my-application
node.name: node-1
network.host: 0.0.0.0
http.port: 9200
cluster.initial_master_nodes: ["node-1"]
启动后:
xpack.security.enabled: false
xpack.security.enrollment.enabled: false

更改 composer 秘钥在这里插入图片描述

composer config -l -g

修改composer的auth.json里的账号密码

安装magento

magento 配置环境 (这里推荐大家去看一下magento 官网 配置要求)

php8.1 需要安装的php扩展

获取原包:
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2.4.6

第一次安装会提示输入验证信息

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

composer依赖包安装中出现这个错误:

guo@guoiMac yoshop2.0 % composer install 
No lock file found. Updating dependencies instead of installing from lock file. Use composer update over composer install if you do not have a lock file.
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires topthink/framework, it could not be found in any version, there may be a typo in the package name.
  Problem 2
    - Root composer.json requires topthink/think-orm, it could not be found in any version, there may be a typo in the package name.
  Problem 3
    - Root composer.json requires topthink/think-multi-app, it could not be found in any version, there may be a typo in the package name.
  Problem 4
    - Root composer.json requires qiniu/php-sdk, it could not be found in any version, there may be a typo in the package name.
  Problem 5
    - Root composer.json requires aliyuncs/oss-sdk-php, it could not be found in any version, there may be a typo in the package name.
  Problem 6
    - Root composer.json requires qcloud/cos-sdk-v5, it could not be found in any version, there may be a typo in the package name.
  Problem 7
    - Root composer.json requires kosinix/grafika, it could 

解决:
先查看包来源地址,查询命令: composer config -l -g

执行命令: composer config -g repo.packagist composer https://packagist.org

而后composer install完美成功。

导入magento 数据库

php bin/magento sampledata:deploy
./bin/magento setup:install \
--base-url=http://www.magento3.c \
--db-host=localhost \
--db-name=www_magento3_c \
--db-user=root \
--db-password=admin \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=(邮箱账号) \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--search-engine=elasticsearch8 \
--elasticsearch-host=http://localhost \
--elasticsearch-port=9200

后台地址:http://www.magento3.c/admin_ffp3l7

本地需要添加host文件

升级:php bin/magento setup:upgrade
magento无法加载 css和js文件 需要安装
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex

magento后台登录强制开启二次验证需要关掉
进入bin目录下
php magento maintenance:enable  开始维护模式
./magento module:disable Magento_AdminAdobeImsTwoFactorAuth
./magento module:disable Magento_TwoFactorAuth
./magento cache:flush
./magento maintenance:disable 关闭维护模式

#查看模块    php bin/magento module:status
#开启模块    php bin/magento module:enable
#关闭模块    php bin/magento module:disable


页面出现缓存文件报错 修改权限为777


 Command "setup" is not defined.              
                                               
  Did you mean one of these?                   
      setup:backup                             
      setup:config:set                         
      setup:db-data:upgrade                    
      setup:db-declaration:generate-patch      
      setup:db-declaration:generate-whitelist  
      setup:db-schema:upgrade                  
      setup:db:status                          
      setup:di:compile                         
      setup:install                            
      setup:performance:generate-fixtures      
      setup:rollback                           
      setup:static-content:deploy              
      setup:store-config:set                   
      setup:uninstall                          
      setup:upgrade  
      
      
      未定义命令“setup”。



你是说其中一个吗?

设置:备份

设置:配置:设置

设置:数据库数据:升级

设置:数据库声明:生成修补程序

设置:数据库声明:生成白名单

设置:数据库架构:升级

设置:数据库:状态

设置:di:编译

安装:安装

设置:性能:生成装置

设置:回滚

设置:静态内容:部署

设置:存储配置:设置

安装:卸载

设置:升级



更换模板:
上传app 和 pub文件

升级:php bin/magento setup:upgrade
升级之后需要更新索引跟缓存 如果索引出现错误也可用下面命令更新索引
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值