Jumpserver v0.4.0 版本安装详细过程
系统: CentOS6
Python版本: Python: 3.6
安装目录: /opt/jumpserver /opt/coco
一. 环境准备
1.1 安装基本工具和库
yum -y install sqlite-devel git epel-release yum -y install sshpass python-devel libffi-devel openssl-devel yum -y install gcc gcc-c++
1.2 安装Python 3.6 和 Django
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz tar -xf Python-3.6.1.tgz && cd Python-3.6.1 ./configure && make && make install
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安装Django==1.10.5
安装完成 python3.6后应该是自动安装了pip9.0.1 所以直接安装django pip install django==1.10.5 然后做软连接 ln -s /usr/local/bin/django-admin.py /usr/bin/django-admin
二. 安装Jumpserver 0.4.0
2.1 下载或clone项目
项目提交较多git clone时较大,你可以选择去github项目页面直接下载 zip包,我的网速好,我直接clone了
cd /opt/ git clone https://github.com/jumpserver/jumpserver.git 2.2 安装依赖rpm包
cd /opt/ cd jumpserver/requirements #yum -y install epel-release yum -y install $(cat rpm_requirements.txt) # 如果没有任何报错请继续 2.3 安装python库依赖
pip install -r requirements.txt # 如果没有任何报错请继续 2.4 安装Redis,jumpserver使用celery依赖
yum -y install redis service redis start
2.5 安装MysqL 注意:如果数据库已经存在,就不用在安装了。 #yum -y install MysqL MysqL-devel MysqL-server #service MysqL 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 安装 python3 MysqL驱动: MysqLclient 由于MysqLdb库不支持 python3.5+,所以选择了MysqLclient作为驱动,pyMysqL使用python写的,速度较慢 pip install MysqLclient 2.8 修改jumpserver配置文件 cd /opt/jumpserver cp config_example.py config.py ### 我们计划修改 DevelopmentConfig中的配置,因为默认jumpserver是使用该配置,它继承自Config vim config.py
class DevelopmentConfig(Config): DEBUG = True DISPLAY_PER_PAGE = 20 DB_ENGINE = 'MysqL' DB_HOST = '127.0.0.1' DB_PORT = 3306 DB_USER = 'jumpserver' DB_PASSWORD = 'somepassword' DB_NAME = 'jumpserver' EMAIL_HOST = 'smtp.exmail.qq.com' EMAIL_PORT = 465 EMAIL_HOST_USER = 'a@jumpserver.org' EMAIL_HOST_PASSWORD = 'somepasswrd' EMAIL_USE_SSL = True EMAIL_USE_TLS = False EMAIL_SUBJECT_PREFIX = '[Jumpserver] ' SITE_URL = 'http://192.168.244.144:8080'
2.9 生成数据库表结构和初始化数据 cd /opt/jumpserver/utils bash make_migrations.sh bash init_db.sh 2.10 运行Jumpserver cd /opt/jumpserver python run_server.py 运行不报错,请浏览器访问 http://192.168.244.144:8080/ 账号: admin 密码: admin ## 三. 安装 SSH Server: Coco 3.1 下载clone项目 新开一个终端,连接测试机,别忘了 source /opt/py3/bin/activate cd /opt git clone https://github.com/jumpserver/coco.git 3.2 安装依赖 cd /opt/coco/requirements yum -y install $(cat rpm_requirements.txt) pip install -r requirements.txt 3.3 查看配置文件并运行 cd /opt/coco cat config.py python run_server.py ERROR:root:Load access key Failed Using access key 311d0e77-5ec9-4c46-a131-7409e1daf271:*** WARNING:/opt/coco/coco/service.py:App auth Failed,Access key error or need admin active it 这时需要去 jumpserver管理后台-应用程序-终端(http://192.168.244.144:8080/applications/terminal/)接受coco的注册 Coco version 0.4.0,more see https://www.jumpserver.org Starting ssh server at 0.0.0.0:2222 Quit the server with CONTROL-C. 这时完成安装 3.4 测试连接 ssh -p2222 admin@192.168.244.144 密码: admin 如果是用Xshell登录语法如下 $ssh admin@192.168.244.144 2222 密码: admin 如果能登陆代表部署成功 ## 四. 安装 Web Terminal: Luna 新开一个终端,连接测试机,别忘了 source /opt/py3/bin/activate 4.1 下载clone项目 cd /opt git clone https://github.com/jumpserver/luna.git 4.2 安装依赖 cd /opt/luna/requirements yum -y install $(cat rpm_requirements.txt) pip install -r requirements.txt 4.3 查看配置文件并运行 cd /opt/luna cat config.py python run_server.py ERROR:root:Load access key Failed Using access key 5bfdbf63-bef5-4cfb-9e31-2d873bdddb03:*** WARNING:luna.service:App auth Failed,Access key error or need admin active it 4.4 同样去jumpserver管理后台接受luna注册 应用程序-终端 接受 Luna version 0.4.0,more see https://www.jumpserver.org Starting web server at 0.0.0.0:5000 Quit the server with CONTROL-C. 4.5 测试 访问 http://192.168.244.144:5000 基于 CenOS7 的系统 https://github.com/jumpserver/jumpserver/wiki/v0.4.0-%E5%9F%BA%E4%BA%8E-CenOS7-%E7%9A%84%E7%B3%BB%E7%BB%9F原文链接:https://www.f2er.com/centos/375026.html