如何在Rocky Linux 9上安装Joomla

Linux命令 Edge插件网 2年前 (2023-03-11) 486次浏览 已收录 0个评论

Joomla是一种流行的内容管理系统(CMS),用于构建网站和Web应用程序。Joomla的管理界面直观且用户友好,其模块化架构允许开发人员轻松扩展和自定义平台。这使得Joomla成为构建各种网站和在线应用程序的强大而灵活的工具。它是免费和开源的,使其成为小型和大型企业的绝佳选择。如何在Rocky Linux 9上安装Joomla

在 Rocky Linux 9 上安装 Joomla

第 1 步。第一步是将系统更新到最新版本的软件包列表。为此,请运行以下命令:

<span class="pln">sudo dnf check</span><span class="pun">-</span><span class="pln">update
sudo dnf install dnf</span><span class="pun">-</span><span class="pln">utils epel</span><span class="pun">-</span><span class="pln">release mod_ssl</span>

第 2 步。安装阿帕奇。

默认情况下,Apache 在 Rocky Linux 9 基础存储库中可用。现在我们使用以下命令安装最新版本的 Apache:dnf

<span class="pln">sudo dnf install httpd httpd</span><span class="pun">-</span><span class="pln">tools</span>

您可以通过输入以下命令来启动服务并将其配置为在启动时运行:httpd

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

若要使页面向公众开放,必须使用以下命令编辑防火墙规则以允许 Web 服务器上的 HTTP 和 HTTPS 请求:

<span class="pln">sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">permanent </span><span class="pun">--</span><span class="pln">zone</span><span class="pun">=</span><span class="kwd">public</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 
sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">permanent </span><span class="pun">--</span><span class="pln">zone</span><span class="pun">=</span><span class="kwd">public</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 
sudo firewall</span><span class="pun">-</span><span class="pln">cmd </span><span class="pun">--</span><span class="pln">reload</span>

有关安装 Apache 的其他资源,请阅读下面的帖子:

  • 如何在 Rocky Linux √ 上安装 Apache。

第 3 步。安装 PHP。

PHP 是一种流行的脚本语言,可为数百万个网站和应用程序的动态内容提供支持。现在我们运行以下命令将 PHP 8 安装到您的 Rocky Linux 中:

<span class="pln">sudo dnf epel</span><span class="pun">-</span><span class="pln">release
sudo dnf install https</span><span class="pun">:</span><span class="com">//rpms.remirepo.net/enterprise/remi-release-9.rpm</span><span class="pln">
sudo dnf </span><span class="pun">--</span><span class="pln">disablerepo</span><span class="pun">=</span><span class="str">"*"</span> <span class="pun">--</span><span class="pln">enablerepo</span><span class="pun">=</span><span class="str">"remi-safe"</span><span class="pln"> list available 
sudo dnf </span><span class="kwd">module</span><span class="pln"> enable php</span><span class="pun">:</span><span class="pln">remi</span><span class="pun">-</span><span class="lit">8.1</span>

启用 Remi PHP 8.1 模块后,您现在可以安装 PHP 8.1 和常用的 PHP 扩展,如下所示:

<span class="pln">sudo dnf install php php</span><span class="pun">-</span><span class="pln">cli php</span><span class="pun">-</span><span class="pln">mysqlnd php</span><span class="pun">-</span><span class="pln">opcache php</span><span class="pun">-</span><span class="pln">xml php</span><span class="pun">-</span><span class="pln">gd php</span><span class="pun">-</span><span class="pln">pdo php</span><span class="pun">-</span><span class="pln">bcmath php</span><span class="pun">-</span><span class="pln">intl php</span><span class="pun">-</span><span class="pln">mbstring php</span><span class="pun">-</span><span class="pln">json php</span><span class="pun">-</span><span class="pln">zip unzip</span>

检查并验证已安装的版本:

<span class="pln">php </span><span class="pun">-</span><span class="pln">v</span>

有关安装 PHP 的其他资源,请阅读下面的帖子:

  • 如何在 Rocky Linux √ 上安装 PHP

第 4 步。安装 MariaDB。

默认情况下,MariaDB 在 Rocky Linux 9 基础存储库中可用。只需使用以下命令安装 MariaDB 软件包:dnf

<span class="pln">sudo dnf install mariadb</span><span class="pun">-</span><span class="pln">server mariadb</span>

