文章详情

短信预约-IT技能 免费直播动态提醒

请输入下面的图形验证码

提交验证

短信预约提醒成功

docker安装部署jumpserver 2.25.5的方法

2024-04-02 19:55

关注

官网

https://www.jumpserver.org/

简介

Jumpserver 是一款由python编写开源的跳板机(堡垒机)系统,实现了跳板机应有的功能。

一、机器环境准备

机器规格:4vcpu 8G 100G
操作系统:Rocky8.6
docker: 20.10.18
mysql: 5.7.30
redis: 6.2.7

二、安装部署

安装docker
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install docker-ce -y

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://a7h8080e.mirror.aliyuncs.com"]
}
EOF
systemctl enable --now docker.service

创建目录
#mkdir -p /etc/mysql/mysql.conf.d/
#mkdir -p /etc/mysql/conf.d/

#生成服务器配置文件,指定字符集
tee /etc/mysql/mysql.conf.d/mysqld.cnf <<EOF
[mysqld]
pid-file= /var/run/mysqld/mysqld.pid
socket= /var/run/mysqld/mysqld.sock
datadir= /var/lib/mysql
symbolic-links=0
character-set-server=utf8   #添加此行,指定字符集
EOF

#生成客户端配置文件,指定字符集
tee /etc/mysql/conf.d/mysql.cnf <<EOF
[mysql]
default-character-set=utf8  #添加此行,指定字符集
EOF

docker run -d -p 3306:3306 --name mysql --restart always \
-e MYSQL_ROOT_PASSWORD=123456 \
-e MYSQL_DATABASE=jumpserver  \
-e MYSQL_USER=jumpserver      \
-e MYSQL_PASSWORD=123456       \
-v /data/mysql:/var/lib/mysql   \
-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   mysql:5.7.30

tee  key.sh  <<EOF
#!/bin/bash
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=$SECRET_KEY;
else
  echo SECRET_KEY=$SECRET_KEY;
fi
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=$BOOTSTRAP_TOKEN;
else
  echo BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN;
fi
EOF

[root@easzlab-jumpserver-01 ~]# bash key.sh 
SECRET_KEY=UpxFzLs2fD6dSp80TEaDf94kbOlvUNzY4FAInjXJlXu6caVXtk
BOOTSTRAP_TOKEN=WW7EgNDSzNTGgaY1
[root@easzlab-jumpserver-01 ~]# 

docker run --name jms_all -d \
  -v /opt/jumpserver/core/data:/opt/jumpserver/data \
  -v /opt/jumpserver/koko/data:/opt/koko/data \
  -v /opt/jumpserver/lion/data:/opt/lion/data \
  -p 80:80 \
  -p 2222:2222 \
  -e SECRET_KEY=UpxFzLs2fD6dSp80TEaDf94kbOlvUNzY4FAInjXJlXu6caVXtk \
  -e BOOTSTRAP_TOKEN=WW7EgNDSzNTGgaY1 \
  -e LOG_LEVEL=ERROR \
  -e DB_HOST=172.16.88.181 \
  -e DB_PORT=3306 \
  -e DB_USER=jumpserver \
  -e DB_PASSWORD=123456 \
  -e DB_NAME=jumpserver \
  -e REDIS_HOST=172.16.88.181 \
  -e REDIS_PORT=6379 \
  -e REDIS_PASSWORD='' \
  --privileged=true \
  --restart always \
  jumpserver/jms_all:v2.25.5

安装操作过程

