The first part is the construction of development environment

Chapter 1 Obtaining course resources and documentation

Chapter 2 Course Introduction

Chapter 3 development environment construction

3.1 Introduction to the development environment needed for the course

3.2 Installing Docker and Docker-compose

3.2.1 installation docker

Install the docker

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
Copy the code

Set docker to boot upon startup

Systemctl start docker systemctl enable dockerCopy the code

3.2.2 Configuring Ali Cloud Image – Very important

Log in ali Cloud and enter the console

Then select Container Image services from products and services

Selective mirror accelerator

Select your own operating system and copy the following code to run

3.2.3 start

sudo systemctl start docker
Copy the code

3.2.4 Test it out

sudo docker run hello-world
Copy the code

3.3 Installing Navicat and mysql

3.3.1 Downloading an Image

Docker pull mysql: 5.7Copy the code

3.3.2 Booting through An Image

docker run -p 3306:3306 --name mymysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD = 123456 - d mysql: 5.7Copy the code

-p 3306:3306: maps port 3306 of a container to port 3306 of a host.

– v – v $PWD/conf: / etc/mysql/conf. D: will host the current directory of the conf/my CNF mounted to the container’s/etc/mysql/my CNF.

-v $PWD/logs:/logs: Mounts the logs directory under the current directory of the host to /logs of the container.

-v $PWD/data:/var/lib/mysql: mount the data directory in the current host directory to /var/lib/mysql in the container.

-e MYSQL_ROOT_PASSWORD=123456: Initializes the password of user root.

3.3.3 Entering Container Configuration

Due to mysql’s security policy, you cannot use root/123456 to access the database at this time

  1. Docker ps-a = docker ps-a;
docker exec -it 62349aa31687 /bin/bash
Copy the code
  1. Enter the mysql

    mysql -uroot -p123456
    Copy the code
  2. Establish users and authorize them

    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1' IDENTIFIED BY 'root' WITH GRANT OPTION;
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'root' WITH GRANT OPTION;
    FLUSH PRIVILEGES;
    Copy the code
  3. Install naviat sqlyog download it here www.navicat.com.cn/download/na…

3.4 Python Installation and configuration

3.4 1. windows

address

3.4 2. linux

Install the following dependency packages: centos: yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ openssl-devel libffi-devel python-devel mariadb-devel ubuntu: sudo apt-get install zlib1g-dev libbz2-dev libssl-dev libncurses5-dev default-libmysqlclient-dev libsqlite3-dev libreadline-dev tk-dev libgdbm-dev libdb-dev libpcap-dev xz-utils libexpat1-dev liblzma-dev libffi-dev libc6-dev 1. Access wget https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tgz tar XZVF Python - 3.8.6. TGZ - C/TMP CD / TMP/Python - 3.8.6/2. Install Python3.8 to /usr/local. /configure --prefix=/usr/local make make altinstall 3. Change the /usr/bin/python link ln -s /usr/local/bin/python3.8 /usr/bin/python3 ln -s /usr/local/bin/pip3.8 /usr/bin/pip3Copy the code

3.4.3. If you want to use Anconda, you can also install it

3.5 Virtual Environment Installation and Configuration

3.5.1 track of the Windows

pip install virtualenvwrapper-win
Copy the code

3.5.2 linux

The installation
yum install python-setuptools python-devel
pip3 install virtualenvwrapper
Copy the code
configuration

Edit the.bashrc file vim ~/.bashrc

export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh The path to virtualenvwrapper.sh may be inconsistent between Linux systemsCopy the code

After exiting vim, run the following command to reload

source  ~/.bashrc
Copy the code

3.5.3 Using a Virtual Environment

1. Create a virtual environment
mkvirtualenv python_start
Copy the code
2. View all virtual environments
workon
Copy the code
3. Access the specified virtual environment
workon python_start
Copy the code

3.6 Go Installation and Configuration

Download address

1. windows

Download direct Installation

2. linux

2. Decompress tar -xvf go1.15.3.linux-amd64.tar.gz 3. Configure the environment variable vim ~/. Bashrc export GOROOT=/root/go export GOPATH=/root/projects/go export PATH=$PATH:$GOROOT/bin:$GPPATH/bin 4.  After editing, save and exit Vim, remember to load these environments: source ~/.bashrcCopy the code

3. Set proxy acceleration

go env -w GOPROXY=https://goproxy.io,direct
go env -w GO111MODULE=on
Copy the code

4. Goland installation

Download and install from the official address

Goland configuration of Goimports and Go FMT

Go FMT and Goimports are automatically formatted after they are saved

settings -> tools -> file watchers

3.7 NodeJS Installation and Configuration

1. Download

  1. Download the latest NodeJS from the official websiteNodejs.org/en/download…

Find the download path here and use wget to download it, as I did here:

Wget HTTP: / / https://nodejs.org/dist/v12.18.3/node-v12.18.3-linux-x64.tar.xzCopy the code

2. Decompress the software and establish a soft connection

The tar XVF - node - v12.18.3 - Linux - x64. Tar. XzCopy the code

3. Establish a soft connection

Be sure to find the full path to the Node executable like I have here

Ln -s /root/node-v12.18.3- Linux -x64/bin/node /usr/bin/node ln -s /root/node-v12.18.3- Linux -x64/bin/npm /usr/bin/npmCopy the code

Note that the ln command used to create associations (similar to Windows shortcuts) must be given to the full path, otherwise association errors may occur.

3. The test

node -v
Copy the code

4. Install CNPM

npm install -g cnpm --registry=https://registry.npm.taobao.org
Copy the code

3.8 Kite installation and configuration