jumpserver 1.5.9安装
Posted blog-lhong
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了jumpserver 1.5.9安装相关的知识,希望对你有一定的参考价值。
##jumpserver 1.5.9安装
#!/bin/bash ###jumpserver 1.5.9 systemctl stop firewalld systemctl disable firewalld setenforce 0 sed -i "s/SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config hostnamectl set-hostname node$(hostname -I |cut -d ‘.‘ -f4) #@准备Python3和python虚拟环境 #安装依赖包 yum -y install wget gcc git epel-release #安装Python3.6 yum -y install python36 python36-devel #安装redis yum -y install redis systemctl enable redis systemctl start redis #安装mariadb yum -y install mariadb mariadb-devel mariadb-server mariadb-shared systemctl enable mariadb systemctl start mariadb #创建数据看看jumpserver并授权 mysql -e "create database if not exists jumpserver default charset ‘utf8‘; grant all on jumpserver.* TO ‘jumpserver‘@‘localhost‘ IDENTIFIED BY ‘jumpserver‘; flush privileges;" mysql -ujumpserver -pjumpserver -e ‘show databases;‘ #建立Python虚拟环境 python3.6 -m venv /opt/py3 source /opt/py3/bin/activate wget http://134.175.107.119/download/jumpserver/1.5.9/jumpserver.tar.gz tar zxvf jumpserver.tar.gz -C /opt/ ####安装编译环境依赖 cd /opt/jumpserver/requirements #安装依赖rpm包 yum install -y $(cat rpm_requirements.txt) #安装Python库依赖 pip install wheel && pip install --upgrade pip setuptools && pip install -r requirements.txt #确保已经载入 py3 虚拟环境, 中间如果遇到报错一般是依赖包没装全, 可以通过 搜索引擎 解决 #国内可以使用镜像加速 # #pip install wheel -i https://mirrors.aliyun.com/pypi/simple/ #pip install --upgrade pip setuptools -i https://mirrors.aliyun.com/pypi/simple/ #pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/ ##修改配置文件 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 ####数据库密码jumpserver sed -i ‘s/DB_PASSWORD:.*/DB_PASSWORD: jumpserver/g‘ /opt/jumpserver/config.yml echo -e "