基于CentOS7安装jumpserver0.4.0
环境
-
系统:Centos7.2
-
IP地址:192.168.198.128
一:准备安装Python3和Python虚拟环境
1.1 安装依赖包
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >yum -y install wget sqlite-devel xz gcc git automake zlib-devel openssl-devel<br>< /span >
|
1.2 编译安装
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >wget -P /usr/local/src <br> cd /usr/local/src <br> tar -C /usr/local -xvf Python-3.6.1. tar .xz && cd /usr/local/Python-3 .6.1<br>. /configure && make && make install <br>< /span >
|
1.3 建立python虚拟环境
因为centos6/7自带的python环境都是2,而yum等工具依赖原来的Python,为了不扰乱原来的环境我们使用Python虚拟环境
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" > cd /opt <br>python3 -m venv py3<br> source /opt/py3/bin/activate <br> # 看到下面的提示符代表成功,以后运行jumpserver都要先运行以上source命令,以下所有命令均在该虚拟环境中运行<br>(py3) [root@localhost py3]#<br></span>
|
二:安装jumpserver0.4.0
2.1 下载或clone项目
项目提交较多git clone时较大,你可以选择去github项目页面直接下载 zip包,我的网速好,我直接clone了
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" > cd /opt/ <br>git clone https: //github .com /jumpserver/jumpserver .git<br>< /span >
|
2.2 安装依赖rpm包
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" > cd /opt/ <br> cd jumpserver /requirements <br>yum -y install epel-release<br>yum -y install $( cat rpm_requirements.txt) <br> # 如果没有任何报错请继续<br></span>
|
2.3 安装python库依赖
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >pip install -r requirements.txt <br> # 如果没有任何报错请继续<br></span>
|
2.4 安装Redis,jumpserver使用celery依赖
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >yum -y install redis<br>service redis start<br>< /span >
|
2.5 安装mysql
本教程使用mysql作为数据库,如果不使用mysql可以跳过相关mysql安装和配置
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" > # centos7<br>yum -y install mariadb mariadb-devel mariadb-server # centos7下安装的是mariadb<br>service mariadb start<br><br># centos6<br>yum -y install mysql mysql-devel mysql-server<br>service mysql start<br></span>
|
2.6 创建jump server数据库并授权
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" > # mysql<br>> create database jumpserver default charset 'utf8';<br>> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'somepassword';<br></span>
|
2.7 安装 python3 mysql驱动: mysqlclient
由于MySQLdb库不支持 python3.5+,所以选择了mysqlclient作为驱动,pymysql使用python写的,速度较慢
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >pip install mysqlclient<br>< /span >
|
2.8 修改jumpserver配置文件
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >$ cd /opt/jumpserver <br>$ cp config_example.py config.py<br>$ vi config.py <br> # 我们计划修改 DevelopmentConfig中的配置,因为默认jumpserver是使用该配置,它继承自Config<br></span>
|
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >class DevelopmentConfig(Config):<br> DEBUG = True<br> DISPLAY_PER_PAGE = 20<br> DB_ENGINE = 'mysql' <br> DB_HOST = '127.0.0.1' <br> DB_PORT = 3306<br> DB_USER = 'jumpserver' <br> DB_PASSWORD = 'somepassword' <br> DB_NAME = 'jumpserver' <br> EMAIL_HOST = 'smtp.exmail.qq.com' <br> EMAIL_PORT = 465<br> EMAIL_HOST_USER = 'a@jumpserver.org' <br> EMAIL_HOST_PASSWORD = 'somepasswrd' <br> EMAIL_USE_SSL = True<br> EMAIL_USE_TLS = False<br> EMAIL_SUBJECT_PREFIX = '[Jumpserver] ' <br> SITE_URL = 'http://192.168.198.128:8080' <br>< /span >
|
2.9 生成数据库表结构和初始化数据
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >$ cd /opt/jumpserver/utils <br>$ bash make_migrations.sh<br>$ bash init_db.sh<br>< /span >
|
3.0 运行jumpserver
$ cd /opt/jumpserver
$ python run_server.py
运行不报错,请浏览器访问 http://192.168.198.128:8080/ 账号: admin 密码: admin
三. 安装 SSH Server: Coco
3.1 下载clone项目
新开一个终端,连接测试机,别忘了 source /opt/py3/bin/activate
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >$ cd /opt <br>$ git clone https: //github .com /jumpserver/coco .git<br>< /span >
|
3.2 安装依赖
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >$ cd /opt/coco/requirements <br>$ yum -y install $( cat rpm_requirements.txt)<br>$ pip install -r requirements.txt<br>< /span >
|
3.3 查看配置文件并运行
$ cd /opt/coco
$ cat config.py
$ python run_server.py
ERROR:root:Load access key failed
Using access key 311d0e77-5ec9-4c46-a131-7409e1daf271:***
WARNING:/opt/coco/coco/service.py:App auth failed, Access key error or need admin active it
这时需要去 jumpserver管理后台-应用程序-终端(http://192.168.198.128:8080/applications/terminal/)接受coco的注册
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >Coco version 0.4.0, more see https: //www .jumpserver.org<br>Starting ssh server at 0.0.0.0:2222<br>Quit the server with CONTROL-C.<br>< /span >
|
这时完成安装
3.4 测试连接
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >$ ssh -p2222 admin@192.168.244.144<br>密码: admin<br>如果是用Xshell登录语法如下<br>$ ssh admin@192.168.244.144 2222<br>密码: admin<br>如果能登陆代表部署成功<br>< /span >
|
四:安装Web Terminal:Luna
新开一个终端,连接测试机,别忘了 source /opt/py3/bin/activate
4.1 下载clone项目
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >$ cd /opt <br>$ git clone https: //github .com /jumpserver/luna .git<br>< /span >
|
4.2 安装依赖
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >$ cd /opt/luna/requirements <br>$ yum -y install $( cat rpm_requirements.txt)<br>$ pip install -r requirements.txt<br>< /span >
|
4.3 查看配置文件并运行
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >$ cd /opt/luna <br>$ cat config.py<br>$ python run_server.py<br><br>ERROR:root:Load access key failed<br>Using access key 5bfdbf63-bef5-4cfb-9e31-2d873bdddb03:***<br>WARNING:luna.service:App auth failed, Access key error or need admin active it<br>< /span >
|
4.4 同样去jumpserver管理后台接受luna注册
应用程序-终端 接受
1
|
<span style= "font-family:'宋体', SimSun;font-size:14px;" >Luna version 0.4.0, more see https: //www .jumpserver.org<br>Starting web server at 0.0.0.0:5000<br>Quit the server with CONTROL-C.<br>< /span >
|
4.5 测试
访问 http://192.168.198.128:5000
本文转自 运维小学生 51CTO博客,原文链接:http://blog.51cto.com/yasar/1953671,如需转载请自行联系原作者