- 基本要求
#docker需要高版本
Docker version 20.10.14, build a224086
docker 20.10.14离线安装
SmartKG官网
官方详细文档
- 下载部署包
SmartKG官网
- 准备部署
#上传到服务器
[root@test-server01 opt]# ll SmartKG-master.zip
-rw-r--r-- 1 root root 79708691 Sep 11 17:44 SmartKG-master.zip
#解压压缩包
[root@test-server01 opt]# unzip SmartKG-master.zip
#移动smartkg_services部署包到/opt目录
[root@test-server01 opt]# mv SmartKG-master/dockers/smartkg_services ./
- 修改配置
[root@test-server01 opt]# cd smartkg_services/
[root@test-server01 smartkg_services]# ll
total 12
drwxr-xr-x 2 root root 74 Sep 7 15:52 aspnetcore
-rw-r--r-- 1 root root 234 Sep 7 15:52 docker-compose.File.yml
-rw-r--r-- 1 root root 466 Sep 7 15:52 docker-compose.MongoDB.yml
-rw-r--r-- 1 root root 466 Sep 7 15:52 docker-compose.yml
drwxr-xr-x 3 root root 139 Sep 7 15:52 smartkg
drwxr-xr-x 3 root root 82 Sep 7 15:52 ui
[root@test-server01 smartkg_services]#
#配置修改一
vim docker-compose.MongoDB.yml
MONGO_INITDB_ROOT_USERNAME: "admin"
MONGO_INITDB_ROOT_PASSWORD: "admin"
#配置修改二
vim docker-compose.yml
MONGO_INITDB_ROOT_USERNAME: "admin"
MONGO_INITDB_ROOT_PASSWORD: "admin"
#配置修改三
vim smartkg/appsettings.json
"MongoDbConnection": "mongodb://MONGO_INITDB_ROOT_USERNAME:MONGO_INITDB_ROOT_USERNAME@localhost:27000"修改为
"MongoDbConnection": "mongodb://admin:admin@192.168.40.180:27000"
#配置修改四
vim smartkg/Dockerfile
RUN sed -i "s/localhost/${DOCKER_HOST}/g" /app/smartkg/appsettings.json修改为RUN sed -i "s/localhost/192.168.40.180/g" /app/smartkg/appsettings.json
#配置修改五
vim ui/Dockerfile
RUN sed -i "s/localhost/${DOCKER_HOST}/g" /app/smartkgui/public/config.js修改为RUN sed -i "s/localhost/192.168.40.180/g" /app/smartkgui/public/config.js
#至此配置全部修改完毕
- 上传镜像
基础镜像下载地址、提取码:1021
[root@test-server01 ~]# tar -xvf SmartKG.tar.gz
[root@test-server01 ~]# cd images
[root@test-server01 images]# ll
total 2619060
-rw-r--r-- 1 root root 786472960 Sep 10 11:26 mongo.tar.gz
-rw------- 1 root root 971713024 Sep 10 11:42 node.tar.gz
-rw------- 1 root root 923727872 Sep 10 11:40 python.tar.gz
#加载镜像
[root@test-server01 images]# docker load -i mongo.tar.gz
[root@test-server01 images]# docker load -i node.tar.gz
[root@test-server01 images]# docker load -i python.tar.gz
[root@test-server01 images]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
mongo latest 81a05b728352 2 weeks ago 782MB
python 3.6 54260638d07c 2 years ago 902MB
node 14.15.4 924763541c0c 3 years ago 943MB
#这些是安装SmartKG需要的基础镜像
- 开始安装
[root@test-server01 smartkg_services]# cd /opt/smartkg_services/
[root@test-server01 smartkg_services]# docker-compose build
如下图证明成功了
- 启动容器
[root@test-server01 smartkg_services]# docker-compose up -d
Creating smartkgservices_aspnetcore_1 ... done
Creating smartkgservices_mongo_1 ... done
Creating smartkgservices_smartkg_1 ... done
Creating smartkgservices_ui_1 ... done
aspnetcore挂掉了好像没啥影响 目前还没理解
此时访问8083还是不能访问 因为ui这个容器没配置成功
- 配置ui容器
[root@test-server01 smartkg_services]# docker exec -it 4625c9df115d /bin/bash
#修改npm的镜像地址。提高下载速度
root@4625c9df115d:/# npm config set registry https://registry.npmmirror.com
root@4625c9df115d:/# npm config list
; cli configs
metrics-registry = "https://registry.npmmirror.com/"
scope = ""
user-agent = "npm/6.14.10 node/v14.15.4 linux x64"
; userconfig /root/.npmrc
registry = "https://registry.npmmirror.com/"
; node bin location = /usr/local/bin/node
; cwd = /
; HOME = /root
; "npm config ls -l" to show all defaults.
#安装依赖
root@4625c9df115d:/# cd /app/smartkgui
root@4625c9df115d:/app/smartkgui# npm i
出现以下截图证明安装成功了
- 运行服务
root@4625c9df115d:/app/smartkgui# npm run serve &
看到下面截图证明启动成功了,回车退出容器就行
- 访问web页面
192.168.40.180:8083
至此安装成功了