Linux环境ShowDoc接口文档安装脚本

小柒助手 Shell评论61,7092字数 404阅读1分20秒阅读模式

此脚本是Linux一键部署ShowDoc接口文档自动化脚本,有需要朋友可以参考,脚本内容如下:

环境准备:

操作系统:CentOS Linux release 7.8.2003文章源自小柒网-https://www.yangxingzhen.cn/7612.html

软件版本:

Docker:docker-ce-19.03.12文章源自小柒网-https://www.yangxingzhen.cn/7612.html

[root@localhost ~]# vim install_showdoc.sh文章源自小柒网-https://www.yangxingzhen.cn/7612.html

  1. #!/bin/bash
  2. #Date:2020-8-21 10:26:28
  3. #Author Blog:
  4. # https://www.yangxingzhen.cn
  5. # https://www.i7ti.cn
  6. #Author WeChat:
  7. # 微信公众号:小柒博客
  8. #Author mirrors site:
  9. # https://mirrors.yangxingzhen.com
  10. #About the Author
  11. # BY:YangXingZhen
  12. # Mail:xingzhen.yang@yangxingzhen.com
  13. # QQ:675583110
  14. #Auto Install Docker-ce And ShowDoc
  15. IPADDR=$(hostname -I |awk '{print $1}')
  16. # 安装Docker-ce
  17. rpm -qa |grep "docker-ce" >/dev/null 2>&1
  18. if [ $? -ne 0 ];then
  19. #curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
  20. yum -y install yum-utils device-mapper-persistent-data lvm2 >/dev/null
  21. yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  22. yum -y install docker-ce-19.03.12 docker-ce-cli-19.03.12 containerd.io >/dev/null
  23. fi
  24. # 配置镜像加速器
  25. mkdir -p /etc/docker
  26. cat >/etc/docker/daemon.json <<EOF
  27. {
  28. "registry-mirrors": [
  29. "https://hub-mirror.c.163.com",
  30. "https://reg-mirror.qiniu.com",
  31. "https://registry.docker-cn.com",
  32. "https://lhbk6z9b.mirror.aliyuncs.com"
  33. ]
  34. }
  35. EOF
  36. # 开启TCP管理端口
  37. sed -i 's#/usr/bin/dockerd#& -H tcp://0.0.0.0:2375#' /usr/lib/systemd/system/docker.service
  38. # 启动Docker
  39. systemctl daemon-reload
  40. systemctl enable docker
  41. systemctl start docker
  42. # 安装ShowDoc
  43. # 拉取ShowDoc镜像(原版官方镜像安装命令)
  44. #docker pull star7th/showdoc
  45. # 拉取ShowDoc镜像(基于国内阿里云镜像,安装后记得执行docker tag命令以进行重命名)
  46. docker pull registry.cn-shenzhen.aliyuncs.com/star7th/showdoc
  47. docker tag registry.cn-shenzhen.aliyuncs.com/star7th/showdoc:latest star7th/showdoc:latest
  48. # 创建持久化数据目录
  49. mkdir -p /data/showdoc/html
  50. # 启动ShowDoc
  51. docker run -d --user=root --privileged=true -p 80:80 --name showdoc -v /data/showdoc/html:/var/www/html star7th/showdoc
  52. User="showdoc"
  53. Passwd="123456"
  54. echo -e "\033[32mShowDoc访问地址:http://${IPADDR}\n用户名:${User}\n密码:${Passwd}\033[0m"

脚本执行方式:文章源自小柒网-https://www.yangxingzhen.cn/7612.html

[root@localhost ~]# sh install_showdoc.sh文章源自小柒网-https://www.yangxingzhen.cn/7612.html

脚本执行过程截图如下文章源自小柒网-https://www.yangxingzhen.cn/7612.html

文章源自小柒网-https://www.yangxingzhen.cn/7612.html

文章源自小柒网-https://www.yangxingzhen.cn/7612.html

文章源自小柒网-https://www.yangxingzhen.cn/7612.html 文章源自小柒网-https://www.yangxingzhen.cn/7612.html

若文章图片、下载链接等信息出错,请在评论区留言反馈,博主将第一时间更新!如本文“对您有用”,欢迎随意打赏,谢谢!

继续阅读
Wechat
微信扫一扫,加我!
weinxin
我的微信
微信号已复制
微信公众号
微信扫一扫,关注我!
weinxin
我的公众号
公众号已复制
Shell最后更新:2022-12-6
小柒助手
  • 本文由 小柒助手 发表于 2020年11月18日 11:19:29
  • 声明:本站所有文章,如无特殊说明或标注,本站文章均为原创。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。转载请务必保留本文链接:https://www.yangxingzhen.cn/7612.html
匿名

发表评论

匿名网友
:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

拖动滑块以完成验证
加载中...