前言:
目前看官们对“jumpserver怎么安装nginx”可能比较重视,看官们都需要学习一些“jumpserver怎么安装nginx”的相关文章。那么小编在网络上汇集了一些有关“jumpserver怎么安装nginx””的相关文章,希望朋友们能喜欢,你们快快来了解一下吧!概述
前面已经介绍了跳板机中nginx和mariadb搭建部分的教程,下面主要介绍redis和jumpserver部署部分,一起来看看吧~
一、redis部署
1、安装redis服务
yum install -y epel-release #如果之前有epel-release,需移除重新安装,在/etc/yum.repos.d/下产生epel.repo,epel-testing.repoyum install -y redis//设置 redis 自启systemctl enable redis
2、修改redis配置
vi /etc/redis.conf
# bind 127.0.0.1 # 注释这行, 新增如下内容bind 0.0.0.0requirepass fswl@1234 # redis 连接密码maxmemory-policy allkeys-lru # 清理策略, 优先移除最近未使用的key
3、启动redis
systemctl start redis二、jumpserver部署
1、安装python3.6
yum -y install python36 python36-devel//配置 py3 虚拟环境python3.6 -m venv /opt/py3source /opt/py3/bin/activate
2、下载 Jumpserver
cd /optgit clone --depth=1
3、安装依赖 RPM 包和 Python 库依赖
yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt)pip install --upgrade pip setuptoolspip install -r /opt/jumpserver/requirements/requirements.txt
4、修改 jumpserver 配置文件
cd /opt/jumpservercp config_example.yml config.ymlSECRET_KEY=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 50` # 生成随机SECRET_KEYecho "SECRET_KEY=$SECRET_KEY" >> ~/.bashrcBOOTSTRAP_TOKEN=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16` # 生成随机BOOTSTRAP_TOKENecho "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bashrcsed -i "s/SECRET_KEY:/SECRET_KEY: $SECRET_KEY/g" /opt/jumpserver/config.ymlsed -i "s/BOOTSTRAP_TOKEN:/BOOTSTRAP_TOKEN: $BOOTSTRAP_TOKEN/g" /opt/jumpserver/config.ymlsed -i "s/# DEBUG: true/DEBUG: false/g" /opt/jumpserver/config.ymlsed -i "s/# LOG_LEVEL: DEBUG/LOG_LEVEL: ERROR/g" /opt/jumpserver/config.ymlsed -i "s/# SESSION_EXPIRE_AT_BROWSER_CLOSE: false/SESSION_EXPIRE_AT_BROWSER_CLOSE: true/g" /opt/jumpserver/config.yml
查看key和token
(py3) [root@jumpserver jumpserver]# echo -e "\033[31m 你的SECRET_KEY是 $SECRET_KEY \033[0m" 你的SECRET_KEY是 UOqMW7FoEfOhbvP6Rr0cdgukoCuXITulDkSYxo5nXpwiIN9HrR (py3) [root@jumpserver jumpserver]# echo -e "\033[31m 你的BOOTSTRAP_TOKEN是 $BOOTSTRAP_TOKEN \033[0m" 你的BOOTSTRAP_TOKEN是 yLzKMF0EaY81GCJk
vi /opt/jumpserver/config.yml
SECRET_KEY: UOqMW7FoEfOhbvP6Rr0cdgukoCuXITulDkSYxo5nXpwiIN9HrR# SECURITY WARNING: keep the bootstrap token used in production secret!# 预共享Token coco和guacamole用来注册服务账号, 不在使用原来的注册接受机制BOOTSTRAP_TOKEN: yLzKMF0EaY81GCJk# 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 日志级别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 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: fswl@1234DB_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: 6379REDIS_PASSWORD: fswl@1234
5、修改nginx配置文件
vi /etc/nginx/conf.d/jumpserver.conf
server { listen 8000; server_name ; # 自行修改成你的域名 return 301 ; client_max_body_size 100m; # 录像上传大小限制 location /media/ { add_header Content-Encoding gzip; root /opt/jumpserver/data/; # 录像位置, 如果修改安装目录, 此处需要修改 } location /static/ { root /opt/jumpserver/data/; # 静态资源, 如果修改安装目录, 此处需要修改 } location / { proxy_pass ; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; }}
6、nginx 测试并启动
nginx -tsystemctl start nginx
7、运行 Jumpserver
cd /opt/jumpserver./jms start all # 后台运行使用 -d 参数./jms start all -d# 新版本更新了运行脚本, 使用方式./jms start|stop|status all 后台运行请添加 -d 参数
到这里你以为就结束了?不,不,跳板机还要有ssh连接那些工具呢,也就是接下来docker部分的搭建,后面会分享最后jumpserver方面的内容,感兴趣的朋友可以关注一下~
标签: #jumpserver怎么安装nginx #jumpserver安装配置 #jumpserver部署教程 #jumpserver搭建