如何在 Ubuntu 16.04 上安装 Shopware

[ad_1]

在本教程中,我们将向您展示如何在 Ubuntu 16.04 上安装和配置 Shopware。 对于那些不知道的人,Shopware 是德国制造的下一代开源电子商务软件。 基于 Symfony 2、Doctrine 2 和 Zend Framework Shopware 等前沿技术,它是您下一个电子商务项目的完美平台。 此外,Shopware 提供事件驱动的插件系统和高级挂钩系统,使您能够自定义平台的每个部分。

本文假设您至少具备 Linux 的基本知识,知道如何使用 shell,最重要的是,您将网站托管在自己的 VPS 上。 安装非常简单,假设您在 root 帐户下运行,如果不是,您可能需要添加 ‘sudo‘ 到命令以获取 root 权限。 我将向您展示在 Ubuntu 16.04 LTS (Xenial Xerus) 服务器上逐步安装 Shopware。

先决条件

  • 运行以下操作系统之一的服务器:Ubuntu 16.04 LTS (Xenial Xerus)。
  • 建议您使用全新的操作系统安装来防止任何潜在问题。
  • 对服务器的 SSH 访问(或者如果您在桌面上,则只需打开终端)。
  • 一种 non-root sudo user或访问 root user. 我们建议充当 non-root sudo user,但是,如果您在充当 root 时不小心,可能会损害您的系统。

在 Ubuntu 16.04 上安装 Shopware

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

sudo apt-get update
sudo apt-get upgrade

步骤 2. 安装 LAMP (Linux, ApacheMariaDB, PHP) 服务器。

需要 Ubuntu 16.04 LAMP 服务器。 如果您没有安装 LAMP,您可以在此处按照我们的指南进行操作。 此外,安装所有必需的 PHP 模块:

apt-get install php5 php5-mysql php5-gd php5-curl libssh2-php

步骤 3. 安装 Shopware。

首先要做的就是去 Shopware的下载页面 并下载最新的稳定版 Shopware,在撰写本文时它是第 5 版:

wget https://github.com/shopware/shopware/archive/v5.1.6.zip
unzip v5.1.6.zip -d /var/www/html
cd /var/www/html/shopware-5.1.6
cp -a * ..

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

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

步骤 4. 为 Shopware 配置 MariaDB。

默认情况下,MariaDB 未加固。 您可以使用 mysql_secure_installation 脚本。 您应该仔细阅读下面的每个步骤,这些步骤将设置 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 控制台并为 Shopware 创建一个数据库。 运行以下命令:

mysql -u root -p

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

CREATE DATABASE shopware;
GRANT ALL PRIVILEGES ON shopware.* TO 'shopware'@'localhost' IDENTIFIED BY 'strong_password';
FLUSH PRIVILEGES;
q

步骤 5. 配置 Apache Shopware 的网络服务器。

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

sudo a2enmod rewrite
touch /etc/apache2/sites-available/shopware.conf
ln -s /etc/apache2/sites-available/shopware.conf /etc/apache2/sites-enabled/shopware.conf
nano /etc/apache2/sites-available/shopware.conf

添加以下行:

<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/var/www/html/"
ServerName your-domain.com
ServerAlias www.your-domain.com
<Directory "/var/www/html/">
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/your-domain.com-error_log
CustomLog /var/log/apache2/your-domain.com-access_log common
</VirtualHost>

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

systemctl restart apache2.service

第 6 步。访问 Shopware。

默认情况下,Shopware 将在 HTTP 端口 80 上可用。 打开您喜欢的浏览器并导航到 https://your-domain.com 或者 https://your-server-ip 并完成所需的步骤以完成安装。 如果您使用防火墙,请打开端口 80 以启用对控制面板的访问。

恭喜! 您已成功安装 Shopware。 感谢您使用本教程在您的 Ubuntu 16.04 LTS (Xenial Xerus) 系统上安装 Shopware 开源电子商务。 如需其他帮助或有用信息,我们建议您查看 Shopware 官方网站.

[ad_2]

Related Posts