docker部署jumpserver
环境:centos7系统,2核4G(多多益善)
1.安装docker
下载docker的安装包
下载地址>> https://download.docker.com/linux/static/stable/x86_64/
解压安装包
[root@localhost ~]# tar zxf docker-19.03.9.tgz
复制二进制文件到/usr/bin目录下
[root@localhost ~]# cp docker/* /usr/bin
编写启动脚本
[root@localhost ~]# vim /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
#the default is not to use systemd for cgroups because the delegate issues still
#exists and systemd currently does not support the cgroup feature set required
#for containers run by docker
ExecStart=/usr/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
#Having non-zero Limit*s causes performance problems due to accounting overhead
#in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
#Uncomment TasksMax if your systemd version supports it.
#Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
#set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
#kill only the docker process, not all processes in the cgroup
KillMode=process
#restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
2.jumpserver部署
启动docker
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl start docker
mysql服务部署
导入镜像
[root@localhost ~] docker load -i mysql5.7.tar.gz
也可以直接下载
[root@localhost ~] docker pull mysql
mysqld.cnf 配置文件
将容器中的 MySQL 配置文件在宿主机通过-v 挂载到容器中
[root@localhost ~] mkdir -p /etc/mysql/mysql.conf.d
[root@localhost ~] vim /etc/mysql/mysql.conf.d/mysqld.cnf#Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; version 2 of the License.
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
#The MySQL Server configuration file.
#
#For explanations see
#http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
#log-error = /var/log/mysql/error.log
#Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
character-set-server=utf8
mysql.cnf 配置文件:
[root@localhost ~] mkdir -p /etc/mysql/conf.d/
[root@localhost ~] vim /etc/mysql/conf.d/mysql.cnf[mysql]
default-character-set=utf8
[root@localhost ~] mkdir /data/mysql -p
运行 MySQL 容器:
[root@localhost ~] docker run -it -d -p 3306:3306 \-v /etc/mysql/mysql.conf.d/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf \-v /etc/mysql/conf.d/mysql.cnf:/etc/mysql/conf.d/mysql.cnf \-v /data/mysql:/var/lib/mysql \-e MYSQL_ROOT_PASSWORD="123" \mysql:5.7
**(mysql查看命令 docker images 输入自己对应的镜像版本号)**
[root@localhost ~] yum -y install mariadb-server
[root@localhost ~] mysql -uroot -p 123 -h 192.168.20.132(自己本身的Ip)
创建 jumpserver 数据库
mysql> create database jumpserver default charset 'utf8';
mysql> grant all on jumpserver.* to 'jumpserver'@'%' identified by 'abc123';
确认 jumpserver 用户有权限访问数据库
[root@localhost ~] mysql -ujumpserver -pabc123 -h192.168.20.132(主机ip)
部署 Redis 服务
下载镜像并安装
[root@localhost ~] docker pull redis:4.0.14(记得查看自己的镜像版本)
[root@localhost ~] docker run -it -d -p 6379:6379 redis:4.0.14
验证 Redis 访问
yum -y install wget gcc epel-release git(万能的安装源)
yum -y install redis
redis-cli -h 192.168.20.132(本身ip)
部署 jumpserver
下载镜像
[root@localhost ~] docker pull jumpserver/jms_all:1.4.8
#或已经下载镜像后导入
[root@localhost ~] docker load -i jumpserver_jms_all.tar
生成随机加密秘钥和初始化 token。
[root@localhost ~] if [ "$SECRET_KEY" = "" ]; then \SECRET_KEY=`cat /dev/urandom | \tr -dc A-Za-z0-9 | \head -c 50`; \echo "SECRET_KEY=$SECRET_KEY" >> ~/.bashrc; \echo $SECRET_KEY; \else echo $SECRET_KEY; \fi
**cZPi5K3utSGiwpK786wbrdZl7UqP0KzfszPBF3NqoATelylqzJ**
[root@localhost ~] if [ "$BOOTSTRAP_TOKEN" = "" ]; then \BOOTSTRAP_TOKEN=`cat /dev/urandom | \tr -dc A-Za-z0-9 | \head -c 16`; \echo "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bashrc; \echo $BOOTSTRAP_TOKEN; \else echo $BOOTSTRAP_TOKEN; \fi
**yaOz6fQzY0R8vIta**
**
记住你的密钥和初始化token,真的很重要!!!
**
建 Jumpserver 容器
docker run --name jms_all \-v /opt/jumpserver:/opt/jumpserver/data/media \-p 80:80 \-p 2222:2222 \-e SECRET_KEY=cZPi5K3utSGiwpK786wbrdZl7UqP0KzfszPBF3NqoATelylqzJ \(**密钥,直接复制的话请去掉这些备注)**-e BOOTSTRAP_TOKEN=yaOz6fQzY0R8vIta \(**初始化token,直接复制的话请去掉这些备注)**-e DB_HOST=192.168.20.132 \(本身ip)-e DB_PORT=3306 \-e DB_USER='jumpserver' \-e DB_PASSWORD="abc123" \-e DB_NAME=jumpserver \-e REDIS_HOST=192.168.20.132 \(本身ip)-e REDIS_PORT=6379 \-e REDIS_PASSWORD= \jumpserver/jms_all:1.4.8**(记得去镜像里查看自己对应的版本!!!)**
容器启动完成
直接输入ip地址查看。
docker部署jumpserver相关推荐
- 零基础如何快速了解和部署Jumpserver
Jumpserver 是一款使用 Python, Django 开发的开源跳板机系统, 为互联网企业提供了认证, 授权, 审计, 自动化运维等功能 主要功能 跳板机: 账户认证: 权限: 记录:操作日 ...
- Docker 部署 SpringBoot 项目整合 Redis 镜像做访问计数Demo
Docker 部署SpringBoot项目整合 Redis 镜像做访问计数Demo 最终效果如下 大概就几个步骤 1.安装 Docker CE 2.运行 Redis 镜像 3.Java 环境准备 4. ...
- Docker 部署SpringBoot项目不香吗?
点击上方"方志朋",选择"设为星标" 回复"666"获取新整理的面试文章 作者:流星007 链接:toutiao.com/i68433912 ...
- docker部署springboot_Docker+SpringBoot快速构建和部署应用
前言 Docker技术发展为当前流行的微服务提供了更加便利的环境,使用SpringBoot+Docker部署和发布应用,其实也是一件比较简单的事情.当前,前提是得有Docker的基础. 构建一个Spr ...
- docker初体验:docker部署nginx负载均衡集群
Docker 是一个用于开发,交付和运行应用程序的开放平台.Docker 使您能够将应用程序与基础架构分开,从而可以快速交付软件.今天来为大家演示一下docker部署nginx负载均衡集群 环境 ce ...
- docker初体验:docker部署nginx服务
Docker 是一个用于开发,交付和运行应用程序的开放平台.Docker 使您能够将应用程序与基础架构分开,从而可以快速交付软件.今天来为大家演示一下docker部署nginx 环境 centos7 ...
- Docker系列 四.Docker部署SpringBoot
四.Docker部署SpringBoot 环境&工具: 阿里云轻量级服务器.CentOS 7系统.FinalShell(其他连接客户端也可以).IDEA 1. 创建springboot项目 这 ...
- Docker部署文档
Docker部署文档 目录 Docker部署文档 1 一.什么是Docker 3 1.1Docker简介 3 1.2对比传统虚拟机总结 4 1.3Docker通常用于如下场景: 5 1.4基本概念 5 ...
- Docker部署Zookeeper集群
Docker部署Zookeeper集群 官方网站: http://zookeeper.apache.org/ http://zookeeper.apache.org/doc/r3.4.8/zookee ...
最新文章
- 数据维度爆炸怎么办?详解 5 大常用的特征选择方法
- 再见,工资!程序员工资统计平均14404元,网友:又跌了!
- python安装步骤图解-Python安装-小白图文教程(精)
- 三种工厂模式的分析以及C++实现
- 一文看尽7篇目标跟踪最新论文(ABCTracker/MAST/L1DPF-M等)
- Python说文解字_杂谈06
- Java进阶02 异常处理
- Java 8 Friday:大多数内部DSL已过时
- (2017.9.27) 自定义列表项 list-style 使用心得
- 生成用于ASP.NET Web API的TypeScript客户端API
- 59.node的serve-favicon中间件的使用
- Oracle RAC 10.2.0.5升级到11.2.0.4遇到的问题
- printf利用转译字符在终端显示进度条(时钟)-zhuan
- RIP简易配置第二篇
- Springboot 下 ModelAndView 的简单使用
- 完美解决VMware安装后没有VMnet1和VMnet8的问题
- Oracle里default什么意思,ORACLE中默认值default的使用方法
- vue+drf没公网ip接入支付宝功能
- 闲鱼最新选品技巧,快速帮你找到爆款!
- 解决python -m spacy download en_core_web_sm连接不上服务器的方案