如何在 Ubuntu 20.04 LTS 上安装 Bagisto

Bagisto 是一个免费的电子商务平台,为任何想要经营在线商店的人构建了Laravel电子商务框架。Bagisto 有一个内置的易于导航的管理面板,并与多货币、多本地化、访问控制级别、多渠道、支付集成等功能捆绑在一起。

在 Ubuntu 20.04 LTS Focal Fossa 上安装 Bagisto

步骤 1. 首先,通过apt在终端中运行以下命令确保所有系统包都是最新的。

sudo apt update
sudo apt upgrade

步骤 2. 安装 LAMP 堆栈。

需要 Ubuntu 20.04 LAMP 服务器。如果您没有安装 LAMP,您可以在此处按照我们的指南进行操作。

步骤 3. 安装 Node.js 和 Composer。

Bagisto 需要 Node.Js。要从其 LTS 存储库在 Ubuntu 上安装 Node.js,请运行以下命令进行安装:

curl -sL https://deb.nodesource.com/setup_14.x | bash -
sudo apt install nodejs

使用以下命令验证 Node.js 版本:

node -v

接下来,安装用于管理 PHP 依赖项的 Composer。您可以使用以下命令安装它:

curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

步骤 4. 在 Ubuntu 20.04 上安装 Bagisto。

现在我们运行以下命令从 GitHub 下载最新版本的 Bagisto:

wget https://github.com/bagisto/bagisto/archive/refs/tags/v1.3.2.zip
unzip v1.3.1.zip
mv bagisto-1.3.1 /var/www/html/bagisto

接下来,导航到 Bagisto 目录并安装 PHP 依赖项:

cd /var/www/html/bagisto
composer install

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

chown -R www-data:www-data /var/www/html/bagisto/

步骤 5. 配置 MariaDB。

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

mysql_secure_installation

像这样配置它:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

接下来,我们需要登录到 MariaDB 控制台并为 Bagisto 创建一个数据库。运行以下命令:

mysql -u root -p

这将提示您输入密码,因此请输入您的 MariaDB 根密码并按 Enter。登录到数据库服务器后,您需要为 Bagisto 安装创建一个数据库:

MariaDB [(none)]> CREATE DATABASE bagistodb;
MariaDB [(none)]> CREATE USER 'bagistouser'@'localhost' IDENTIFIED BY 'your-strong-passwd';
MariaDB [(none)]> GRANT ALL ON bagistodb.* TO 'bagistouser'@'localhost' WITH GRANT OPTION;
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

步骤 6. 配置 Apache 网络服务器。

现在在 Apache 中创建一个新的虚拟主机指令。例如,在您的虚拟服务器上创建一个名为“ ”的新 Apache 配置文件:bagisto.conf

touch /etc/apache2/sites-available/bagisto.conf
ln -s /etc/apache2/sites-available/bagisto.conf /etc/apache2/sites-enabled/bagisto.conf
nano /etc/apache2/sites-available/bagisto.conf

添加以下几行:

<VirtualHost *:80>
     ServerAdmi admin@your-domain.com
     DocumentRoot /var/www/html/bagisto/public
     ServerName bagisto.your-domain.com

     <Directory /var/www/html/bagisto/public/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

现在,我们可以重新启动 Apache 网络服务器以进行更改:

sudo a2enmod rewrite
sudo a2ensite bagisto.conf 
sudo systemctl restart apache2

步骤 7. 设置 HTTPS。

我们应该在 Bagisto 上启用安全的 HTTPS 连接。我们可以从 Let’s Encrypt 获得免费的 TLS 证书。从 Ubuntu 20.04 存储库安装 Let’s Encrypt 客户端 (certbot):

sudo apt install certbot python3-certbot-apache

接下来,运行以下命令以使用 Apache 插件获取免费的 TLS 证书:

sudo certbot --apache --agree-tos --redirect --staple-ocsp --email you@example.com -d example.com

如果测试成功,请重新加载 Apache 以使更改生效:

sudo apache2ctl -t
sudo systemctl reload apache2

步骤 8. 访问 Bagisto Web 界面。

成功安装后,现在打开您的 Web 浏览器并使用 URL 访问 Bagisto Web UI 。您应该看到以下屏幕:https://bagisto.your-domain.com

bagisto-web-interface

感谢您使用本教程在 Ubuntu 20.04 LTS Focal Fossa 系统上安装 Bagisto 电子商务平台。如需更多帮助或有用信息,我们建议您查看Bagisto 官方网站

未经允许不得转载:统信UOS之家 » 如何在 Ubuntu 20.04 LTS 上安装 Bagisto

相关文章