[root@easzlab-jumpserver-01 ~]# mkdir -p /etc/mysql/mysql.conf.d/
[root@easzlab-jumpserver-01 ~]# mkdir -p /etc/mysql/conf.d/
[root@easzlab-jumpserver-01 ~]#
[root@easzlab-jumpserver-01 ~]# tee /etc/mysql/mysql.conf.d/mysqld.cnf <<EOF
> [mysqld]
> pid-file= /var/run/mysqld/mysqld.pid
> socket= /var/run/mysqld/mysqld.sock
> datadir= /var/lib/mysql
> symbolic-links=0
> character-set-server=utf8   #添加此行,指定字符集
> EOF
[mysqld]
pid-file= /var/run/mysqld/mysqld.pid
socket= /var/run/mysqld/mysqld.sock
datadir= /var/lib/mysql
symbolic-links=0
character-set-server=utf8   #添加此行,指定字符集
[root@easzlab-jumpserver-01 ~]# 
[root@easzlab-jumpserver-01 ~]# 
[root@easzlab-jumpserver-01 ~]# ls /etc/mysql/mysql.conf.d/
mysqld.cnf
[root@easzlab-jumpserver-01 ~]# tee /etc/mysql/conf.d/mysql.cnf <<EOF
> [mysql]
> default-character-set=utf8  #添加此行,指定字符集
> EOF
[mysql]
default-character-set=utf8  #添加此行,指定字符集
[root@easzlab-jumpserver-01 ~]# 
[root@easzlab-jumpserver-01 ~]# systemctl enable --now docker.service
Created symlink /etc/systemd/system/multi-user.target.wants/docker.service → /usr/lib/systemd/system/docker.service.
[root@easzlab-jumpserver-01 ~]# docker run -d -p 3306:3306 --name mysql --restart always \
> -e MYSQL_ROOT_PASSWORD=123456 \
> -e MYSQL_DATABASE=jumpserver  \
> -e MYSQL_USER=jumpserver      \
> -e MYSQL_PASSWORD=123456       \
> -v /data/mysql:/var/lib/mysql   \
> -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   mysql:5.7.30
Unable to find image 'mysql:5.7.30' locally
5.7.30: Pulling from library/mysql
8559a31e96f4: Pull complete 
d51ce1c2e575: Pull complete 
c2344adc4858: Pull complete 
fcf3ceff18fc: Pull complete 
16da0c38dc5b: Pull complete 
b905d1797e97: Pull complete 
4b50d1c6b05c: Pull complete 
d85174a87144: Pull complete 
a4ad33703fa8: Pull complete 
f7a5433ce20d: Pull complete 
3dcd2a278b4a: Pull complete 
Digest: sha256:32f9d9a069f7a735e28fd44ea944d53c61f990ba71460c5c183e610854ca4854
Status: Downloaded newer image for mysql:5.7.30
0b835bbd200cb595683a5b16e84843e351138d83330d8957367da9aff26cfcbc
[root@easzlab-jumpserver-01 ~]# 
[root@easzlab-jumpserver-01 ~]# 
[root@easzlab-jumpserver-01 ~]# 
[root@easzlab-jumpserver-01 ~]# docker run -d -p 6379:6379 --name redis --restart always  redis:6.2.7
Unable to find image 'redis:6.2.7' locally
6.2.7: Pulling from library/redis
31b3f1ad4ce1: Pull complete 
ff29a33e56fb: Pull complete 
b230e0fd0bf5: Pull complete 
72d42747a22c: Pull complete 
22867d4f5465: Pull complete 
ae5fd86f0c58: Pull complete 
Digest: sha256:45a37e30dd2b3eb803b71296dd962bab827558ff017c1baad4d957a030415acf
Status: Downloaded newer image for redis:6.2.7
b15175c571639f9adf5e0a04c22dd2d92f68e500b8d29b6c56673534b61cf2df
[root@easzlab-jumpserver-01 ~]# 
[root@easzlab-jumpserver-01 ~]#
[root@easzlab-jumpserver-01 ~]# tee /etc/docker/daemon.json <<-'EOF'
> {
>   "registry-mirrors": ["https://a7h8080e.mirror.aliyuncs.com"]
> }
> EOF
{
  "registry-mirrors": ["https://a7h8080e.mirror.aliyuncs.com"]
}
[root@easzlab-jumpserver-01 ~]# systemctl daemon-reload
[root@easzlab-jumpserver-01 ~]# systemctl restart docker
[root@easzlab-jumpserver-01 ~]# docker ps -a
CONTAINER ID   IMAGE          COMMAND                  CREATED         STATUS         PORTS                                                  NAMES
b15175c57163   redis:6.2.7    "docker-entrypoint.s…"   5 minutes ago   Up 3 seconds   0.0.0.0:6379->6379/tcp, :::6379->6379/tcp              redis
0b835bbd200c   mysql:5.7.30   "docker-entrypoint.s…"   6 minutes ago   Up 3 seconds   0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp   mysql
[root@easzlab-jumpserver-01 ~]# docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
redis        6.2.7     94cfe49e6758   7 days ago    113MB
mysql        5.7.30    9cfcce23593a   2 years ago   448MB
[root@easzlab-jumpserver-01 ~]# docker run --name jms_all -d \
>   -v /opt/jumpserver/core/data:/opt/jumpserver/data \
>   -v /opt/jumpserver/koko/data:/opt/koko/data \
>   -v /opt/jumpserver/lion/data:/opt/lion/data \
>   -p 80:80 \
>   -p 2222:2222 \
>   -e SECRET_KEY=UpxFzLs2fD6dSp80TEaDf94kbOlvUNzY4FAInjXJlXu6caVXtk \
>   -e BOOTSTRAP_TOKEN=WW7EgNDSzNTGgaY1 \
>   -e LOG_LEVEL=ERROR \
>   -e DB_HOST=172.16.88.181 \
>   -e DB_PORT=3306 \
>   -e DB_USER=jumpserver \
>   -e DB_PASSWORD=123456 \
>   -e DB_NAME=jumpserver \
>   -e REDIS_HOST=172.16.88.181 \
>   -e REDIS_PORT=6379 \
>   -e REDIS_PASSWORD='' \
>   --privileged=true \
>   --restart always \
>   jumpserver/jms_all:v2.25.5
Unable to find image 'jumpserver/jms_all:v2.25.5' locally
v2.25.5: Pulling from jumpserver/jms_all
675920708c8b: Pull complete 
4f4fb700ef54: Pull complete 
afb82be343e8: Pull complete 
4c3af39a3a5c: Pull complete 
f6136b206bef: Pull complete 
e61f0ddc6b98: Pull complete 
7b17c6db26b4: Pull complete 
762961625238: Pull complete 
617c06cf2a55: Pull complete 
Digest: sha256:70e83dd31a676afbb0a33c5561dfd3e2bf50c668d7628ed87faa0d1c8c8f5119
Status: Downloaded newer image for jumpserver/jms_all:v2.25.5
d62e2120ff39975d2bfce7cdd3452e3f226d09ae3f915468615e2a9ef5e73fa0
[root@easzlab-jumpserver-01 ~]# docker ps -a
CONTAINER ID   IMAGE                        COMMAND                  CREATED              STATUS              PORTS                                                                                           NAMES
d62e2120ff39   jumpserver/jms_all:v2.25.5   "./entrypoint.sh"        About a minute ago   Up About a minute   0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:2222->2222/tcp, :::2222->2222/tcp, 33060-33061/tcp   jms_all
b15175c57163   redis:6.2.7                  "docker-entrypoint.s…"   11 minutes ago       Up 5 minutes        0.0.0.0:6379->6379/tcp, :::6379->6379/tcp                                                       redis
0b835bbd200c   mysql:5.7.30                 "docker-entrypoint.s…"   12 minutes ago       Up 5 minutes        0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp                                            mysql
[root@easzlab-jumpserver-01 ~]# 
[root@easzlab-jumpserver-01 ~]# 
[root@easzlab-jumpserver-01 ~]#

admin admin

三、对接k8s集群

到此这篇关于docker安装部署jumpserver 2.25.5的文章就介绍到这了,更多相关docker部署jumpserver内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!

阅读原文内容投诉

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

软考中级精品资料免费领

  • 历年真题答案解析
  • 备考技巧名师总结
  • 高频考点精准押题
  • 2024年上半年信息系统项目管理师第二批次真题及答案解析(完整版)

    难度     807人已做
    查看
  • 【考后总结】2024年5月26日信息系统项目管理师第2批次考情分析

    难度     351人已做
    查看
  • 【考后总结】2024年5月25日信息系统项目管理师第1批次考情分析

    难度     314人已做
    查看
  • 2024年上半年软考高项第一、二批次真题考点汇总(完整版)

    难度     433人已做
    查看
  • 2024年上半年系统架构设计师考试综合知识真题

    难度     221人已做
    查看

相关文章

发现更多好内容

猜你喜欢

AI推送时光机
位置:首页-资讯-服务器
咦!没有更多了?去看看其它编程学习网 内容吧
首页课程
资料下载
问答资讯