系統:
CentOS6python
Python版本:
Python: 3.6 mysql
安裝目錄:
/opt/jumpserver
/opt/cococ++
1.1 安裝基本工具和庫git
yum -y install sqlite-devel git epel-release
yum -y install sshpass python-devel libffi-devel openssl-devel
yum -y install gcc gcc-c++github
1.2 安裝Python 3.6 和 Djangoweb
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
tar -xf Python-3.6.1.tgz && cd Python-3.6.1
./configure && make && make installredis
1.3 創建python虛擬環境sql
由於CentOS 6/7自帶的是Python2,而Yum等工具依賴原來的Python,爲了避免擾亂原來的環境咱們來使用Python虛擬環境shell
cd /opt
python3 -m venv py3
source /opt/py3/bin/activate數據庫
(py3) [root@localhost py3]#
1.4安裝Django==1.10.5
安裝完成 python3.6後應該是自動安裝了pip9.0.1
因此直接安裝django
pip install django==1.10.5
而後作軟鏈接
ln -s /usr/local/bin/django-admin.py /usr/bin/django-admin
2.1 下載或clone項目
項目提交較多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
2.5 安裝MySQL
注意:若是數據庫已經存在,就不用在安裝了。
#yum -y install mysql mysql-devel mysql-server
#service mysql start
2.6 建立數據庫 jumpserver並受權
mysql
create database jumpserver default charset 'utf8'; grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'somepassword'; flush privileges;
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
vim config.py
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.244.144:8080'
2.9 生成數據庫表結構和初始化數據
cd /opt/jumpserver/utils
bash make_migrations.sh
bash init_db.sh
2.10 運行Jumpserver
cd /opt/jumpserver
python run_server.py
運行不報錯,請瀏覽器訪問 http://192.168.244.144:8080/ 帳號: admin 密碼: admin
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.244.144: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.
這時完成安裝
3.4 測試鏈接
ssh -p2222 admin@192.168.244.144
密碼: admin
若是是用Xshell登陸語法以下
$ssh admin@192.168.244.144 2222
密碼: admin
若是能登錄表明部署成功
新開一個終端,鏈接測試機,別忘了 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
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.244.144:5000
基於 CenOS7 的系統
https://github.com/jumpserver/jumpserver/wiki/v0.4.0-%E5%9F%BA%E4%BA%8E-CenOS7-%E7%9A%84%E7%B3%BB%E7%BB%9F