jumpserver0.4.0与python3版本安装

 

 

 环境:

    系统:CentOS 6.5

    Python版本:Python3.6

    安装目录:/Data/apps/

 

   一. 环境准备:

        1.  基本工具库:

1 # yum -y install sqlite-devel git epel-release
2 # yum -y install sshpass python-devel libffi-devel openssl-devel
3 # yum -y install gcc gcc-c++

       2. 安装python3及virtualenv虚拟环境:

           猛戳我哦!

   二. Jumpserver安装

       1. 下载仓库代码:

        GitHub: https://github.com/jumpserver/jumpserver   #我这里为GitHub直接下载代码包

1 # cd /Data/apps/
2 # git clone https://github.com/jumpserver/jumpserver.git
3 # cd jumpserver
4 # git checkout dev       #升级dev版本

      2. 安装jumpserver依赖包:

1 # cd requirements/
2 # ls
3 deb_requirements.txt  mac_requirements.txt  requirements.txt  rpm_requirements.txt
4 # yum -y install `cat rpm_requirements.txt`
5 # pip3 install -r requirements.txt -i https://pypi.doubanio.com/simple

     3. 安装数据库:

1 # 我这里使用公司已经封装好的yum源直接安装,如果没有可以使用以下命令:
2 # yum -y install mysql mysql-server mysql-devel
3 # chkconfig mysqld on
4 # chkconfig --list |grep mysql 
5 # service mysqld start 
6 
7 注意:
8       mysql具体安装及配置自行参考文档,这里不再赘述。

     4. 创建jumpserver数据库并授权

1 # cp mysql/bin/mysql.server /etc/init.d/mysqld
2 # cp mysql/bin/mysql /usr/bin/mysql
3 
4 # mysql -uroot -p
5 mysql> create database jumpserver default charset 'utf8';
6 mysql> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'abc123';
7 mysql> flush privileges;

     5. 安装python3的mysql驱动:

         由于MySQLdb不支持python3,而且pymysql据听说比较慢,因为是python写的,感兴趣的同学可以自行研究一下,这里使用mysqlclient.

1 # source ENV3/bin/activate
2 # pip3 install mysqlclient

     6. 修改配置文件:

 1 # cd /Data/apps/jumpserver
 2 # mv config_example.py config.py
 3 # vim config.py
 4  
 5 class DevelopmentConfig(Config):
 6     DEBUG = True
 7     DISPLAY_PER_PAGE = 20
 8     DB_ENGINE = 'mysql'
 9     DB_HOST = '127.0.0.1'
10     DB_PORT = 3306
11     DB_USER = 'jumpserver'
12     DB_PASSWORD = 'abc123'
13     DB_NAME = 'jumpserver'
14     EMAIL_HOST = 'smtp.exmail.qq.com'
15     EMAIL_PORT = 465
16     EMAIL_HOST_USER = 'zhaohongfei@haodf.com'
17     EMAIL_HOST_PASSWORD = 'Hf9952019'
18     EMAIL_USE_SSL = True
19     EMAIL_USE_TLS = False
20     EMAIL_SUBJECT_PREFIX = '[Jumpserver] '
21     SITE_URL = 'http://localhost:8080'

 

    7. 初始化数据库:

1 # cd /Data/apps/jumpserver/utils
2 # sh make_migrations.sh
3 # sh init_db.sh
4 
5 #注意:
6         这里生成时可能会报错,可以选择卸载mysqlclient重新安装
7 
8 # source /Data/apps/ENV3/bin/activate  #这里可以设置别名
9 # pip install mysqlclient

     可以看下数据库已经生成jumpserver库及对应表:

 1 # mysql -uroot -p
 2 mysql> show databases;
 3 +--------------------+
 4 | Database           |
 5 +--------------------+
 6 | information_schema |
 7 | jumpserver         |
 8 | mysql              |
 9 | performance_schema |
10 | test               |
11 +--------------------+
12 5 rows in set (0.00 sec)
13 
14 mysql> use jumpserver;
15 Database changed
16 mysql> show tables;
17 +--------------------------------+
18 | Tables_in_jumpserver           |
19 +--------------------------------+
20 | applications_terminal          |
21 | asset_permission               |
22 | asset_permission_asset_groups  |
23 | asset_permission_assets        |
24 | asset_permission_system_users  |
25 | asset_permission_user_groups   |
26 | asset_permission_users         |
27 | assets_adminuser               |
28 | assets_asset                   |
29 | assets_asset_groups            |
30 | assets_asset_system_users      |
31 | assets_assetgroup              |
32 | assets_assetgroup_system_users | 
33 。。。。。省略

    8.  安装redis服务

1 # yum -y install redis
2 # service redis start
3 
4 #监听6379端口

    9. 启动jumpserver

1 # cd /Data/apps/jumpserver
2 # python run_server.py
3 #默认用户为admin,密码admin

   10. 进入界面

 

 

大功告成。。。。。

 

 

相关链接:

           jumpserver官网: http://www.jumpserver.org/

           

 

posted @ 2017-11-01 18:40  浮光掠影转瞬间  阅读(985)  评论(0编辑  收藏  举报