From 831ac60e25ae86a7f7ff6d5c187213e878cbf571 Mon Sep 17 00:00:00 2001 From: GuangHongwei Date: Thu, 11 May 2017 09:43:59 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E8=AF=B4=E6=98=8E=EF=BC=8C=E4=BD=BF=E7=94=A8python3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 20 ++++++++++---------- docs/install.md | 36 +++++++----------------------------- utils/export_fake_data.sh | 6 +++--- utils/export_init_data.sh | 6 +++--- utils/init_db.sh | 2 +- utils/load_fake_data.sh | 2 +- utils/make_migrations.sh | 4 ++-- 7 files changed, 27 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 8787b3f43..9e51b239b 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ## Jumpserver Jumpserver是一款使用Python, Django开发的开源跳板机系统, 助力互联网企业高效 用户、资产、权限、审计 管理 -### 开发环境 - * Python 2.7 # 开发时需考虑兼容Python3 - * Django 1.10 +### 环境 + * Python 3.5 # 大部分功能兼容Python2.7 + * Django 1.11 ### 安装 - 安装依赖库 @@ -16,11 +16,11 @@ Jumpserver是一款使用Python, Django开发的开源跳板机系统, 助力互 - 安装Python依赖包 ``` -# 请自行安装 Python2.7 和 pip, 以下运行是以python2.7和pip2.7开始 -$ pip2.7 install -r requirements.txt -i https://pypi.doubanio.com/simple +# 请自行安装 Python 和 pip, 和虚拟环境, 如果速度慢可以尝试后面的 douban pypi +$ pip3 install -r requirements.txt # -i https://pypi.doubanio.com/simple # 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 -# sh make_migrations.sh -# sh init_db.sh +$ cd utils +$ sh make_migrations.sh +$ sh init_db.sh ``` - 依赖redis @@ -48,7 +48,7 @@ $ service redis start # Run docker or redis-server & - 启动 ``` -$ python2.7 run_server.py +$ python3 run_server.py ``` ### 开发者文档 diff --git a/docs/install.md b/docs/install.md index 57d5d8fa8..33da9af12 100644 --- a/docs/install.md +++ b/docs/install.md @@ -3,7 +3,7 @@ ### 环境 - 系统: CentOS 6.5 x86\_64 mini -- Python: 版本 2.7.13 (未来支持 3.5) +- Python: 版本 3.6 大部分功能兼容 2.7 - 安装目录 - /opt/jumpserver - /opt/coco @@ -17,31 +17,9 @@ $ 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安装 @@ -89,7 +67,7 @@ $ vim /usr/bin/yum **2.6 启动** ``` $ cd .. -$ python2.7 run_server.py +$ python run_server.py ``` 访问 http://ip:8080 账号密码: admin admin @@ -121,20 +99,20 @@ $ git clone https://github.com/jumpserver/coco.git **3.2 安装依赖** ``` $ 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 启动** ``` -$ python2.7 run_server.py +$ python run_server.py ``` 说明: Coco启动后会向jumpserver注册,请去 jumpserver页面 - 应用程序 - terminal - coco - Accept 允许, 这时 coco就 运行在 2222端口,可以ssh来连接 命令行: ```  -ssh admin@192.168.244.128 -p2222 +ssh admin@YourServerIP -p2222 ``` **3.5 测试** diff --git a/utils/export_fake_data.sh b/utils/export_fake_data.sh index be610a9f1..cd4b462d5 100644 --- a/utils/export_fake_data.sh +++ b/utils/export_fake_data.sh @@ -1,17 +1,17 @@ #!/bin/bash # -python2.7 ../apps/manage.py shell << EOF +python ../apps/manage.py shell << EOF from users.models.utils import * generate_fake() from assets.models.utils import * generate_fake() EOF -python2.7 ../apps/manage.py dbshell << EOF +python ../apps/manage.py dbshell << EOF delete from django_content_type; delete from auth_permission; EOF -python2.7 ../apps/manage.py dumpdata > ../apps/fixtures/fake.json +python ../apps/manage.py dumpdata > ../apps/fixtures/fake.json diff --git a/utils/export_init_data.sh b/utils/export_init_data.sh index 5786fa554..90121868c 100644 --- a/utils/export_init_data.sh +++ b/utils/export_init_data.sh @@ -1,7 +1,7 @@ #!/bin/bash # -python2.7 ../apps/manage.py shell << EOF +python ../apps/manage.py shell << EOF from users.models import * init_model() @@ -13,9 +13,9 @@ LoginLog.objects.all().delete() EOF -python2.7 ../apps/manage.py dbshell << EOF +python ../apps/manage.py dbshell << EOF delete from django_content_type; delete from auth_permission; EOF -python2.7 ../apps/manage.py dumpdata > ../apps/fixtures/init.json +python ../apps/manage.py dumpdata > ../apps/fixtures/init.json diff --git a/utils/init_db.sh b/utils/init_db.sh index a036b53b3..4073ad001 100755 --- a/utils/init_db.sh +++ b/utils/init_db.sh @@ -1,4 +1,4 @@ #!/bin/bash # -python2.7 ../apps/manage.py loaddata init +python ../apps/manage.py loaddata init diff --git a/utils/load_fake_data.sh b/utils/load_fake_data.sh index 82f66efda..c5577798e 100644 --- a/utils/load_fake_data.sh +++ b/utils/load_fake_data.sh @@ -1,4 +1,4 @@ #!/bin/bash # -python2.7 ../apps/manage.py loaddata fake +python ../apps/manage.py loaddata fake diff --git a/utils/make_migrations.sh b/utils/make_migrations.sh index 3da8a20b1..0704b9cc9 100755 --- a/utils/make_migrations.sh +++ b/utils/make_migrations.sh @@ -1,6 +1,6 @@ #!/bin/bash # -python2.7 ../apps/manage.py makemigrations +python ../apps/manage.py makemigrations -python2.7 ../apps/manage.py migrate +python ../apps/manage.py migrate