没有合适的资源?快使用搜索试试~ 我知道了~
首页Jumpserver布署
Jumpserver布署
需积分: 50 995 浏览量
更新于2023-05-27
评论
收藏 32KB DOCX 举报
Centos7.4上布署免费开源的jump堡垒机,可以管理windows资源;
资源详情
资源评论
资源推荐

基于 CentOS 7.4 一步一步安装 Jumpserver 1.3.3
环境
系统: CentOS 7
IP: 192.168.244.144
关闭 selinux 和防火墙
# CentOS 7
$ setenforce 0 # 临时关闭,重启后失效
$ systemctl stop firewalld.service # 临时关闭,重启后失效
# 修改字符集,否则可能报 input/output error 的问题,因为日志里打印了中文
$ localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
$ export LC_ALL=zh_CN.UTF-8
$ echo 'LANG="zh_CN.UTF-8"' > /etc/locale.conf
# CentOS6
$ setenforce 0 # 临时关闭,重启后失效
$ service iptables stop # 临时关闭,重启后失效
# 修改字符集,否则可能报 input/output error 的问题,因为日志里打印了中文
$ localedef -c -f UTF-8 -i zh_CN zh_CN.UTF-8
$ export LC_ALL=zh_CN.UTF-8
$ echo 'LANG=zh_CN.UTF-8' > /etc/sysconfig/i18n
一. 准备 Python3 和 Python 虚拟环境
1.1 安装依赖包
$ yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel
epel-release git
Yum 加速设置请参考 <http://mirrors.163.com/.help/centos.html>
1.2 编译安装
$ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
$ tar xvf Python-3.6.1.tar.xz && cd Python-3.6.1

$ ./configure && make && make install
# 这里必须执行编译安装,否则在安装 Python 库依赖时会有麻烦...
1.3 建立 Python 虚拟环境
因为 CentOS 6/7 自带的是 Python2,而 Yum 等工具依赖原来的 Python,为
了不扰乱原来的环境我们来使用 Python 虚拟环境
$ cd /opt
$ python3 -m venv py3
$ source /opt/py3/bin/activate
# 看到下面的提示符代表成功,以后运行 Jumpserver 都要先运行以上 source 命令,以下所有命令
均在该虚拟环境中运行
(py3) [root@localhost py3]
1.4 自动载入 Python 虚拟环境配置
此项仅为懒癌晚期的人员使用,防止运行 Jumpserver 时忘记载入 Python 虚拟
环境导致程序无法运行。使用 autoenv
$ cd /opt
$ git clone git://github.com/kennethreitz/autoenv.git
$ echo 'source /opt/autoenv/activate.sh' >> ~/.bashrc
$ source ~/.bashrc
二. 安装 Jumpserver
2.1 下载或 Clone 项目
项目提交较多 git clone 时较大,你可以选择去 Github 项目页面直接下载 zip 包。
$ cd /opt/
$ git clone https://github.com/jumpserver/jumpserver.git && cd jumpserver &&
git checkout master

$ echo "source /opt/py3/bin/activate" > /opt/jumpserver/.env # 进入
jumpserver 目录时将自动载入 python 虚拟环境
# 首次进入 jumpserver 文件夹会有提示,按 y 即可
# Are you sure you want to allow this? (y/N) y
2.2 安装依赖 RPM 包
$ cd /opt/jumpserver/requirements
$ yum -y install $(cat rpm_requirements.txt) # 如果没有任何报错请继续
2.3 安装 Python 库依赖
$ pip install -r requirements.txt # 不要指定-i 参数,因为镜像上可能没有最新的包,如
果没有任何报错请继续
Pip 加速设置请参考 <https://segmentfault.com/a/1190000011875306>
2.4 安装 Redis, Jumpserver 使用 Redis 做 cache 和 celery broke
$ yum -y install redis
$ systemctl enable redis
$ systemctl start redis
# centos6
$ yum -y install redis
$ chkconfig redis on
$ service redis start
2.5 安装 MySQL
本教程使用 Mysql 作为数据库,如果不使用 Mysql 可以跳过相关 Mysql 安装和
配置
# centos7
$ yum -y install mariadb mariadb-devel mariadb-server # centos7 下安装的是
mariadb
$ systemctl enable mariadb
$ systemctl start mariadb

# centos6
$ yum -y install mysql mysql-devel mysql-server
$ chkconfig mysqld on
$ service mysqld start
2.6 创建数据库 Jumpserver 并授权
$ mysql
> create database jumpserver default charset 'utf8';
> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by
'somepassword';
> flush privileges;
2.7 修改 Jumpserver 配置文件
$ cd /opt/jumpserver
$ cp config_example.py config.py
$ vi config.py
# 注意对齐,不要直接复制本文档的内容,实际内容以文件为准,本文仅供参考
注意: 配置文件是 Python 格式,不要用 TAB,而要用空格
"""
jumpserver.config
~~~~~~~~~~~~~~~~~
Jumpserver project setting file
:copyright: (c) 2014-2017 by Jumpserver Team
:license: GPL v2, see LICENSE for more details.
"""
import os
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
class Config:
# Use it to encrypt or decrypt data
# Jumpserver
使用
SECRET_KEY
进行加密,请务必修改以下设置
# SECRET_KEY = os.environ.get('SECRET_KEY') or '2vym+ky!
997d5kkcc64mnz06y1mmui3lut#(^wd=%s_qj$1%x'
剩余15页未读,继续阅读







安全验证
文档复制为VIP权益,开通VIP直接复制

评论0