[Update] 更新文档说明,使用python3

pull/462/head
GuangHongwei 8 years ago
parent 56e648e924
commit 831ac60e25

@ -1,9 +1,9 @@
## Jumpserver ## Jumpserver
Jumpserver是一款使用Python, Django开发的开源跳板机系统, 助力互联网企业高效 用户、资产、权限、审计 管理 Jumpserver是一款使用Python, Django开发的开源跳板机系统, 助力互联网企业高效 用户、资产、权限、审计 管理
### 开发环境 ### 环境
* Python 2.7 # 开发时需考虑兼容Python3 * Python 3.5 # 大部分功能兼容Python2.7
* Django 1.10 * Django 1.11
### 安装 ### 安装
- 安装依赖库 - 安装依赖库
@ -16,11 +16,11 @@ Jumpserver是一款使用Python, Django开发的开源跳板机系统, 助力互
- 安装Python依赖包 - 安装Python依赖包
``` ```
# 请自行安装 Python2.7 和 pip, 以下运行是以python2.7和pip2.7开始 # 请自行安装 Python 和 pip, 和虚拟环境, 如果速度慢可以尝试后面的 douban pypi
$ pip2.7 install -r requirements.txt -i https://pypi.doubanio.com/simple $ pip3 install -r requirements.txt # -i https://pypi.doubanio.com/simple
# MacOS # MacOS
$ pip2.7 install -r requirements.txt -i https://pypi.doubanio.com/simple --user $ pip3 install -r requirements.txt # -i https://pypi.doubanio.com/simple --user
``` ```
- 配置文件 - 配置文件
@ -34,9 +34,9 @@ $ cp config_example.py config.py
- 初始化数据库 - 初始化数据库
``` ```
# cd utils $ cd utils
# sh make_migrations.sh $ sh make_migrations.sh
# sh init_db.sh $ sh init_db.sh
``` ```
- 依赖redis - 依赖redis
@ -48,7 +48,7 @@ $ service redis start # Run docker or redis-server &
- 启动 - 启动
``` ```
$ python2.7 run_server.py $ python3 run_server.py
``` ```
### 开发者文档 ### 开发者文档

@ -3,7 +3,7 @@
### 环境 ### 环境
- 系统: CentOS 6.5 x86\_64 mini - 系统: CentOS 6.5 x86\_64 mini
- Python: 版本 2.7.13 (未来支持 3.5) - Python: 版本 3.6 大部分功能兼容 2.7
- 安装目录 - 安装目录
- /opt/jumpserver - /opt/jumpserver
- /opt/coco - /opt/coco
@ -17,31 +17,9 @@
$ yum -y install gcc gcc-c++ $ yum -y install gcc gcc-c++
##### 1.2 安装Python ##### 1.2 安装Python 3.6 和 虚拟环境
这里可以参考 [https://segmentfault.com/a/1190000000654227][1] 也可以下载我编译的rpm版本:
$ wget http://repo.jumpserver.org/python27-2.7.13-1.el6.x86_64.rpm
$ yum localinstall -y python27-2.7.13-1.el6.x86_64.rpm
$ bash
$ python2.7 -V
Python 2.7.13
设置默认python版本为2.7.13:
```
$ mv /usr/bin/python /usr/bin/python.bak
$ which python2.7
/data/server/python27/bin/python2.7
$ ln -s /data/server/python27/bin/python2.7 /usr/bin/python
$python
Python 2.7.13
```
设置yum默认python用2.6:
```
$ vim /usr/bin/yum
#!/usr/bin/python2.6
```
#### 二. Jumpserver安装 #### 二. Jumpserver安装
@ -89,7 +67,7 @@ $ vim /usr/bin/yum
**2.6 启动** **2.6 启动**
``` ```
$ cd .. $ cd ..
$ python2.7 run_server.py $ python run_server.py
``` ```
访问 http://ip:8080 访问 http://ip:8080
账号密码: admin admin 账号密码: admin admin
@ -121,20 +99,20 @@ $ git clone https://github.com/jumpserver/coco.git
**3.2 安装依赖** **3.2 安装依赖**
``` ```
$ cd coco $ cd coco
$ pip2.7 install -r requirements.txt -i https://pypi.doubanio.com/simple $ pip install -r requirements.txt # -i https://pypi.doubanio.com/simple
``` ```
**3.3 启动** **3.3 启动**
``` ```
$ python2.7 run_server.py $ python run_server.py
``` ```
说明: Coco启动后会向jumpserver注册请去 jumpserver页面 - 应用程序 - terminal - coco - Accept 允许, 这时 coco就 运行在 2222端口可以ssh来连接 说明: Coco启动后会向jumpserver注册请去 jumpserver页面 - 应用程序 - terminal - coco - Accept 允许, 这时 coco就 运行在 2222端口可以ssh来连接
命令行: 命令行:
```  ``` 
ssh admin@192.168.244.128 -p2222 ssh admin@YourServerIP -p2222
``` ```
**3.5 测试** **3.5 测试**

@ -1,17 +1,17 @@
#!/bin/bash #!/bin/bash
# #
python2.7 ../apps/manage.py shell << EOF python ../apps/manage.py shell << EOF
from users.models.utils import * from users.models.utils import *
generate_fake() generate_fake()
from assets.models.utils import * from assets.models.utils import *
generate_fake() generate_fake()
EOF EOF
python2.7 ../apps/manage.py dbshell << EOF python ../apps/manage.py dbshell << EOF
delete from django_content_type; delete from django_content_type;
delete from auth_permission; delete from auth_permission;
EOF EOF
python2.7 ../apps/manage.py dumpdata > ../apps/fixtures/fake.json python ../apps/manage.py dumpdata > ../apps/fixtures/fake.json

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# #
python2.7 ../apps/manage.py shell << EOF python ../apps/manage.py shell << EOF
from users.models import * from users.models import *
init_model() init_model()
@ -13,9 +13,9 @@ LoginLog.objects.all().delete()
EOF EOF
python2.7 ../apps/manage.py dbshell << EOF python ../apps/manage.py dbshell << EOF
delete from django_content_type; delete from django_content_type;
delete from auth_permission; delete from auth_permission;
EOF EOF
python2.7 ../apps/manage.py dumpdata > ../apps/fixtures/init.json python ../apps/manage.py dumpdata > ../apps/fixtures/init.json

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
# #
python2.7 ../apps/manage.py loaddata init python ../apps/manage.py loaddata init

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/bash
# #
python2.7 ../apps/manage.py loaddata fake python ../apps/manage.py loaddata fake

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
python2.7 ../apps/manage.py makemigrations python ../apps/manage.py makemigrations
python2.7 ../apps/manage.py migrate python ../apps/manage.py migrate

Loading…
Cancel
Save