这里整理一些网上找到的IT项目

一步步安装Jumpserver堡垒机图文详解(官方教程版),从此爽歪歪!

PHPer 2022-05-25 361 0 1

测试推荐环境

· CPU: 64位双核处理器

· 内存: 4G DDR3

· 数据库:mysql 版本大于等于 5.6 mariadb 版本大于等于 5.5.6

环境

· 系统: CentOS 7

· IP: 192.168.244.144

· 设置 selinux 和防火墙

$ firewall-cmd --zone=public --add-port=80/tcp --permanent # nginx 端口
$ firewall-cmd --zone=public --add-port=2222/tcp --permanent # SSH登录端口
$ firewall-cmd --reload # 重新载入规则
$ setenforce 0
$ sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config

一. 准备 Python3 和 Python 虚拟环境

1.1 安装依赖包

$ yum -y install wget gcc epel-release git

1.2 安装 Python3.6

$ 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

1.3 建立 Python 虚拟环境

因为 CentOS 7 自带的是 Python2, 而 Yum 等工具依赖原来的 Python, 为了不扰乱原来的环境我们来使用 Python 虚拟环境
$ cd /opt
$ python3.6 -m venv py3
$ source /opt/py3/bin/activate
# 看到下面的提示符代表成功, 以后运行 Jumpserver 都要先运行以上 source 命令, 以下所有命令均在该虚拟环境中运行(py3) [root@localhost py3]

二. 安装 Jumpserver

2.1 下载或 Clone 项目

项目提交较多 git clone 时较大, 你可以选择去 Github 项目页面直接下载zip包。

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

2.2 安装依赖 RPM 包

$ cd /opt/jumpserver/requirements
$ yum -y install $(cat rpm_requirements.txt) # 如果没有任何报错请继续

2.3 安装 Python 库依赖

$ pip install --upgrade pip setuptools
$ pip install -r 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/

2.4 安装 Redis, Jumpserver 使用 Redis 做 cache 和 celery broke

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

2.5 安装 MySQL

本教程使用 Mysql 作为数据库, 如果不使用 Mysql 可以跳过相关 Mysql 安装和配置

$ yum -y install mariadb mariadb-devel mariadb-server mariadb-shared # centos7下安装的是mariadb
$ systemctl enable mariadb
$ systemctl start mariadb

2.6 创建数据库 Jumpserver 并授权

