谷粒商城的环境搭建(一)

谷粒商城是尚硅谷推出的全栈视频,没有相应的课件,整好自己动手整理一下,然后上传到码云上,架构图如下:

 

准备了一台服务器,放在家里,通过ksa可以进行远程访问,配置如下:

 

 现在做的工作是把k8s和kubesphere部署好了,这个到后面再写,Win10可以放nexus等等。

 

现在服务器上安装docker,192.168.1.117,在配置阿里云镜像加速

官网可以查看:https://docs.docker.com/engine/install/centos/

08、环境-linux安装docker

[root@topcheer harbor]# yum remove docker                   docker-client                   docker-client-latest                   docker-common                   docker-latest                   docker-latest-logrotate                   docker-logrotate                   docker-selinux                   docker-engine-selinux                   docker-engine
已加载插件:fastestmirror, langpacks
参数 docker-client-latest 没有匹配
参数 docker-latest 没有匹配
参数 docker-latest-logrotate 没有匹配
参数 docker-logrotate 没有匹配
参数 docker-engine 没有匹配
正在解决依赖关系
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.107-3.el7 将被 删除
---> 软件包 docker.x86_64.2.1.13.1-103.git7f2769b.el7.centos 将被 删除
---> 软件包 docker-client.x86_64.2.1.13.1-103.git7f2769b.el7.centos 将被 删除
---> 软件包 docker-common.x86_64.2.1.13.1-103.git7f2769b.el7.centos 将被 删除
--> 解决依赖关系完成

依赖关系解决

=====================================================================================================================================================
 Package                             架构                     版本                                                   源                         大小
=====================================================================================================================================================
正在删除:
 container-selinux                   noarch                   2:2.107-3.el7                                          @extras                    40 k
 docker                              x86_64                   2:1.13.1-103.git7f2769b.el7.centos                     @extras                    65 M
 docker-client                       x86_64                   2:1.13.1-103.git7f2769b.el7.centos                     @extras                    13 M
 docker-common                       x86_64                   2:1.13.1-103.git7f2769b.el7.centos                     @extras                   4.4 k

事务概要
=====================================================================================================================================================
移除  4 软件包

安装大小:77 M
是否继续?[y/N]:y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在删除    : 2:docker-1.13.1-103.git7f2769b.el7.centos.x86_64                                                                                 1/4
警告:/etc/sysconfig/docker-storage 已另存为 /etc/sysconfig/docker-storage.rpmsave
  正在删除    : 2:docker-client-1.13.1-103.git7f2769b.el7.centos.x86_64                                                                          2/4
  正在删除    : 2:docker-common-1.13.1-103.git7f2769b.el7.centos.x86_64                                                                          3/4
  正在删除    : 2:container-selinux-2.107-3.el7.noarch                                                                                           4/4
  验证中      : 2:docker-common-1.13.1-103.git7f2769b.el7.centos.x86_64                                                                          1/4
  验证中      : 2:docker-1.13.1-103.git7f2769b.el7.centos.x86_64                                                                                 2/4
  验证中      : 2:container-selinux-2.107-3.el7.noarch                                                                                           3/4
  验证中      : 2:docker-client-1.13.1-103.git7f2769b.el7.centos.x86_64                                                                          4/4

删除:
  container-selinux.noarch 2:2.107-3.el7                                    docker.x86_64 2:1.13.1-103.git7f2769b.el7.centos
  docker-client.x86_64 2:1.13.1-103.git7f2769b.el7.centos                   docker-common.x86_64 2:1.13.1-103.git7f2769b.el7.centos

完毕!
[root@topcheer harbor]# yum install -y yum-utils
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 yum-utils.noarch.0.1.1.31-50.el7 将被 升级
---> 软件包 yum-utils.noarch.0.1.1.31-52.el7 将被 更新
--> 解决依赖关系完成

依赖关系解决

[root@topcheer harbor]# yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
已加载插件:fastestmirror, langpacks
adding repo from: https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@topcheer harbor]# yum list docker-ce --showduplicates|sort -r
已加载插件:fastestmirror, langpacks
可安装的软件包
 * updates: mirrors.tuna.tsinghua.edu.cn
Loading mirror speeds from cached hostfile
 * extras: mirrors.tuna.tsinghua.edu.cn
docker-ce.x86_64            3:19.03.4-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.3-3.el7                     docker-ce-stable
docker-ce.x86_64            3:19.03.2-3.el7                     docker-ce-stable
.....


[root@topcheer harbor]# yum install docker-ce-17.06.2.ce-1.el7.centos
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 docker-ce.x86_64.0.17.06.2.ce-1.el7.centos 将被 安装
--> 正在处理依赖关系 container-selinux >= 2.9,它被软件包 docker-ce-17.06.2.ce-1.el7.centos.x86_64 需要
--> 正在检查事务
---> 软件包 container-selinux.noarch.2.2.107-3.el7 将被 安装
--> 解决依赖关系完成  

