diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 0000000000000000000000000000000000000000..75aa80a1558d5c20994ee5f9c91ce306e4331dd4 --- /dev/null +++ b/docs/install.md @@ -0,0 +1,129 @@ +## Jumpserver v0.4.0 版本安装详细过程 +### 环境 +- 系统: CentOS 6.5 x86\_64 mini_ - Python: 版本 2.7.13 (未来支持 3.5) +- 安装目录 + - /opt/jumpserver + - /opt/coco + +#### 一. 环境准备 +**1.1 安装基本工具和库** +``` +`$ yum -y install sqlite-devel git epel-release +``` +` +**1.2 安装Python** +这里可以参考 [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 +``` +` +#### 二. Jumpserver安装 +**2.1 下载仓库代码 ** + +``` +`$ cd /opt +$ git clone [https://github.com/jumpserver/jumpserver.git][2] +$ cd jumpserver +$ git checkout dev +``` +`**2.1 安装依赖** + +``` +`$ cd requirements +$ sudo yum -y install `cat rpm_requirements.txt` +$ pip2.7 install -r requirements.txt -i https://pypi.doubanio.com/simple +``` +`**2.3 准备配置文件 ** + +``` +`$ cd .. +$ cp config_example.py config.py +$ vim config.py + +// 默认使用的是 DevelpmentConfig 所以应该去修改这部分 +class DevelopmentConfig(Config): +EMAIL_HOST = 'smtp.exmail.qq.com' +EMAIL_PORT = 465 +EMAIL_HOST_USER = 'ask@jumpserver.org' +EMAIL_HOST_PASSWORD = 'xxx' +EMAIL_USE_SSL = True // 端口是 465 设置 True 否则 False +EMAIL_USE_TLS = False // 端口是 587 设置为 True 否则 False +SITE_URL = 'http://localhost:8080' // 发送邮件会使用这个地址 +``` +` +**2.4 初始化数据库** +``` +`$ cd utils +$ sh make_migrations.sh +$ sh init_db.sh +``` +` +**2.5 安装redis server** +``` +`$ yum -y install redis +$ service redis start +``` +` +**2.6 启动** +``` +`$ cd .. +$ python2.7 run_server.py +``` +`访问 http://ip:8080 +账号密码: admin admin + +**2.7 测试使用** +- 创建用户 + 会发送邮件,测试是否正常修改密码,登录 + +- 创建管理用户 + 创建一个管理用户, 创建资产时需要关联 + +- 创建资产 + 创建一个 资产,关联刚创建的管理用户 + +- 创建系统用户 + 系统用户是用来登录资产的,授权时需要 + +- 创建授权规则 + 关联用户,资产,系统用户 形成授权规则,授权的系统用户会自动推送到资产上 + + +#### 三. 安装 SSH SERVER - COCO +**3.1 下载代码库** +``` +`$ cd /opt +$[git clone https://github.com/jumpserver/coco.git][3] +``` +` +**3.2 安装依赖** +``` +`$ pip2.7 install -r requirements.txt -i https://pypi.doubanio.com/simple +``` +` +**3.3 启动** + +``` +`$ python2.7 run_server.py +``` +` +说明: Coco启动后会向jumpserver注册,请去 jumpserver页面 - 应用程序 - terminal - coco - Accept 允许, 这时 coco就 运行在 2222端口,可以ssh来连接 + +命令行: +```  +`ssh admin@192.168.244.128 -p2222 +``` +` +**3.5 测试** +- 测试登录 ssh server +- 测试跳转 +- 测试命令记录回 + +[1]: https://segmentfault.com/a/1190000000654227 +[2]: https://github.com/jumpserver/jumpserver.git +[3]: https://github.com/jumpserver/coco.git \ No newline at end of file diff --git a/requirements/requirements.txt b/requirements/requirements.txt index bc82d5b0b5d6c59db0fce4e0c02badc1343c035e..64dfed303d967f207db1dba433ad2a8fdc639f3c 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -20,3 +20,4 @@ tornado==4.4.2 eventlet==0.20.1 django-filter==1.0.0 passlib==1.7.1 +sshpass diff --git a/utils/export_fake_data.sh b/utils/export_fake_data.sh index cd4b462d58ab3fe200754a185cc15b02e243f0bd..be610a9f1e049f702fcf169af350e2922cff79b1 100644 --- a/utils/export_fake_data.sh +++ b/utils/export_fake_data.sh @@ -1,17 +1,17 @@ #!/bin/bash # -python ../apps/manage.py shell << EOF +python2.7 ../apps/manage.py shell << EOF from users.models.utils import * generate_fake() from assets.models.utils import * generate_fake() EOF -python ../apps/manage.py dbshell << EOF +python2.7 ../apps/manage.py dbshell << EOF delete from django_content_type; delete from auth_permission; EOF -python ../apps/manage.py dumpdata > ../apps/fixtures/fake.json +python2.7 ../apps/manage.py dumpdata > ../apps/fixtures/fake.json diff --git a/utils/export_init_data.sh b/utils/export_init_data.sh index 0f3fb659faec3236896a876c8120eca29e9dd3de..4a9c90e6e54b4abb22bdb7cb643139ac4eac844b 100644 --- a/utils/export_init_data.sh +++ b/utils/export_init_data.sh @@ -1,7 +1,7 @@ #!/bin/bash # -python ../apps/manage.py shell << EOF +python2.7 ../apps/manage.py shell << EOF from users.models import * init_all_models() @@ -10,9 +10,9 @@ init_all_models() EOF -python ../apps/manage.py dbshell << EOF +python2.7 ../apps/manage.py dbshell << EOF delete from django_content_type; delete from auth_permission; EOF -python ../apps/manage.py dumpdata > ../apps/fixtures/init.json +python2.7 ../apps/manage.py dumpdata > ../apps/fixtures/init.json diff --git a/utils/init_db.sh b/utils/init_db.sh index 4073ad00175cf05c719dd1edeb1f8fa104214075..a036b53b30c987ba9dea3d2267107298a82f8a53 100755 --- a/utils/init_db.sh +++ b/utils/init_db.sh @@ -1,4 +1,4 @@ #!/bin/bash # -python ../apps/manage.py loaddata init +python2.7 ../apps/manage.py loaddata init diff --git a/utils/load_fake_data.sh b/utils/load_fake_data.sh index c5577798e1ba91ef1b5e30df0db41eb98e0cdcfc..82f66efdaef52375cef552054612b5a5791a505c 100644 --- a/utils/load_fake_data.sh +++ b/utils/load_fake_data.sh @@ -1,4 +1,4 @@ #!/bin/bash # -python ../apps/manage.py loaddata fake +python2.7 ../apps/manage.py loaddata fake