官方文档 jumpserver.org/zh/latest/step_by_step.html
1、coco是ssh terminal方式(登陆地址: ssh://10.111.232.96:2222),luna是web terminal方式( http://10.111.232.96:5000)。注册好后,就不会出现上面安装过程中的"WARNING"的提示了!
2、启动服务器,在后台运行,加 &
3、用户是指给运维和开发人员创建的远程ssh方式登陆堡垒机的账号,这个不需要真实存在服务器上。有多少人员需要登陆堡垒机就创建多少个这样的账号。比如 ssh -p2222 wangshibo@10.111.232.96
4、管理用户是指客户端上的如root等高权限账号(或普通用户拥有NOPASSWD: ALL sudo权限), 作用用于推送系统用户。也就是说这个管理用户最好使用root,如果是非root账号,那么它必须拥有NOPASSWD: ALL sudo权限
5、系统用户是真实存在于服务器上的。就是说远程ssh登陆堡垒机后,会选择进入哪个系统用户下。创建一个系统用户,如果管理列表里的机器中没有,会自动创建。
一、准备python3.6环境
1.1 安装依赖包
$ yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release
1.2 编译安装
$ 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
$ ./configure && make && make install
1.3 将原来 python 的软链接重命名:
$ mv /usr/bin/python /usr/bin/python.bak
1.4 将 python 链接至 python3:
$ ln -s /usr/local/bin/python3 /usr/bin/python
1.5 升级 Python 之后,由于将默认的 python 指向了 python3,yum 不能正常使用,需要修改yum 的配置文件:
$ vim /usr/bin/yum
$ vim /usr/libexec/urlgrabber-ext-down
将 #!/usr/bin/python 改为 #!/usr/bin/python2.7,保存退出即可。
二. 安装 Jumpserver 0.5.0
2.1 下载
$ cd /opt/
$ git clone --depth=1 https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master
2.2 安装依赖 RPM 包
$ cd /opt/jumpserver/requirements
$ yum -y install $(cat rpm_requirements.txt)
2.3 安装 Python 库依赖
$ pip install -r requirements.txt #
2.4 安装 Redis, Jumpserver 使用 Redis 做 cache 和 celery broke
$ yum -y install redis
$ service redis start
2.5 创建Jumpserver数据库并授权
$ mysql
> create database jumpserver default charset 'utf8';
> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'jumpserver';
2.6 修改 Jumpserver 配置文件
$ cd /opt/jumpserver
$ cp config_example.py config.py
$ vi config.py
在class DevelopmentConfig(Config):行下添加如下内容:
DEBUG = True
DB_ENGINE = 'mysql'
DB_HOST = '127.0.0.1'
DB_PORT = 3306
DB_USER = 'jumpserver'
DB_PASSWORD = 'jumpserver'
DB_NAME = 'jumpserver'
2.7 导入数据库表结构和初始化数据
$ cd /opt/jumpserver/utils
$ bash make_migrations.sh
2.8 运行 Jumpserver
$ cd /opt/jumpserver
$ python run_server.py all
2.9 开机自动运行脚本
#!/bin/bash
#chkconfig:35 80 80
#description:auto_jumpserver
python /opt/jumpserver/run_server.py all
浏览器访问 http://172.16.2.116:8080/
账号: admin 密码: admin,
2.9 添加用户、资产,配置权限等,略。
如图所示
三. 安装 SSH Server 和 WebSocket Server: Coco
3.1 新开一个终端,Clone 项目
$ cd /opt
$ git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master
3.2 安装依赖
$ cd /opt/coco/requirements
$ yum -y install $(cat rpm_requirements.txt)
$ pip install -r requirements.txt
3.3 运行配置文件
$ cd /opt/coco
$ cp conf_example.py conf.py
$ python run_server.py
这时需要在管理后台-会话管理-终端管理中,接受 Coco 的注册
3.4 开机启动脚本
#!/bin/bash
#chkconfig:35 85 85
#description:auto_coco
python /opt/coco/run_server.py
3.4 连接
$ ssh -p2222 hanli@172.16.2.116
输入自己当时重置的密码:
如图所示