如何在 CentOS 上安装 Magento

17 Mar 2025 | 阅读 2 分钟

引言

Magento 是一个由 Varien Inc 开发的开源电子商务平台。它完全用 PHP 编写,并于 2008 年 3 月 31 日 发布。它被 e-bay 收购,并于 2015 年 11 月 17 日发布了 Magento2。在本教程中,我们将介绍如何在 CentOS 上安装 Magento。

前提条件

  • CentOS7
  • LAMP (Linux Apache MySQL PHP)

以下 PHP 扩展

  • PHP 扩展 dom。
  • PHP 扩展 Curl。
  • PHP 扩展 mcrypt。
  • PHP 扩展 simplexml。
  • PHP 扩展 spl。
  • PHP 扩展 xsl。
  • PHP 扩展 intl。
  • PHP 扩展 mbstring。
  • PHP 扩展 ctype。
  • PHP 扩展 hash。
  • PHP 扩展 openssl。
  • PHP 扩展 zip。
  • PHP 扩展 xmlwriter。
  • PHP 扩展 gd。
  • PHP 扩展 iconv。

安装

安装包括以下步骤。

1. 下载并解压 Magento

访问 Magento 的官方网站 https://magento.com/tech-resources/download,下载 Magento 的最新压缩源代码文件。使用以下命令解压下载的文件。

2. 运行 Composer Install

将工作目录更改为 Magento 目录,然后运行以下命令。

CentOS How to Install Magento on CentOS

3. 启动 PHP 开发服务器

只需键入 cd magento2-2.2.2 即可将当前工作目录更改为 Magento 的安装目录,然后执行以下命令以启动 PHP 开发服务器。

CentOS How to Install Magento on CentOS 1

4. 在浏览器上访问

为了在系统上安装 Magento,我们只需要在浏览器的搜索栏中输入 localhost:8082,通过浏览器访问它。

浏览器窗口将如下所示。

CentOS How to Install Magento on CentOS 2

点击 Agree and setup Magento 以继续 Magento 安装。

CentOS How to Install Magento on CentOS 3

点击 Start Reediness Check 以让 Magento 检查 PHP 版本和其他要求。

CentOS How to Install Magento on CentOS 4

现在 Magento 已经检查了所有已满足的要求。现在我们需要创建一个名为 magento 的数据库(在我的例子中)。打开 MySQL shell 并输入 create database magento; 以创建数据库。

CentOS How to Install Magento on CentOS 5 CentOS How to Install Magento on CentOS 6

安装的这部分会提示我们填写有关刚创建的数据库的所有详细信息。输入所有详细信息,例如数据库服务器用户名、密码和数据库名称,然后单击 Next

CentOS How to Install Magento on CentOS 7

此步骤提示我们设置 Web 配置,例如商店地址和应唯一的 magneto Admin 地址。选择地址(我选择了 javatpoint123)并单击 Next

CentOS How to Install Magento on CentOS 8

现在,我们必须通过设置默认时区和货币详细信息来自定义我们的网站。设置所有所需的详细信息,然后单击 Next

CentOS How to Install Magento on CentOS 9

填写此步骤中要求的所有所需步骤,例如新用户名、电子邮件和密码。单击 Next,我们将准备好 Magento 安装的设置。单击 Install Now 开始安装过程。

CentOS How to Install Magento on CentOS 10

现在,Magento 已成功安装在我们的 CentOS 上。以下页面显示所有数据库信息、商店地址和登录凭据。

CentOS How to Install Magento on CentOS 11

因此,我们已经安装并开始使用 Magento。单击 Launch Magento Admin 以启动应用程序。


下一个主题安装 VLC