Updated 基于 CentOS 7 一步一步安装 Jumpserver 0.4.0 (markdown)

master
老广 2017-07-15 12:13:00 +08:00
parent 1b907636c4
commit c71d5e8dbe
1 changed files with 48 additions and 23 deletions

@ -6,20 +6,22 @@
- IP: 192.168.244.144 - IP: 192.168.244.144
### 一. 准备Python3和Python虚拟环境 ### 一. 准备Python3和Python虚拟环境
1.1 安装依赖包 **1.1 安装依赖包**
``` ```
$ yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel $ yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel
``` ```
1.2 编译安装 **1.2 编译安装**
``` ```
$ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz $ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
$ tar xvf Python-3.6.1.tar.xz && cd Python-3.6.1 $ tar xvf Python-3.6.1.tar.xz && cd Python-3.6.1
$ ./configure && make && make install $ ./configure && make && make install
``` ```
1.3 建立python虚拟环境 **1.3 建立python虚拟环境**
因为CentOS 6/7自带的是Python2而Yum等工具依赖原来的Python为了不扰乱原来的环境我们来使用Python虚拟环境 因为CentOS 6/7自带的是Python2而Yum等工具依赖原来的Python为了不扰乱原来的环境我们来使用Python虚拟环境
``` ```
@ -33,7 +35,8 @@ $ source /opt/py3/bin/activate
### 二. 安装Jumpserver 0.4.0 ### 二. 安装Jumpserver 0.4.0
2.1 下载或clone项目 **2.1 下载或clone项目**
项目提交较多git clone时较大你可以选择去github项目页面直接下载 zip包我的网速好我直接clone了 项目提交较多git clone时较大你可以选择去github项目页面直接下载 zip包我的网速好我直接clone了
``` ```
@ -41,7 +44,8 @@ $ cd /opt/
$ git clone https://github.com/jumpserver/jumpserver.git $ git clone https://github.com/jumpserver/jumpserver.git
``` ```
2.2 安装依赖rpm包 **2.2 安装依赖rpm包**
``` ```
$ cd /opt/ $ cd /opt/
$ cd jumpserver/requirements $ cd jumpserver/requirements
@ -49,18 +53,21 @@ $ yum -y install epel-release
$ yum -y install $(cat rpm_requirements.txt) # 如果没有任何报错请继续 $ yum -y install $(cat rpm_requirements.txt) # 如果没有任何报错请继续
``` ```
2.3 安装python库依赖 **2.3 安装python库依赖**
``` ```
$ pip install -r requirements.txt # 如果没有任何报错请继续 $ pip install -r requirements.txt # 如果没有任何报错请继续
``` ```
2.4 安装Redis, jumpserver使用celery依赖 **2.4 安装Redis, jumpserver使用celery依赖**
``` ```
$ yum -y install redis $ yum -y install redis
$ service redis start $ service redis start
``` ```
2.5 安装MySQL **2.5 安装MySQL**
本教程使用mysql作为数据库如果不使用mysql可以跳过相关mysql安装和配置 本教程使用mysql作为数据库如果不使用mysql可以跳过相关mysql安装和配置
``` ```
@ -73,21 +80,23 @@ $ yum -y install mysql mysql-devel mysql-server
$ service mysql start $ service mysql start
``` ```
2.6 创建数据库 jumpserver并授权 **2.6 创建数据库 jumpserver并授权**
``` ```
$ mysql $ mysql
> create database jumpserver default charset 'utf8'; > create database jumpserver default charset 'utf8';
> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'somepassword'; > grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'somepassword';
``` ```
2.7 安装 python3 mysql驱动: mysqlclient **2.7 安装 python3 mysql驱动: mysqlclient**
由于MySQLdb库不支持 python3.5+所以选择了mysqlclient作为驱动,pymysql使用python写的速度较慢 由于MySQLdb库不支持 python3.5+所以选择了mysqlclient作为驱动,pymysql使用python写的速度较慢
``` ```
$ pip install mysqlclient $ pip install mysqlclient
``` ```
2.8 修改jumpserver配置文件 **2.8 修改jumpserver配置文件**
``` ```
$ cd /opt/jumpserver $ cd /opt/jumpserver
@ -116,14 +125,16 @@ class DevelopmentConfig(Config):
``` ```
2.9 生成数据库表结构和初始化数据 **2.9 生成数据库表结构和初始化数据**
``` ```
$ cd /opt/jumpserver/utils $ cd /opt/jumpserver/utils
$ bash make_migrations.sh $ bash make_migrations.sh
$ bash init_db.sh $ bash init_db.sh
``` ```
2.10 运行Jumpserver **2.10 运行Jumpserver**
``` ```
$ cd /opt/jumpserver $ cd /opt/jumpserver
$ python run_server.py $ python run_server.py
@ -135,21 +146,25 @@ $ python run_server.py
### 三. 安装 SSH Server: Coco ### 三. 安装 SSH Server: Coco
3.1 下载clone项目 **3.1 下载clone项目**
新开一个终端,连接测试机
新开一个终端,连接测试机,别忘了 source /opt/py3/bin/activate
``` ```
$ cd /opt $ cd /opt
$ git clone https://github.com/jumpserver/coco.git $ git clone https://github.com/jumpserver/coco.git
``` ```
3.2 安装依赖 **3.2 安装依赖**
``` ```
$ cd /opt/coco/requirements $ cd /opt/coco/requirements
$ yum -y install $(cat rpm_requirements.txt) $ yum -y install $(cat rpm_requirements.txt)
$ pip install -r requirements.txt $ pip install -r requirements.txt
``` ```
3.3 查看配置文件并运行 **3.3 查看配置文件并运行**
``` ```
$ cd /opt/coco $ cd /opt/coco
$ cat config.py $ cat config.py
@ -161,14 +176,16 @@ WARNING:/opt/coco/coco/service.py:App auth failed, Access key error or need admi
``` ```
这时需要去 jumpserver管理后台-应用程序-终端(http://192.168.244.144:8080/applications/terminal/)接受coco的注册 这时需要去 jumpserver管理后台-应用程序-终端(http://192.168.244.144:8080/applications/terminal/)接受coco的注册
``` ```
Coco version 0.4.0, more see https://www.jumpserver.org Coco version 0.4.0, more see https://www.jumpserver.org
Starting ssh server at 0.0.0.0:2222 Starting ssh server at 0.0.0.0:2222
Quit the server with CONTROL-C. Quit the server with CONTROL-C.
``` ```
这时完成安装 这时完成安装
3.4 测试连接 **3.4 测试连接**
``` ```
$ ssh -p2222 admin@192.168.244.144 $ ssh -p2222 admin@192.168.244.144
密码: admin 密码: admin
@ -177,21 +194,26 @@ $ ssh -p2222 admin@192.168.244.144
### 四. 安装 Web Terminal: Luna ### 四. 安装 Web Terminal: Luna
新开一个终端,连接测试机,别忘了 source /opt/py3/bin/activate 新开一个终端,连接测试机,别忘了 source /opt/py3/bin/activate
4.1 下载clone项目
**4.1 下载clone项目**
``` ```
$ cd /opt $ cd /opt
$ git clone https://github.com/jumpserver/luna.git $ git clone https://github.com/jumpserver/luna.git
``` ```
4.2 安装依赖 **4.2 安装依赖**
``` ```
$ cd /opt/luna/requirements $ cd /opt/luna/requirements
$ yum -y install $(cat rpm_requirements.txt) $ yum -y install $(cat rpm_requirements.txt)
$ pip install -r requirements.txt $ pip install -r requirements.txt
``` ```
4.3 查看配置文件并运行 **4.3 查看配置文件并运行**
``` ```
$ cd /opt/luna $ cd /opt/luna
$ cat config.py $ cat config.py
@ -202,15 +224,18 @@ Using access key 5bfdbf63-bef5-4cfb-9e31-2d873bdddb03:***
WARNING:luna.service:App auth failed, Access key error or need admin active it WARNING:luna.service:App auth failed, Access key error or need admin active it
``` ```
4.4 同样去jumpserver管理后台接受luna注册 **4.4 同样去jumpserver管理后台接受luna注册**
应用程序-终端 接受 应用程序-终端 接受
``` ```
Luna version 0.4.0, more see https://www.jumpserver.org Luna version 0.4.0, more see https://www.jumpserver.org
Starting web server at 0.0.0.0:5000 Starting web server at 0.0.0.0:5000
Quit the server with CONTROL-C. Quit the server with CONTROL-C.
``` ```
4.5 测试 **4.5 测试**
访问 http://192.168.244.144:5000 访问 http://192.168.244.144:5000