博客
关于我
centos7安装部署jumpserver
阅读量:514 次
发布时间:2019-03-07

本文共 4076 字,大约阅读时间需要 13 分钟。

CentOS 7 下 Jumpserver 应用部署指南

一、系统环境准备

1. 查看系统版本

# cat /etc/redhat-releaseCentOS Linux release 7.5.1804 (Core)# uname -aLinux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

2. 关闭 SELINUX 和防火墙

# getenforce  # 查看 SELINUX 状态,如果为 Enable,运行 `setenforce 0`Disabled# systemctl stop firewalld.service  # 关闭防火墙

3. 修改字符集

确保系统支持 UTF-8 加码:

# 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

二、准备 Python 3 和虚拟环境

1. 安装依赖包

# yum -y install wgetvim lrzsz xz gcc git epel-release python-pip python-devel mysql-devel automake autoconf sqlite-devel zlib-devel openssl-devel sshpass readline-devel

2. 编译安装 Python 3

# yum -y install python36 python36-devel# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo# yum -y install python36 python36-devel

3. 创建 Python 虚拟环境

# cd /opt# python3.6 -m venv py3# source /opt/py3/bin/activate  # 成功后提示符显示 `(py3)` 表示虚拟环境已激活

所有以 (py3) 表示的命令均在虚拟环境中运行。

三、安装 Jumpserver

1. 克隆或下载项目

# git clone --depth=1 https://github.com/jumpserver/jumpserver.git

2. 安装依赖包

# cd /opt/jumpserver/requirements# yum -y install $(cat rpm_requirements.txt)# pip install --upgrade pip setuptools -i https://mirrors.aliyun.com/pypi/simple/# pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

3. 安装 Python 库依赖

# pip install --upgrade pip setuptools# pip install -r requirements.txt

4. 安装 Redis

# yum -y install redis# systemctl enable redis# systemctl start redis

5. 安装 MySQL(CentOS 7 默认安装 MariaDB)

# yum -y install mariadb mariadb-devel mariadb-server# systemctl enable mariadb# systemctl start mariadb

6. 创建并授权 Jumpserver 数据库

# DB_PASSWORD=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 24`# mysql -uroot -e "create database jumpserver default charset 'utf8'; grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by '$DB_PASSWORD'; flush privileges;"

7. 修改 Jumpserver 配置文件

# cd /opt/jumpserver/# cp config_example.yml config.yml# SECRET_KEY=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 50`# echo "SECRET_KEY=$SECRET_KEY" >> ~/.bashrc# BOOTSTRAP_TOKEN=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16`# echo "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bashrc# sed -i "s/SECRET_KEY:/SECRET_KEY: $SECRET_KEY/g" /opt/jumpserver/config.yml# sed -i "s/BOOTSTRAP_TOKEN:/BOOTSTRAP_TOKEN: $BOOTSTRAP_TOKEN/g" /opt/jumpserver/config.yml# sed -i "s/# DEBUG: true/DEBUG: false/g" /opt/jumpserver/config.yml# sed -i "s/# LOG_LEVEL: DEBUG/LOG_LEVEL: ERROR/g" /opt/jumpserver/config.yml# sed -i "s/# SESSION_EXPIRE_AT_BROWSER_CLOSE: false/SESSION_EXPIRE_AT_BROWSER_CLOSE: true/g" /opt/jumpserver/config.yml# sed -i "s/DB_PASSWORD: /DB_PASSWORD: $DB_PASSWORD/g" /opt/jumpserver/config.yml

8. 运行 Jumpserver

# cd /opt/jumpserver/# ./jms start all -d  # 后台运行,带 `-d` 参数

四、安装 SSH 服务器和 WebSocket 服务器(Coco)

1. 克隆项目

# cd /opt# git clone --depth=1 https://github.com/jumpserver/coco.git

2. 安装依赖

# cd /opt/coco/requirements# yum -y install $(cat rpm_requirements.txt)# pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

3. 修改配置并运行

# cd /opt/coco/# cp config_example.yml config.yml# sed -i "s/BOOTSTRAP_TOKEN: 
/BOOTSTRAP_TOKEN: $BOOTSTRAP_TOKEN/g" /opt/coco/config.yml# sed -i "s/# LOG_LEVEL: INFO/LOG_LEVEL: ERROR/g" /opt/coco/config.yml# ./cocod start -d # 后台运行,带 `-d` 参数

五、安装 Web Terminal 前端(Luna)

1. 下载并解压

# wget https://github.com/jumpserver/luna/releases/download/1.4.10/luna.tar.gz# tar -xvf luna.tar.gz# chown -R root:root luna

六、配置 Nginx 整合各组件

1. 安装 Nginx

# yum install yum-utils# vi /etc/yum.repos.d/nginx.repo# yum makecache fast# yum install -y nginx# rm -rf /etc/nginx/conf.d/default.conf# systemctl enable nginx

2. 修改配置文件

# vim /etc/nginx/conf.d/jumpserver.conf

3. 运行 Nginx

# nginx -t# systemctl start nginx# systemctl enable nginx

七、测试 Jumpserver 功能

1. 访问 web 页面

# curl http://192.168.0.1  # Replace 以实际 IP 地址替换

2. 测试连接

  • Linux/MacOS:
$ ssh -p2222 admin@192.168.0.1密码: admin
  • Windows:
$ ssh admin@192.168.0.1 2222密码: admin

通过以上步骤,Jumpserver 应用在 CentOS 7 环境下已成功部署完毕。

转载地址:http://okmjz.baihongyu.com/

你可能感兴趣的文章
NLP_什么是统计语言模型_条件概率的链式法则_n元统计语言模型_马尔科夫链_数据稀疏(出现了词库中没有的词)_统计语言模型的平滑策略---人工智能工作笔记0035
查看>>
NLP学习笔记:使用 Python 进行NLTK
查看>>
NLP的神经网络训练的新模式
查看>>
NLP采用Bert进行简单文本情感分类
查看>>
NLP问答系统:使用 Deepset SQUAD 和 SQuAD v2 度量评估
查看>>
NLP:使用 SciKit Learn 的文本矢量化方法
查看>>
Nmap扫描教程之Nmap基础知识
查看>>
Nmap端口扫描工具Windows安装和命令大全(非常详细)零基础入门到精通,收藏这篇就够了
查看>>
NMAP网络扫描工具的安装与使用
查看>>
NMF(非负矩阵分解)
查看>>
nmon_x86_64_centos7工具如何使用
查看>>
NN&DL4.1 Deep L-layer neural network简介
查看>>
NN&DL4.3 Getting your matrix dimensions right
查看>>
NN&DL4.8 What does this have to do with the brain?
查看>>
nnU-Net 终极指南
查看>>
No 'Access-Control-Allow-Origin' header is present on the requested resource.
查看>>
NO 157 去掉禅道访问地址中的zentao
查看>>
no available service ‘default‘ found, please make sure registry config corre seata
查看>>
no connection could be made because the target machine actively refused it.问题解决
查看>>
No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
查看>>