如何在 MacOS 上安装 Magento。

17 Mar 2025 | 阅读 2 分钟

引言

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

前提条件

  1. MacOS
  2. 以管理员身份登录终端
  3. PHP 扩展 dom。
  4. PHP 扩展 Curl。
  5. PHP 扩展 mcrypt。
  6. PHP 扩展 simplexml。
  7. PHP 扩展 spl。
  8. PHP 扩展 xsl。
  9. PHP 扩展 intl。
  10. PHP 扩展 mbstring。
  11. PHP 扩展 ctype。
  12. PHP 扩展 hash。
  13. PHP 扩展 openssl。
  14. PHP 扩展 zip。
  15. PHP 扩展 xmlwriter。
  16. PHP 扩展 gd。
  17. PHP 扩展 iconv。

安装

安装包括以下步骤。

1. 下载并解压文件

为了在 MacOS 上安装 Magento,我们需要首先访问其官方网站 https://magento.com/tech-resources/download.Extract 下载文件。将文件解压到 /Library/WebServer/Documents 目录下,并运行以下命令。

2. 启动开发服务器

导航到解压 Magento 的目录,并运行以下命令以启动 PHP 开发服务器。

How to install Magento on MacOS

3. 在浏览器中访问

我们只需要在浏览器的搜索栏中输入 localhost:8080 即可在浏览器中访问 Magento,我们将看到一个如下所示的浏览器屏幕。

How to install Magento on MacOS

点击 Agree and setup Magento(同意并设置 Magento)进入下一步。

How to install Magento on MacOS

点击 Start Readiness check(开始准备情况检查),系统将开始检查是否满足要求。

How to install Magento on MacOS

此步骤提示我们填写数据库详细信息。为此,我们需要通过运行以下命令来创建 MySQL 数据库。

其中 root 是用户名,123 是密码。现在我们可以通过在 MySQL shell 中键入以下命令来创建数据库。

现在我们可以按如下方式填写数据库详细信息。

How to install Magento on MacOS
How to install Magento on MacOS
How to install Magento on MacOS
How to install Magento on MacOS
How to install Magento on MacOS
How to install Magento on MacOS

因此,现在我们在 MacOS 上安装了 Magento。使用用户名和密码登录到网站。