jumpserver v0.4.0 基于 CenOS7 的安装详解
標(biāo)簽(linux): jumpserver
筆者Q:972581034 交流群:605799367。有任何疑問(wèn)可與筆者或加群交流
首首先使用Jumpserver前要理解清楚這三個(gè)用戶(hù)關(guān)系:
1.用戶(hù):
是指你在web上創(chuàng)建的用戶(hù),會(huì)在跳板機(jī)上創(chuàng)建這個(gè)用戶(hù),作用就是用于登錄跳板機(jī)
2.管理用戶(hù):
是指客戶(hù)端上的如root等高權(quán)限賬號(hào)(或普通用戶(hù)擁有NOPASSWD: ALL sudo權(quán)限), 作用用于推送系統(tǒng)用戶(hù)
3.系統(tǒng)用戶(hù):
是指要在客戶(hù)端上創(chuàng)建這個(gè)系統(tǒng)用戶(hù),通過(guò)推送來(lái)實(shí)現(xiàn),作用就是登錄客戶(hù)端
4.管理用戶(hù)和系統(tǒng)用戶(hù)的關(guān)系:
兩者都是客戶(hù)端上的用戶(hù),后者涉及到一個(gè)推送動(dòng)作,
比如推送test系統(tǒng)用戶(hù),也就是在客戶(hù)端上創(chuàng)建test用戶(hù),那么創(chuàng)建用戶(hù)需要有權(quán)限,有沒(méi)有權(quán)限創(chuàng)建就要看你是用客戶(hù)端的root用戶(hù)還是普通用戶(hù)做為管理用戶(hù),如果后者做為管理用戶(hù)就需要添加sudo權(quán)限又是NOPASSWD: ALL,這樣推送系統(tǒng)用戶(hù),就可以成功在客戶(hù)端上創(chuàng)建test用戶(hù)環(huán)境
[root@jumpserver ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core)一. 準(zhǔn)備Python3和Python虛擬環(huán)境
1.1 安裝依賴(lài)包
yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel1.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 install1.3 建立python虛擬環(huán)境
因?yàn)镃entOS 6/7自帶的是Python2,而Yum等工具依賴(lài)原來(lái)的Python,為了不擾亂原來(lái)的環(huán)境我們來(lái)使用Python虛擬環(huán)境
cd /opt python3 -m venv py3 source /opt/py3/bin/activate看到下面的提示符代表成功,以后運(yùn)行jumpserver都要先運(yùn)行以上source命令,以下所有命令均在該虛擬環(huán)境中運(yùn)行
(py3) [root@localhost py3]#二. 安裝Jumpserver 0.4.0
2.1 下載或clone項(xiàng)目
項(xiàng)目提交較多git clone時(shí)較大,你可以選擇去github項(xiàng)目頁(yè)面直接下載 zip包,我的網(wǎng)速好,我直接clone了
cd /opt/git clone https://github.com/jumpserver/jumpserver.git2.2 安裝依賴(lài)rpm包
cd /opt/cd jumpserver/requirementsyum -y install epel-releaseyum -y install $(cat rpm_requirements.txt) # 如果沒(méi)有任何報(bào)錯(cuò)請(qǐng)繼續(xù)2.3 安裝python庫(kù)依賴(lài)
pip install -r requirements.txt # 如果沒(méi)有任何報(bào)錯(cuò)請(qǐng)繼續(xù)2.4 安裝Redis, jumpserver使用celery依賴(lài)
yum -y install redissystemctl start redis2.5 安裝MySQL
本文使用mysql作為數(shù)據(jù)庫(kù),如果不使用mysql可以跳過(guò)相關(guān)mysql安裝和配置
yum -y install mariadb mariadb-devel mariadb-server # centos7下安裝的是mariadb,阿里云默認(rèn)源的/etc/my.cnf可能導(dǎo)致不能啟動(dòng)systemctl start mariadb service mariadb start2.6 創(chuàng)建數(shù)據(jù)庫(kù) jumpserver并授權(quán)
mysql> create database jumpserver default charset 'utf8'; mysql> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'somepassword';2.7 安裝 python3 mysql驅(qū)動(dòng): mysqlclient
#由于MySQLdb庫(kù)不支持 python3.5+,所以選擇了mysqlclient作為驅(qū)動(dòng),pymysql使用python寫(xiě)的,速度較慢pip install mysqlclient2.8 修改jumpserver配置文件
cd /opt/jumpservercp config_example.py config.pyvi config.py # 我們計(jì)劃修改 DevelopmentConfig中的配置,因?yàn)槟J(rèn)jumpserver是使用該配置,它繼承自Config class DevelopmentConfig(Config):DEBUG = TrueDISPLAY_PER_PAGE = 20DB_ENGINE = 'mysql'DB_HOST = '127.0.0.1'DB_PORT = 3306DB_USER = 'jumpserver'DB_PASSWORD = 'somepassword'DB_NAME = 'jumpserver'EMAIL_HOST = 'smtp.exmail.qq.com'EMAIL_PORT = 465EMAIL_HOST_USER = 'a@jumpserver.org'EMAIL_HOST_PASSWORD = 'somepasswrd'EMAIL_USE_SSL = TrueEMAIL_USE_TLS = FalseEMAIL_SUBJECT_PREFIX = '[Jumpserver] 'SITE_URL = 'http://192.168.244.144:8080'2.9 生成數(shù)據(jù)庫(kù)表結(jié)構(gòu)和初始化數(shù)據(jù)
cd /opt/jumpserver/utilsbash make_migrations.shbash init_db.sh2.10 運(yùn)行Jumpserver
source /opt/py3/bin/activate cd /opt/jumpserver python run_server.py運(yùn)行不報(bào)錯(cuò),請(qǐng)瀏覽器訪問(wèn) http://192.168.244.144:8080/ 賬號(hào): admin 密碼: admin
三. 安裝 SSH Server: Coco
3.1 下載clone項(xiàng)目
新開(kāi)一個(gè)終端,連接測(cè)試機(jī),別忘了 source /opt/py3/bin/activate
source /opt/py3/bin/activatecd /optgit clone https://github.com/jumpserver/coco.git3.2 安裝依賴(lài)
cd /opt/coco/requirementsyum -y install $(cat rpm_requirements.txt)pip install -r requirements.txt3.3 查看配置文件并運(yùn)行
cd /opt/cococat config.pypython run_server.pyERROR: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這時(shí)需要去 jumpserver管理后臺(tái)-應(yīng)用程序-終端(http://192.168.244.144:8080/applications/terminal/)接受coco的注冊(cè)
Coco version 0.4.0, more see https://www.jumpserver.org Starting ssh server at 0.0.0.0:2222 Quit the server with CONTROL-C.這時(shí)完成安裝
3.4 測(cè)試連接
ssh -p2222 admin@192.168.244.144密碼: admin
如果是用Xshell登錄語(yǔ)法如下
密碼: admin
如果能登陸代表部署成功
四. 安裝 Web Terminal: Luna
新開(kāi)一個(gè)終端,連接測(cè)試機(jī),別忘了 source /opt/py3/bin/activate
4.1 下載clone項(xiàng)目
source /opt/py3/bin/activatecd /optgit clone https://github.com/jumpserver/luna.git4.2 安裝依賴(lài)
cd /opt/luna/requirementsyum -y install $(cat rpm_requirements.txt)pip install -r requirements.txt4.3 查看配置文件并運(yùn)行
cd /opt/lunacat config.pypython run_server.pyERROR:root:Load access key failed Using access key 5bfdbf63-bef5-4cfb-9e31-2d873bdddb03:*** WARNING:luna.service:App auth failed, Access key error or need admin active it4.4 同樣去jumpserver管理后臺(tái)接受luna注冊(cè)
應(yīng)用程序-終端 接受
Luna version 0.4.0, more see https://www.jumpserver.org Starting web server at 0.0.0.0:5000 Quit the server with CONTROL-C.4.5 測(cè)試
訪問(wèn) http://192.168.244.144:5000
總結(jié)
以上是生活随笔為你收集整理的jumpserver v0.4.0 基于 CenOS7 的安装详解的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 有趣的php实例,8个必备的PHP功能实
- 下一篇: keepalived与lvs结合使用配置