在配置阿里云加速,此处为以前的笔记

09、环境-配置docker阿里云镜像加速

[root@topcheer ~]# systemctl start docker
[root@topcheer ~]# mkdir -p /etc/docker
[root@topcheer ~]# vim  /etc/docker/daemon.json   #配置阿里云镜像加速
[root@topcheer ~]# systemctl daemon-reload  #加载配置文件
[root@topcheer ~]# systemctl restart docker  #重启
[root@topcheer ~]#

10、环境-docker安装mysql 

 查看配置文件

[root@localhost mysql]# cd conf/
[root@localhost conf]# ll
total 4
-rw-r--r--. 1 root root 281 May 24 09:19 my.cnf
[root@localhost conf]# cat my.cnf
[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
init_connect='set collation_connection=utf8_unicode_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
[root@localhost conf]#
[root@localhost ~]# docker images
REPOSITORY                             TAG                 IMAGE ID            CREATED             SIZE
mysql                                  5.7                 a4fdfd462add        3 days ago          448MB
quay.io/openebs/provisioner-localpv    1.5.0               73d1ddefdddb        5 months ago        62.2MB
quay.io/openebs/admission-server       1.5.0               1bd4847011cc        5 months ago        194MB
quay.io/openebs/snapshot-provisioner   1.5.0               1900bbdb7100        5 months ago        76.2MB
[root@localhost ~]# docker run -p 3306:3306 --name mysql --privileged=true -v /mydata/mysql/conf:/etc/mysql/conf.d -v /mydata/mysql/logs:/logs -v /mydata/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d a4fdfd462add
4dd3eda0035b755dc6a2b0b241733c5b454442ae0f19929f1494611397dd6969
[root@localhost ~]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
4dd3eda0035b        a4fdfd462add        "docker-entrypoint.s…"   7 seconds ago       Up 5 seconds        0.0.0.0:3306->3306/tcp, 33060/tcp   mysql

 11、环境-docker安装redis

[root@localhost conf]# docker pull redis
Using default tag: latest
latest: Pulling from library/redis
afb6ec6fdc1c: Already exists
608641ee4c3f: Pull complete
668ab9e1f4bc: Pull complete
ea9ab8bf5f73: Pull complete
137e0d1a14d9: Pull complete
b2c5e1be4a59: Pull complete
Digest: sha256:89051d5ec46a89d4a708467af38eaaf4029450c4b1b9835ffd413cf70625b22e
Status: Downloaded newer image for redis:latest
docker.io/library/redis:latest
[root@localhost conf]# mkdir -p /mydata/redis/conf
[root@localhost conf]# touch /mydata/redis/conf/redis.conf
[root@localhost conf]# docker run -p 6379:6379 --privileged=true -v /mydata/redis/data:/data -v /mydata/redis/conf/redis.conf:/etc/redis/redis.conf  -d redis redis-server /etc/redis/redis.conf
961ab799c1fef33a0e5cf3e7d9f52a68c843092c3520c9d2534ff17639a1efd0
[root@localhost conf]# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
961ab799c1fe        redis               "docker-entrypoint.s…"   6 seconds ago       Up 4 seconds        0.0.0.0:6379->6379/tcp              focused_kirch
4dd3eda0035b        a4fdfd462add
[root@localhost conf]# docker exec -it focused_kirch redis-cli
127.0.0.1:6379> set aa bb
OK
127.0.0.1:6379> get aa
"bb"
127.0.0.1:6379> exit
[root@localhost conf]# docker restart focused_kirch
focused_kirch
[root@localhost conf]# docker exec -it focused_kirch redis-cli
127.0.0.1:6379> get aa
"bb"
127.0.0.1:6379> exit
[root@localhost conf]# ll
total 4
-rw-r--r--. 1 root root 15 May 24 09:34 redis.conf
[root@localhost conf]# cat redis.conf
appendonly yes
[root@localhost conf]#

12、环境-开发工具&环境安装配置  

 配置

<profile>
		<id>jdk1.8</id>
		<activation>
			<activeByDefault>true</activeByDefault>
			<jdk>1.8</jdk>
		</activation>
		<properties>
			<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
			<maven.compiler.source>1.8</maven.compiler.source>
			<maven.compiler.target>1.8</maven.compiler.target>
			<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
		</properties>
	</profile>
<mirror>
		<id>alimaven</id>
		<name>aliyun maven</name>
		<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
		<mirrorOf>central</mirrorOf>  
	</mirror>    

 VSCODE安装插件

posted @ 2020-05-24 22:43  天宇轩-王  阅读(2392)  评论(11编辑  收藏  举报