安装完成后,启动数据库服务器的服务,然后启用相同的服务,以便它可以在系统重新启动时自动启动:

<span class="pln">sudo systemctl restart mariadb
sudo systemctl status mariadb
sudo systemctl enable mariadb</span>

默认情况下,MariaDB 未强化。您可以使用脚本保护 MariaDB。您应该仔细阅读并在每个步骤下方仔细阅读,这将设置root密码,删除匿名用户,禁止远程root登录,并删除测试数据库和对安全MariaDB的访问权限:mysql_secure_installation

<span class="pln">mysql_secure_installation</span>

首先,使用以下命令登录到 MariaDB shell:

<span class="pln">mysql</span>

现在我们使用以下命令为 Joomla 创建一个数据库和用户:

<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> CREATE DATABASE joomla_db</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> CREATE USER </span><span class="str">'joomla_user'</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="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> GRANT ALL ON joomla_db</span><span class="pun">.*</span><span class="pln"> TO </span><span class="str">'joomla_user'</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="pln"> WITH GRANT OPTION</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span><span class="pln"> flush privileges</span><span class="pun">;</span>
<span class="typ">MariaDB</span> <span class="pun">[(</span><span class="pln">none</span><span class="pun">)]></span> <span class="kwd">exit</span><span class="pun">;</span>

*请记住将joomla_dbjoomla_user密码替换为您自己的值。

有关安装 MariaDB 数据库的其他资源,请阅读以下帖子:

  • 如何在 Rocky Linux √ 上安装 MariaDB

第5步。在 Rocky Linux 9 上安装 Joomla。

现在使用以下命令从Joomla官方网站下载最新版本的Joomla:

<span class="pln">wget https</span><span class="pun">:</span><span class="com">//downloads.joomla.org/cms/joomla4/4-2-8/Joomla_4-2-8-Stable-Full_Package.tar.gz</span>

接下来,使用以下命令提取下载的包:

<span class="pln">tar </span><span class="pun">-</span><span class="pln">xvf </span><span class="typ">Joomla_4</span><span class="pun">-</span><span class="lit">2</span><span class="pun">-</span><span class="lit">8</span><span class="pun">-</span><span class="typ">Stable</span><span class="pun">-</span><span class="typ">Full_Package</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz</span>

使用以下命令将解压缩的 Joomla 目录移动到 Web 服务器文档根目录:

<span class="pln">sudo mv </span><span class="typ">Joomla_4</span><span class="pun">-</span><span class="lit">2</span><span class="pun">-</span><span class="lit">8</span><span class="pun">-</span><span class="typ">Stable</span><span class="pun">-</span><span class="typ">Full_Package</span><span class="com">/* /var/www/html/</span>

我们需要更改一些文件夹权限:

<span class="pln">sudo chown </span><span class="pun">-</span><span class="pln">R www</span><span class="pun">-</span><span class="pln">data</span><span class="pun">:</span><span class="pln">www</span><span class="pun">-</span><span class="pln">data </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 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>

第 6 步。配置 Apache vHost。

现在我们使用以下命令配置 Joomla VirtualHost 文件:

<span class="pln">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">joomla</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 admin@your-domain.com
   ServerName your-domain.com
   DocumentRoot /var/www/html/
   DirectoryIndex index.php

 </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="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/joomla_error.log
   CustomLog /var/log/httpd/joomla_access.log combined
</span><span class="tag"></VirtualHost></span>

保存并关闭文件,然后重新启动 Apache Web 服务器以使更改生效:

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

步骤 7.使用Let’s Encrypt SSL保护Joomla。

首先,使用以下命令安装 Certbot 客户端:

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

然后,运行以下命令以使用 Apache 生成证书:

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

让我们加密证书的有效期为 90 天,强烈建议在证书过期之前续订证书。您可以通过运行以下命令来测试证书的自动续订:

<span class="pln">sudo certbot renew </span><span class="pun">--</span><span class="pln">dry</span><span class="pun">-</span><span class="pln">run</span>

第8步。访问Joomla网页界面。

成功安装后,打开您的网络浏览器并使用 URL 访问 Joomla 。您将被重定向到以下页面:https://your-domain.com

如何在Rocky Linux 9上安装Joomla

感谢您使用本教程在您的 Rocky Linux 9 系统上安装 Joomla with LAMP。如需其他帮助或有用信息,我们建议您查看 Joomla 官方网站


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

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

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