Joomla是一种流行且广泛使用的CMS(内容管理系统),用于在标记或 Web 编程语言知识很少或根本不了解的情况下创建网站。它附带了大量PHP代码、插件和主题,可以帮助您立即从头开始。
在本指南中,我们将演示如何在Debian 10上安装Joomla CMS。
让我们引导您完成Joomla CMS安装过程。
第1步:更新Debian系统包
我们首先通过运行以下apt 命令将Debian系统软件包更新到最新版本。
$ sudo apt update -y && sudo apt update -y
步骤 2:在 Debian 上安装 LAMP Stack
LAMP堆栈是一种流行的免费开源 Web 托管堆栈,用于托管网站。它是Linux、Apache、MySQL/MariaDB和PHP的缩写。我们将在这些组件上安装每个组件。如果您已经安装了LAMP,则可以跳过此步骤。
我们将首先安装Apache Web 服务器、PHP,最后安装MariaDB服务器。
在 Debian 上安装 Apache
要安装Apache,请执行以下命令:
$ sudo apt install apache2 apache2-utils
现在启动并启用 Apache Web 服务器。
$ sudo systemctl 启动 apache2 $ sudo systemctl 启用 apache2
要确保 Apache Web 服务器正在运行,请使用以下命令进行确认:
$ sudo systemctl 状态 apache2
从输出中,我们可以清楚地看到 Apache Web 服务器已按预期启动并运行。
同样,您可以转到浏览器并浏览服务器的 IP,如图所示。
http://服务器IP
这是您应该得到的确认信息,表明您的网络服务器已启动并正在运行。
在 Debian 中安装 PHP
PHP是一种服务器端 Web 编程语言,开发人员使用它来设计动态网页。我们将安装PHP 7.2。
$ sudo apt install libapache2-mod-php7.2 openssl php-imagick php7.2-common php7.2-curl php7.2-gd php7.2-imap php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-pgsql php-smbclient php-ssh2 php7.2-sqlite3 php7.2-xml php7.2-zip
安装完成后,使用以下命令确认 PHP 版本:
$ php -v
在 Debian 中安装 MariaDB
The last component of the LAMP stack is the database server, which in this case will be MariaDB. MariaDB is a free and open-source database engine which was forked from MySQL.
To install MariaDB execute the command:
$ sudo apt install mariadb-server
Upon installation, extra steps are needed to secure the database server. This is primarily because the default settings are weak and leave the server prone to security breaches. So, to fortify the server, run the command:
$ sudo mysql_secure_installation
Press ENTER when prompted for the root password and press ‘Y’
to set the root password.
For subsequent prompts, simply type ‘Y’
and press the ENTER key for recommended settings.
We have finally secured our database engine.
Step 3: Create a Joomla Database
In this section, we are going to create a database for Joomla to store its files during and after the installation.
So, log in to MariaDB as shown:
$ sudo mysql -u root -p
We are now going to create the Joomla database, Joomla database user and grant privileges to the database user using the command below.
MariaDB [(none)]> CREATE DATABASE joomla_db; MariaDB [(none)]> GRANT ALL ON joomla_db.* TO ‘joomla_user’@’localhost’ IDENTIFIED BY ‘StrongP@ssword’; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> EXIT;
Step 4: Download Joomla in Debian
Let’s now download Joomla’s installation package from the Official Joomla’s website. At the time of penning down this guide, the latest version is Joomla 3.9.16.
To download the latest Joomla package, execute the wget command.
$ sudo wget https://downloads.joomla.org/cms/joomla3/3-9-16/Joomla_3-9-16-Stable-Full_Package.zip
This will take a minute or two depending on your internet speed. Upon completion of the download, create a new directory ‘joomla’ in the webroot directory as shown.
$ sudo mkdir -p /var/www/html/joomla
Thereafter, unzip the zipped Joomla file to the just created ‘Joomla’ directory.
$ sudo unzip Joomla_3.19-16-Stable-Full_package.zip -d /var/www/html
Next, set the directory ownership of the directory to Apache user and change the permissions as indicated below:
$ sudo chown -R www-data:www-data /var/www/html/joomla $ sudo chmod -R 755 /var/www/html/joomla
For systemd to effect the changes, restart the Apache webserver.
$ sudo systemctl restart apache2
Step 5: Configuring Apache for Joomla
最后,我们需要配置 Apache 网络服务器来服务器 Joomla 网页。为此,我们将为 Joomla 创建一个虚拟主机文件,如图所示。
$ sudo vim /etc/apache2/sites-available/joomla.conf
将以下配置粘贴到文件中并保存。
<虚拟主机 *:80> 服务器名称 joomla.example.com 服务器管理员 webmaster@example.com 文档根目录 /var/www/html/joomla <目录/var/www/html/joomla> 允许覆盖全部 </目录> </虚拟主机>
然后禁用默认配置文件并启用 Joomla 虚拟主机文件,如图所示。
$ sudo a2dissite 000-default.conf $ sudo a2ensite joomla.conf
然后重新启动 Apache Web 服务器服务以使更改生效。
$ sudo systemctl 重新启动 apache2
第 6 步:在 Debian 中完成 Joomla 安装
完成 Joomla 的安装。启动浏览器并浏览服务器的 URL,如图所示。
http://服务器IP/
将显示以下页面。要继续,请确保填写所需的详细信息,例如站点名称、电子邮件地址、用户名和密码。
完成后,单击“下一步”按钮。下一部分将要求您填写之前在为 Joomla 创建数据库时指定的数据库详细信息。其中包括数据库名称、数据库用户和密码。
然后单击“下一步”。后续页面将为您提供所有设置的概述,并允许您执行安装前检查。
向下滚动到“安装前检查”和“推荐设置”部分,并确保所有设置和安装的软件包版本均符合推荐准则。
然后单击“安装”按钮开始 Joomla 安装。完成后,您将收到以下通知,表明 Joomla 已安装。
但是,要继续下一步,您将需要清除或删除安装文件夹。因此,向下滚动并单击如下所示的“删除安装文件夹”按钮。
要登录后端或仪表板,请单击“管理员”按钮,该按钮将带您进入显示的登录页面。
提供您的用户名和密码,然后单击“登录”按钮访问 Joomla 的控制面板,如图所示。
就是这样!我们已经在Debian 10上成功安装了Joomla。