docker安装部署jumpserver 2.25.5的方法

官网

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 <> ~/.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 < [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 < [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 ~]#

docker安装部署jumpserver 2.25.5的方法_第1张图片

admin admin

三、对接k8s集群

docker安装部署jumpserver 2.25.5的方法_第2张图片

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

你可能感兴趣的:(docker安装部署jumpserver 2.25.5的方法)