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


谷粒商城是尚硅谷推出的全棧視頻,沒有相應的課件,整好自己動手整理一下,然后上傳到碼雲上,架構圖如下:

 

准備了一台服務器,放在家里,通過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安裝插件


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM