堡垒机怎么安装mysql_JumpServer堡垒机安装

JumpServer简介

JumpServer 是全球首款完全开源的堡垒机, 使用 GNU GPL v2.0 开源协议, 是符合 4A 的专业运维审计系统。

JumpServer 使用 Python / Django 进行开发, 遵循 Web 2.0 规范, 配备了业界领先的 Web Terminal 解决方案, 交互界面美观、用户体验好。

JumpServer 采纳分布式架构, 支持多机房跨区域部署, 中心节点提供 API, 各机房部署登录节点, 可横向扩展、无并发访问限制。

JumpServer 现已支持管理 SSH、 Telnet、 RDP、 VNC 协议资产。

极速安装

说明

全新安装的 Centos7 (7.x)

需要连接 互联网

使用 root 用户执行

下载

[root@localhost ~]# cd /opt

[root@localhost ~]# yum -y install wget git

[root@localhost ~]# git clone --depth=1 https://github.com/jumpserver/setuptools.git

[root@localhost ~]# cd setuptools

[root@localhost ~]# cp config_example.conf config.conf

[root@localhost ~]# vi config.conf

# 以下设置默认情况下不需要修改

# 需要安装的版本

Version=1.5.9

# Jms 加密配置

SECRET_KEY=

BOOTSTRAP_TOKEN=

# 数据库 配置, 如果 数据库 安装在其他的服务器, 请修改下面设置

DB_HOST=127.0.0.1

DB_PORT=3306

DB_USER=jumpserver

DB_PASSWORD=

DB_NAME=jumpserver

# Redis 配置, 如果 Redis 安装在其他的服务器, 请修改下面设置

REDIS_HOST=127.0.0.1

REDIS_PORT=6379

REDIS_PASSWORD=

# 服务端口设置, 如果云服务器未备案请修改 http_port 端口为其他端口

http_port=80

ssh_port=2222

# 服务安装目录

install_dir=/opt

Server_IP=`ip addr | grep 'state UP' -A2 | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1`

Docker_IP=`ip addr | grep docker.* | grep inet | awk '{print $2}' | head -n 1`

安装

[root@localhost ~]# ./jmsctl.sh install

升级

[root@localhost ~]# cd /opt/setuptools

[root@localhost ~]# git pull

[root@localhost ~]# ./jmsctl.sh upgrade

帮助

[root@localhost ~]# ./jmsctl.sh -h

如果网络有问题无法连接到 github

[root@localhost ~]# wget -O /opt/setuptools.tar.gz http://demo.jumpserver.org/download/setuptools.tar.gz

[root@localhost ~]# cd /opt

[root@localhost ~]# tar -xf setuptools.tar.gz

[root@localhost ~]# cd setuptools

[root@localhost ~]# git pull

[root@localhost ~]# ./jmsctl.sh -h

Docker安装

JumpServer封装了一个 All in one Docker, 可以快速启动。该镜像集成了所需要的组件, 支持使用外置Database和Redis

快速启动

使用 root 身份输入

环境迁移和更新升级请检查SECRET_KEY是否与之前设置一致, 不能随机生成, 否则数据库所有加密的字段均无法解密

[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

[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

[root@localhost ~]# docker run --name jms_all -d -p 80:80 -p 2222:2222 -e SECRET_KEY=$SECRET_KEY -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN jumpserver/jms_all:latest

# macOS 生成随机 key 可以用下面的命令

$ if [ "$SECRET_KEY" = "" ]; then SECRET_KEY=`LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 50`; echo "SECRET_KEY=$SECRET_KEY" >> ~/.bash_profile; echo $SECRET_KEY; else echo $SECRET_KEY; fi

$ if [ "$BOOTSTRAP_TOKEN" = "" ]; then BOOTSTRAP_TOKEN=`LC_CTYPE=C tr -dc A-Za-z0-9 < /dev/urandom | head -c 16`; echo "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bash_profile; echo $BOOTSTRAP_TOKEN; else echo $BOOTSTRAP_TOKEN; fi

访问

浏览器访问:http://

SSH访问:ssh -p 2222

XShell等工具请添加connection连接, 默认ssh端口2222

默认管理员账户admin密码admin

外置数据库要求

mysql 版本需要大于等于 5.6

mariadb 版本需要大于等于 5.5.6

数据库编码要求 uft8

创建数据库

# mysql

mysql> create database jumpserver default charset 'utf8' collate 'utf8_bin';

mysql> grant all on jumpserver.* to 'jumpserver'@'%' identified by 'weakPassword';

额外环境变量

SECRET_KEY = **

BOOTSTRAP_TOKEN = **

DB_HOST = mysql_host

DB_PORT = 3306

DB_USER = jumpserver

DB_PASSWORD = weakPassword

DB_NAME = jumpserver

REDIS_HOST = 127.0.0.1

REDIS_PORT = 6379

REDIS_PASSWORD = xxx

VOLUME /opt/jumpserver/data/media

VOLUME /var/lib/mysql

# Install

[root@localhost ~]# docker run --name jms_all -d \

-v /opt/jumpserver:/opt/jumpserver/data/media \

-p 80:80 \

-p 2222:2222 \

-e SECRET_KEY=xxxxxx \

-e BOOTSTRAP_TOKEN=xxx \

-e DB_HOST=192.168.x.x \

-e DB_PORT=3306 \

-e DB_USER=root \

-e DB_PASSWORD=xxx \

-e DB_NAME=jumpserver \

-e REDIS_HOST=192.168.x.x \

-e REDIS_PORT=6379 \

-e REDIS_PASSWORD=xxx \

jumpserver/jms_all:latest

Docker-Compose安装

.env的变量用在docker-compose里面, 可以自己看下可能还有一些未能检测到的问题, 尽量自己调试一遍后再使用

[root@localhost ~]# git clone https://github.com/jumpserver/Dockerfile.git

[root@localhost ~]# cd Dockerfile

[root@localhost ~]# cat .env

[root@localhost ~]# docker-compose up

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值