$ DB_PASSWORD=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 24` # 生成随机数据库密码
$ echo -e "\033[31m 你的数据库密码是 $DB_PASSWORD \033[0m"
$ 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;"

2.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` # 生成随机SECRET_KEY
$ echo "SECRET_KEY=$SECRET_KEY" >> ~/.bashrc
$ BOOTSTRAP_TOKEN=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16` # 生成随机BOOTSTRAP_TOKEN
$ 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
$ echo -e "\033[31m 你的SECRET_KEY是 $SECRET_KEY \033[0m"
$ echo -e "\033[31m 你的BOOTSTRAP_TOKEN是 $BOOTSTRAP_TOKEN \033[0m"
$ vi config.yml # 确认内容有没有错误
# SECURITY WARNING: keep the secret key used in production secret!# 加密秘钥 生产环境中请修改为随机字符串, 请勿外泄, PS: 纯数字不可以SECRET_KEY:
# SECURITY WARNING: keep the bootstrap token used in production secret!# 预共享Token coco和guacamole用来注册服务账号, 不在使用原来的注册接受机制BOOTSTRAP_TOKEN:
# Development env open this, when error occur display the full process track, Production disable it# DEBUG 模式 开启DEBUG后遇到错误时可以看到更多日志DEBUG: false
# DEBUG, INFO, WARNING, ERROR, CRITICAL can set. See https://docs.djangoproject.com/en/1.10/topics/logging/# 日志级别LOG_LEVEL: ERROR# LOG_DIR:
# Session expiration setting, Default 24 hour, Also set expired on on browser close# 浏览器Session过期时间, 默认24小时, 也可以设置浏览器关闭则过期# SESSION_COOKIE_AGE: 86400SESSION_EXPIRE_AT_BROWSER_CLOSE: true
# Database setting, Support sqlite3, mysql, postgres ....# 数据库设置# See https://docs.djangoproject.com/en/1.10/ref/settings/#databases
# SQLite setting:# 使用单文件sqlite数据库# DB_ENGINE: sqlite3# DB_NAME:
# MySQL or postgres setting like:# 使用Mysql作为数据库DB_ENGINE: mysqlDB_HOST: 127.0.0.1DB_PORT: 3306DB_USER: jumpserverDB_PASSWORD:DB_NAME: jumpserver
# When Django start it will bind this host and port# ./manage.py runserver 127.0.0.1:8080# 运行时绑定端口HTTP_BIND_HOST: 0.0.0.0HTTP_LISTEN_PORT: 8080
# Use Redis as broker for celery and web socket# Redis配置REDIS_HOST: 127.0.0.1REDIS_PORT: 6379# REDIS_PASSWORD:# REDIS_DB_CELERY: 3# REDIS_DB_CACHE: 4
# Use OpenID authorization# 使用OpenID 来进行认证设置# BASE_SITE_URL: http://localhost:8080# AUTH_OPENID: false # True or False# AUTH_OPENID_SERVER_URL: https://openid-auth-server.com/# AUTH_OPENID_REALM_NAME: realm-name# AUTH_OPENID_CLIENT_ID: client-id# AUTH_OPENID_CLIENT_SECRET: client-secret
# OTP settings# OTP/MFA 配置# OTP_VALID_WINDOW: 0# OTP_ISSUER_NAME: Jumpserver

2.8 运行 Jumpserver...

立即注册

更新于:2022-05-25 23:43:47
    您需要登录后才可以评论。 立即注册
    相关内容

    Opencart 免费主题下载汇总

    Opencart 可用的免费主题

    视频精选一

    各种采集应用和采集插件的安装整理

    PHP Querylist采集插件Puppeteer的安装

    PHP采集页面的四种方法

    python获取完整网页内容(含js动态加载的):selenium+phantomjs

    php-webdriver 配合chromedriver 采集 (Windows系统)(2023年12月)

    IT理论

    OSI模型-百度百科

    OSI模型-智库百科

    OSI model-维基百科

    SOCKS-维基百科

    socks-百度百科

    这里整理一些网上找到的IT项目

    All in Web | 远程桌面网关-Apache Guacamole

    gitlab 的简介

    【教程】使用腾讯云轻量应用服务器搭建 Guacamole 远程桌面代理服务器,让境...

    apache 开源项目全家桶 2020年12月中文介绍

    JumpServer 架构浅解

    手把手从0开始教你搭建Jumpserver,为服务器安全保驾护航!

    一步步安装Jumpserver堡垒机图文详解(官方教程版),从此爽歪歪!

    [Awesome Github] -2020_07_25

    Windows系统Git安装教程(详解Git安装过程)

    Aria2:windows上的详细使用方法

    开源论坛:社区选择Discourse(​在github上论坛排名第一 ,35.8K个星星)

    推荐内容

    分享几个好用的bt搜索bt资源下载网址网站

    影视电影剧集动漫综艺bt资源在线播放网址网站推荐分享

    全网最新bt磁力搜索引擎bt资源bt网站网址分享

    人气美女女优百度指数排行榜(波多野结衣,苍井空,三上悠亚,深田咏美,桥本有菜,北条...

    最强人造人深田咏美,业界的社交女王

    人生起起落落的三上悠亚,成名前的清纯风,怎么搭配出来的?

    业内第一大长腿,桥本有菜的腿究竟有多长

    波多野结衣,岛国业界著作最多的超级劳模

    日本AV界NO.1,苍井空是多少宅男的疯狂?

    美女女优视频混剪 This Girl-Laza Morgan

    怎样使用V2Ray代理和SSTap玩如魔兽世界/绝地求生/LOL台服/战地3/黑色沙漠/彩...

    sstap游戏代理教程 从此玩如魔兽世界/绝地求生/LOL台服/战地3/黑色沙漠/彩虹六...

    影视电影剧集动漫综艺bt资源在线播放网址网站推荐分享