飞天使-jumpserver-docker跳板机安装

2023-12-18 19:27:06

jumpserver
基础要求
硬件配置: 2 个 CPU 核心, 4G 内存, 50G 硬盘(最低)
操作系统: Linux 发行版 x86_64
Python = 3.6.x
Mysql Server ≥ 5.6
Mariadb Server ≥ 5.5.56
Redis

分为3台机器 
jumpserver
mysql,redis 
web01

docker 更新到最新
yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine -y

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y yum-utils device-mapper-persistent-data lvm2
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

systemctl enable docker && systemctl start docker && systemctl status docker 
下载安装包
docker pull mysql:mysql:5.6.48
docker pull redis:4.0.14
docker pull jumpserver/jms_all:1.5.8
mysql
mkdir /etc/mysql/mysql.conf.d –pv

两个配置文件

#cat mysqld.cnf |grep -v ^#
[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

#mysql.cnf 配置文件:
# mkdir /etc/mysql/conf.d/
# cat /etc/mysql/conf.d/mysql.cnf
[mysql]
default-character-set=utf8


创建数据目录
 mkdir /data/mysql -p

启动mysql 命令
 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="abc.123Aa" mysql:5.6.48
 
验证登录
yum install -y mysql 

#mysql -uroot -pabc.123Aa -h 127.0.0.1
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.48 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]>

验证字符集,创建数据库
MySQL [(none)]> show variables like "%character%";show variables like "%collation%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_general_ci |
| collation_database   | utf8_general_ci |
| collation_server     | utf8_general_ci |
+----------------------+-----------------+
3 rows in set (0.00 sec)




create database jumpserver default charset 'utf8';
grant all on jumpserver.* to 'jumpserver'@'%' identified by 'abc.123Aa';


使用jumpserver 进行连接测试
#mysql -ujumpserver -pabc.123Aa -h 127.0.0.1
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.48 MySQL Community Server (GPL)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]>
redis

#docker images
REPOSITORY   TAG       IMAGE ID       CREATED       SIZE
mysql        5.6.48    8de95e6026c3   3 years ago   302MB
redis        4.0.14    191c4017dcdd   3 years ago   89.3MB

#docker run -it -d -p 6379:6379 redis:4.0.14
7f72dde11ecee983f3be017a447cc3269249f1c1aa9916b9a99a6aa137babfe3

部署jumpserver 写入变量
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

 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
 
建jumpserver 容器
mkdir /opt/jumpserver 

docker run --name jms_all \
-v /opt/jumpserver:/opt/jumpserver/data/media \
-p 80:80 \
-p 2222:2222 \
-e SECRET_KEY=sLxmkrk2BfstzVRdxPzaQKu9L7s4kwNKPWn4vBoE5epz1RCIXL \
-e BOOTSTRAP_TOKEN=tDRi20rT270nOdFp \
-e DB_HOST=192.168.0.5 \
-e DB_PORT=3306 \
-e DB_USER='jumpserver' \
-e DB_PASSWORD="abc.123Aa" \
-e DB_NAME=jumpserver \
-e REDIS_HOST=192.168.0.5 \
-e REDIS_PORT=6379 \
-e REDIS_PASSWORD= \
jumpserver/jms_all:1.5.8
正确输出

在这里插入图片描述

登录验证

账户 admin
密码 admin

在这里插入图片描述

参考网站
https://www.cnblogs.com/cyh00001/p/16715146.html

具体跳板机的使用,主要是授权,登录,二次验证等,

可以参考下面的资料:
官网 http://www.jumpserver.org
文档 http://docs.jumpserver.org
有问题请参考 http://docs.jumpserver.org/zh/docs/faq.html
https://hub.docker.com/r/jumpserver/jms_all

文章来源:https://blog.csdn.net/startfefesfe/article/details/135062812
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。