如何在 Fedora 39 上安装 PrestaShop

Linux命令 Edge插件网 11个月前 (01-20) 578次浏览 已收录 0个评论

PrestaShop 是一个免费的开源电子商务平台,可让您创建在线商店。它是一个强大而灵活的平台,可用于销售各种产品和服务。

如何在 Fedora 39 上安装 PrestaShop

在 Fedora 39 上安装 PrestaShop

步骤 1。首先,通过运行以下命令确保您的 Fedora 系统是最新的:

<span class="pln">sudo dnf update</span>

第2步。安装 LAMP 堆栈。

在我们深入研究本教程之前,确保您的服务器配备了强大的 LAMP 堆栈至关重要。如果您还没有设置 LAMP,请不要担心——我们已经为您准备好了。只需按照我们提供的综合指南进行操作即可。

第 3 步。在 Fedora 39安装 PrestaShop

现在 d拥有最新版本的PrestaShop:

<span class="pln">wget https</span><span class="pun">:</span><span class="com">//github.com/PrestaShop/PrestaShop/releases/download/8.1.2/prestashop_8.1.2.zip</span>

将存档解压缩到 prestashop 目录:

<span class="pln">unzip prestashop_8</span><span class="pun">.</span><span class="lit">1.2</span><span class="pun">.</span><span class="pln">zip </span><span class="pun">-</span><span class="pln">d </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span>

设置必要的权限

<span class="pln">sudo chown </span><span class="pun">-</span><span class="pln">R apache</span><span class="pun">:</span><span class="pln">apache </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">prestashop
sudo chmod </span><span class="pun">-</span><span class="pln">R </span><span class="lit">755</span> <span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">prestashop</span>

第 4 步。为PrestaShop创建数据库。

登录 MariaDB:

<span class="pln">mysql </span><span class="pun">-</span><span class="pln">u root </span><span class="pun">-</span><span class="pln">p</span>

为 PrestaShop 创建数据库和用户:

<span class="pln">CREATE DATABASE prestashop</span><span class="pun">;</span><span class="pln">
GRANT ALL PRIVILEGES ON prestashop</span><span class="pun">.*</span><span class="pln"> TO </span><span class="str">'prestashop'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pln"> IDENTIFIED BY </span><span class="str">'your-strong-password'</span><span class="pun">;</span><span class="pln">
FLUSH PRIVILEGES</span><span class="pun">;</span><span class="pln">
EXIT</span><span class="pun">;</span>

第 5 步。为PrestaShop配置Apache。

为PrestaShop创建一个新的Apache配置文件:

<span class="pln">sudo nano </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">httpd</span><span class="pun">/</span><span class="pln">conf</span><span class="pun">.</span><span class="pln">d</span><span class="pun">/</span><span class="pln">prestashop</span><span class="pun">.</span><span class="pln">conf</span>

添加以下内容:

<span class="tag"><VirtualHost</span><span class="pln"> *:80</span><span class="tag">></span><span class="pln">
    ServerAdmin webmaster@your_domain.com
    DocumentRoot /var/www/html/prestashop
    ServerName your-domain.com
    ServerAlias www.your-domain.com

    </span><span class="tag"><Directory</span> <span class="pun">/</span><span class="atn">var</span><span class="pun">/</span><span class="atn">www</span><span class="pun">/</span><span class="atn">html</span><span class="pun">/</span><span class="atn">prestashop</span><span class="tag">/></span><span class="pln">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </span><span class="tag"></Directory></span><span class="pln">

    ErrorLog /var/log/httpd/prestashop_error.log
    CustomLog /var/log/httpd/prestashop_access.log combined
</span><span class="tag"></VirtualHost></span>

保存并关闭文件。然后,重新启动 Apache 以应用更改:

<span class="pln">sudo systemctl restart httpd</span>

第 6 步。使用SSL证书保护PrestaShop。

虽然是可选的,但对于PrestaShop等电子商务网站,强烈建议使用SSL加密流量。它可以保护交易期间传输的敏感客户数据。

我们将使用Let’s Encrypt的免费SSL证书。首先, 在 Apache 中启用 mod_ssl 模块:

<span class="pln">sudo dnf install mod_ssl</span>

接下来,安装 Certbot,这是一个自动从 Let’s Encrypt 获取 SSL 证书的工具:

<span class="pln">sudo dnf install certbot python3</span><span class="pun">-</span><span class="pln">certbot</span><span class="pun">-</span><span class="pln">apache</span>

运行 Certbot 以获取 SSL 证书。将您网站的域指定为参数:

<span class="pln">sudo certbot </span><span class="pun">--</span><span class="pln">apache </span><span class="pun">-</span><span class="pln">d prestashop</span><span class="pun">.</span><span class="pln">example</span><span class="pun">.</span><span class="pln">com</span>

按照提示指定联系人电子邮件并同意服务条款。Certbot 将与 Let’s Encrypt 服务器通信,并使用颁发的证书自动配置 Apache。

第 7 步。配置防火墙。

要在 Fedora 39 上为 PrestaShop 设置防火墙,您可以使用内置的防火墙管理工具 firewalld。如果尚未安装,可以使用以下命令安装 firewalld

<span class="pln">sudo dnf install firewalld</span>

安装后,使用以下命令启动防火墙服务并使其在启动时启动:

<span class="pln">sudo systemctl start firewalld
sudo systemctl enable firewalld</span>

PrestaShop 通常在 Web 服务器上运行,默认情况下,该服务器将端口 80 用于 HTTP,将端口 443 用于 HTTPS。您可以使用以下命令在防火墙中打开这些端口:

<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">service</span><span class="pun">=</span><span class="pln">http </span><span class="pun">--</span><span class="pln">permanent
sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="kwd">add</span><span class="pun">-</span><span class="pln">service</span><span class="pun">=</span><span class="pln">https </span><span class="pun">--</span><span class="pln">permanent</span>

进行更改后,使用以下命令重新加载防火墙以应用它们

<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">reload</span>

您可以使用以下命令验证更改是否已正确应用:

<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">list</span><span class="pun">-</span><span class="pln">all</span>

第 8 步。通过Web浏览器完成PrestaShop安装。

现在,通过在Web浏览器中导航到https//your-domain.com 来访问PrestaShop安装向导 。按照步骤配置您的商店、数据库和管理员帐户。

如何在 Fedora 39 上安装 PrestaShop

感谢您使用本教程在您的 Fedora 39 系统上安装 PrestaShop 电子商务。有关其他或有用的信息,我们建议您查看PrestaShop官方网站


Edge插件网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:如何在 Fedora 39 上安装 PrestaShop
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址