目录

安装 magento

LAMP 安装简略步骤

服务器环境 Ubuntu 16.04

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
sudo apt install apache2 -y
#sudo systemctl start apache2.service
#sudo systemctl enable apache2.service
#sudo systemctl status apache2.service
#sudo systemctl restart apache2.service

sudo apt install mysql-server mysql-client

sudo apt install php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0 libapache2-mod-php7.0
sudo apt install php7.0-gd php7.0-mcrypt  php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip

sudo apt install php-xml

apache 相关操作

  1. 新建一个 apache 站点,步骤略

  2. apache 开启 rewrite

    1. 软链接 rewrite 模块 (详细命令,你懂的)
    2. 修改配置文件 sudo vi /etc/apache2/apache2.conf 将其中的 AllowOverride None 改为 AllowOverride All,效果如下:
    1
    2
    3
    4
    5
    
    <Directory /var/www/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
    </Directory>
    

mysql 创建数据库及用户

1
2
3
CREATE DATABASE IF NOT EXISTS magento DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
create user 'magento@localhost' IDENTIFIED BY 'magento1234567';
grant all privileges on *.* to magento@localhost identified by 'magento1234567';

安装 magento

magento.com 官网注册账号,步骤略

在后续的 composer 操作步骤中会出现填写 username 和 password ,实际上对应的是 Public Key 和 Private Key 获取地址为

https://marketplace.magento.com/customer/accessKeys/list/ (如果已在 https://magento.com 注册,则可以直接用来登录)

以下操作步骤依照 http://devdocs.magento.com/guides/v2.0/install-gde/prereq/integrator_install_ce.html ,以下为回忆的操作步骤,不一定准确,请以官方文档为准

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
cd /var/www/

composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento

#用户权限部分根据官方文档中【 Set ownership and permissions for two users 】的操作

#添加用户
sudo adduser magento

ps aux | grep apache

usermod -g www-data magento

groups magento


cd <your Magento install dir>
find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;
find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;
chown -R :<web server group> .
chmod u+x bin/magento


sudo chmod -R magento:www-data /var/www/magento
su magento

现在应该可以正常访问网站了,根据安装指南一步一步的来就可以了

汉化步骤

汉化包地址:

https://github.com/Magento2Translations/language_zh_hans_cn

1
2
3
cd <your magento path>
composer require magento2translations/language_zh_hans_cn:dev-master
php bin/magento cache:clean

前台设置语言在:Stores-Configuration-General-Country Options 下面设置

后台语言设置在:System-All Users-指定 User-Interface Locale 设置