Development record of grain Mall: 001-015 environment construction

Recently, I have been following the video to do the e-commerce project "grain mall" in Shang Silicon Valley. This paper is the development record. Link to the original video tutorial:

Grain mall tutorial

There are two main purposes for publishing this article:

  1. For future reference.
  2. Give some reference to other students who do this project.

Note that the number of each section in the text is consistent with the part number of relevant content in the video tutorial, and sometimes the number jumps - normal.

001 introduction - Project Introduction

B2C e-commerce platform, micro service architecture and front and rear end separation.

004 introduction - Project micro service architecture

005 introduction - micro service division diagram

006 environment - quickly create Linux virtual machines

Two tools are required, VirtualBox and Vagrant. VirtualBox is an open source virtual machine software, and Vagrant is a tool for creating and deploying a virtualized development environment.

VirtualBox official website

Vagrant official website

After VirtualBox and Vagrant are installed, open the cmd window and execute the command: (initialize a centos/7 system)

vagrant init centos/7

Then execute the command: (start the virtual environment for the first time, and then start it in VirtualBox)

vagrant up

Connect virtual machine: (then you can directly operate the virtual machine in the cmd window)

vagrant ssh

Disconnect the virtual machine:


007 environment - virtual machine network settings

Execute ipconfig command in cmd window to view VirtualBox host only network:

The Ipv4 address is

Under the C: \ users \ XXX (your user name) path of the computer, find the file "Vagrantfile", edit the file and add the configuration:

Set the ip address of the virtual machine as

Restart the virtual machine for the configuration to take effect.

After restarting the virtual machine, you can ping the local Windows system and the virtual machine system to verify whether the ip address of the virtual machine is configured successfully.

008 environment - installing Docker in Linux Environment

Docker is a virtualization container technology.

Docker official installation tutorial

For the convenience of the next operation, first switch the current user to root: (so you don't need to add sudo before each command)

su root

password enter "vagrant" and pass the verification.

After installing Docker, execute the following command to start Docker:

systemctl start docker

View downloaded Docker images: (not yet)

docker images

View the running Docker container: (not yet)

docker ps

  For convenience, set Docker to start automatically:

systemctl enable docker

To speed up image downloading, configure alicloud image acceleration:

Alibaba cloud official website

Alipay login - console - product and service - Container Service - container mirror Service - mirror tool - mirror accelerator -CentOS operation document

Follow the steps above in the operation document to configure the image accelerator.

010 environment - installing MySQL using Docker

Docker image warehouse

Download MySQL 5.7 image file:

docker pull mysql:5.7

Configure port mapping and directory mount and start:

docker run -p 3306:3306 --name mysql \
-v /mydata/mysql/log:/var/log/mysql \
-v /mydata/mysql/data:/var/lib/mysql \
-v /mydata/mysql/conf:/etc/mysql \
-d mysql:5.7

For convenience, set MySQL to start automatically:

docker update mysql --restart=always

Further configure MySQL:

vi /mydata/mysql/conf/my.cnf
init_connect='SET collation_connection = utf8_unicode_ci'
init_connect='SET NAMES utf8'

Restart MySQL to make the configuration effective:

docker restart mysql

Start MySQL:

docker start mysql

Stop running MySQL:

docker stop mysql

SQLyog is a tool for graphical management of MySQL.

SQLyog free download

Connect to MySQL database using SQLyog:

(ensure that MySQL has been started on the virtual machine, and the user name and password are root)

  011 environment - using Docker to install Redis

Docker image warehouse

Download Redis image:

docker pull redis

Configure port mapping and directory mount and start:

mkdir -p /mydata/redis/conf
touch /mydata/redis/conf/redis.conf
docker run -p 6379:6379 --name redis -v /mydata/redis/data:/data \
-v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf \
-d redis redis-server /etc/redis/redis.conf

For convenience, set Redis to start automatically:

docker update redis --restart=always

Redis does not persist data by default. We need to modify the configuration file:

vi /mydata/redis/conf/redis.conf

Add configuration: (persistence policy: AOF)

appendonly yes

Start Redis:

docker start redis

Stop Redis:

docker stop redis

To facilitate viewing data in Redis, it is recommended to install a Redis visualization tool: RedisDesktopManager.

012 environment - development tool preparation


         JDK 1.8 up.

Maven: (modify the conf/setting.xml file under the Maven installation path)

         Configure alicloud image:

        <name>Nexus aliyun</name>

        To configure a project to be compiled using JDK 1.8:


IntelliJ IDEA:

        Configure Maven:

         Install plug-in: Lombok.

         Install plug-in: MyBatisX.


        VsCode official website

         Install plug-in: Auto Close Tag.

         Install plug-in: Auto Rename Tag.

         Install plug-in: Chinese(Simplified) Language Pack for Visual Studio Code.

         Install plug-in: ESLint.

         Install plug-in: HTML CSS Support.

         Install plug-ins: JavaScript(ES6) code snippets.

         Install plug-in: Live Server.

         Install the plug-in: open in browser.

         Install plug-in: Vetur.

013 environment - configure git SSH

Git official website

After Git installation, right-click to open git bash in any directory:

Configure global user information: (user name and mailbox)

git config --global "lxj"
git config --global ""

Configure ssh password free login:

ssh-keygen -t rsa -C ""

Press enter 3 times to generate the key successfully. View full key:

cat ~/.ssh/

Open the browser and enter the Gitee community:

Gitee community

After successful registration and login, enter the "set SSH public key" page and add the complete key just generated.

Back to git bash, configure the default use of the key: (enter yes to confirm)

ssh -T

014 environment - project structure creation & push to gitee

Log in to Gitee and create a new warehouse gulimall:

Copy the address of the warehouse, open IEDA, file new project from version control.., and clone the warehouse locally.

Create 5 services using IDEA:

  • Goods and services: gulimall product
  • Warehousing service: gulimall ware
  • Order service: gulimall order
  • Member service: gulimall member
  • Coupon service: gulimall coupon

Create a service example:


The project directory after creation is as follows: (add pom.xml file manually)

Contents of pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="" xmlns:xsi=""
    <description>Aggregate services</description>



Add the pom.xml file in Maven plug-in of IDEA:



Configure files in the. gitignore file that you do not want to push to Gitee remote warehouse: (add)



015 environment - database initialization

Use SQLyog to connect to MySQL.

Create database:

  • gulimall_pms
  • gulimall_oms
  • gulimall_sms
  • gulimall_ums
  • gulimall_wms

Create database example:  


Execute respective initialization scripts in each database:

Baidu cloud disk: extraction code 2239

Database initialization completed.

Tags: Software development

Posted on Sun, 12 Sep 2021 20:07:48 -0400 by dcallstar51