基于CentOS7安裝jumpserver0.4.0

環境

  • 系統:Centos7.2

  • ubuntu server。IP地址:192.168.198.128? ?

一:準備安裝Python3和Python虛擬環境

1.1????安裝依賴包

yum?-y?install?wget?sqlite-devel?xz?gcc?git?automake?zlib-devel?openssl-devel

1.2????編譯安裝

wget?-P?/usr/local/src?
cd?/usr/local/src
tar?-C?/usr/local?-xvf?Python-3.6.1.tar.xz?&&?cd?/usr/local/Python-3.6.1
./configure?&&?make?&&?make?install

安裝server2016,1.3????建立python虛擬環境

因為centos6/7自帶的python環境都是2,而yum等工具依賴原來的Python,為了不擾亂原來的環境我們使用Python虛擬環境

cd?/opt
python3?-m?venv?py3
source?/opt/py3/bin/activate
#?看到下面的提示符代表成功,以后運行jumpserver都要先運行以上source命令,以下所有命令均在該虛擬環境中運行
(py3)?[root@localhost?py3]#

二:安裝jumpserver0.4.0

2.1????下載或clone項目

centos7.8安裝教程。項目提交較多git clone時較大,你可以選擇去github項目頁面直接下載 zip包,我的網速好,我直接clone了

cd?/opt/
git?clone?https://github.com/jumpserver/jumpserver.git

2.2 安裝依賴rpm包

cd?/opt/
cd?jumpserver/requirements
yum?-y?install?epel-release
yum?-y?install?$(cat?rpm_requirements.txt)??
#?如果沒有任何報錯請繼續

2.3 安裝python庫依賴

pip?install?-r?requirements.txt?
#?如果沒有任何報錯請繼續

2.4 安裝Redis,jumpserver使用celery依賴

yum?-y?install?redis
service?redis?start

centos7.4安裝。2.5 安裝mysql

本教程使用mysql作為數據庫,如果不使用mysql可以跳過相關mysql安裝和配置

#?centos7
yum?-y?install?mariadb?mariadb-devel?mariadb-server?#?centos7下安裝的是mariadb
service?mariadb?start

#?centos6
yum?-y?install?mysql?mysql-devel?mysql-server
service?mysql?start

2.6 創建jump server數據庫并授權

#?mysql
>?create?database?jumpserver?default?charset?'utf8';
>?grant?all?on?jumpserver.*?to?'jumpserver'@'127.0.0.1'?identified?by?'somepassword';

2.7 安裝 python3 mysql驅動: mysqlclient

由于MySQLdb庫不支持 python3.5+,所以選擇了mysqlclient作為驅動,pymysql使用python寫的,速度較慢

pip?install?mysqlclient

2.8 修改jumpserver配置文件

$?cd?/opt/jumpserver
$?cp?config_example.py?config.py
$?vi?config.py??
#?我們計劃修改?DevelopmentConfig中的配置,因為默認jumpserver是使用該配置,它繼承自Config
class?DevelopmentConfig(Config):
????DEBUG?=?True
????DISPLAY_PER_PAGE?=?20
????DB_ENGINE?=?'mysql'
????DB_HOST?=?'127.0.0.1'
????DB_PORT?=?3306
????DB_USER?=?'jumpserver'
????DB_PASSWORD?=?'somepassword'
????DB_NAME?=?'jumpserver'
????EMAIL_HOST?=?'smtp.exmail.qq.com'
????EMAIL_PORT?=?465
????EMAIL_HOST_USER?=?'a@jumpserver.org'
????EMAIL_HOST_PASSWORD?=?'somepasswrd'
????EMAIL_USE_SSL?=?True
????EMAIL_USE_TLS?=?False
????EMAIL_SUBJECT_PREFIX?=?'[Jumpserver]?'
????SITE_URL?=?'http://192.168.198.128:8080'

centos7.5?2.9 生成數據庫表結構和初始化數據

$?cd?/opt/jumpserver/utils
$?bash?make_migrations.sh
$?bash?init_db.sh

3.0 運行jumpserver

$?cd?/opt/jumpserver
$?python?run_server.py

運行不報錯,請瀏覽器訪問?http://192.168.198.128:8080/?賬號: admin 密碼: admin

三. 安裝 SSH Server: Coco

centos7.3、

3.1 下載clone項目

新開一個終端,連接測試機,別忘了 source /opt/py3/bin/activate

$ cd /opt
$ git clone https://github.com/jumpserver/coco.git

3.2 安裝依賴

$ cd /opt/coco/requirements
$ yum -y ?install $(cat rpm_requirements.txt)
$ pip install -r requirements.txt

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的注冊

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.

跳板機jumpserver、這時完成安裝

3.4 測試連接

$ ssh -p2222 admin@192.168.244.144
密碼: admin
如果是用Xshell登錄語法如下
$ssh admin@192.168.244.144 2222
密碼: admin
如果能登陸代表部署成功

四:安裝Web Terminal:Luna

新開一個終端,連接測試機,別忘了 source /opt/py3/bin/activate

4.1 下載clone項目

$ cd /opt
$ git clone https://github.com/jumpserver/luna.git

4.2 安裝依賴

$ cd /opt/luna/requirements
$ yum -y install $(cat rpm_requirements.txt)
$ pip install -r requirements.txt

類似jumpserver、4.3 查看配置文件并運行

$ cd /opt/luna
$ cat config.py
$ python run_server.py

ERROR: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 it

4.4 同樣去jumpserver管理后臺接受luna注冊

應用程序-終端 接受

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 測試

訪問?http://192.168.198.128:5000