一艳丛、jumpserver(1.4.8版本)部署文檔
1.部署前配置好yum源以及docker源(此步驟省略)
2.安裝依賴包以及數(shù)據(jù)庫相關(guān)依賴包
yum -y install wget gcc epel-release git redis mariadb mariadb-devel mariadb-server MariaDB-shared
3.開啟數(shù)據(jù)庫并且設(shè)置開機自啟
systemctl enable redis && systemctl start redis
systemctl enable mariadb && systemctl start mariadb
4.創(chuàng)建數(shù)據(jù)庫 Jumpserver 并授權(quán)(DB_PASSWORD為數(shù)據(jù)庫密碼逾条,可自行設(shè)定)
mysql -uroot -e "create database jumpserver default charset 'utf8'; grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'HT706'; flush privileges;"
5.安裝 Nginx設(shè)置開機自啟, 用作代理服務(wù)器整合 Jumpserver 與各個組件掏觉;這里只做安裝啟動,后續(xù)部署組件
yum -y install nginx && systemctl start nginx && systemctl enable nginx
6.安裝 Python3.6
1)yum -y install python36 python36-devel
2)進入python環(huán)境
cd /opt/
python3.6 -m venv py3? #為虛擬環(huán)境定義名稱沈善,隨意
source /opt/py3/bin/activate? #進入虛擬環(huán)境
***以下步驟均在python環(huán)境操作***
7.下載 Jumpserver(我提前下載好的乡数;可以去github下載)
cd /opt/ && git clone https://github.com/jumpserver/jumpserver.git? #下載目錄可自行定義
cd /opt/jumpserver? && git checkout 1.4.8? #部署1.4.8版本,因此需要切換分支
8.安裝所需依賴包
yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt)
9.安裝 Python 庫依賴
pip install --upgrade pip setuptools
pip install -r /opt/jumpserver/requirements/requirements.txt
如報錯可能網(wǎng)絡(luò)延遲可重復(fù)執(zhí)行或手動安裝缺少的依賴(pip install )
10.修改jumpserver配置文件
1)生成SECRET_KEY與BOOTSTRAP_TOKEN密鑰
SECRET_KEY=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 50`? # 生成隨機SECRET_KEY
BOOTSTRAP_TOKEN=`cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16` #生成隨機BOOTSTRAP_TOKEN
echo "SECRET_KEY=$SECRET_KEY" >> ~/.bashrc
echo "BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN" >> ~/.bashrc
2)修改配置文件
vim /opt/jumpserver/config.yaml
4 SECRET_KEY: 與生成密鑰一致
8 BOOTSTRAP_TOKEN: 與生成密鑰一致
12 DEBUG: false
16 LOG_LEVEL: ERROR
22 SESSION_EXPIRE_AT_BROWSER_CLOSE: true
35 DB_ENGINE: mysql
36 DB_HOST: 127.0.0.1
37 DB_PORT: 3306
38 DB_USER: jumpserver
39 DB_PASSWORD: HT706
40 DB_NAME: jumpserver
50 REDIS_HOST: 127.0.0.1
51 REDIS_PORT: 6379
11.運行jumpserver服務(wù)
cd /opt/jumpserver?
./jms start -d
12.安裝docker闻牡;部署coco與guacamole組件
1)安裝依賴包
yum install -y yum-utils device-mapper-persistent-data lvm2 docker-ce
systemctl enable docker? && systemctl start docker #設(shè)置開機自啟
2)coco與guacamole組件下載净赴;自行docker pull拉取罩润;提前配置好docker源玖翅,這里不做詳細說明
3)提取服務(wù)器IP地址
Server_IP=`ip addr | grep inet | egrep -v '(127.0.0.1|inet6|docker)' | awk '{print $2}' | tr -d "addr:" | head -n 1 | cut -d / -f1`
echo Server_IP=$Server_IP >> ~/.bashrc? #保存
4)docker運行coco與guacamole組件
coco組件運行(BOOTSTRAP_TOKEN必須與jumpserver的config.yaml里的BOOTSTRAP_TOKEN一致)
docker run --name jms_coco -d -p 2222:2222 -p 5000:5000 -e CORE_HOST=http://$Server_IP:8080 -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN jumpserver/jms_coco:1.4.8
guacamole同理運行
docker run --name jms_guacamole -d -p 8081:8081 -e JUMPSERVER_SERVER=http://$Server_IP:8080 -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN jumpserver/jms_guacamole:1.4.8
13.安裝 Web Terminal 前端: Luna。直接解壓不需要編譯割以;
cd /opt/ && wget https://github.com/jumpserver/luna/releases/download/1.4.8/luna.tar.gz
tar xf luna.tar.gz
chown -R root.root luna
14.修改nginx配置文件
vim /etc/nginx/nginx.conf
...
...
server {
? ? listen 80;
? ? client_max_body_size 100m;? # 錄像及文件上傳大小限制
? ? location /luna/ {
? ? ? ? try_files $uri / /index.html;
? ? ? ? alias /opt/luna/;? # luna 路徑, 如果修改安裝目錄, 此處需要修改
? ? }
? ? location /media/ {
? ? ? ? add_header Content-Encoding gzip;
? ? ? ? root /opt/jumpserver/data/;? # 錄像位置, 如果修改安裝目錄, 此處需要修改
? ? }
? ? location /static/ {
? ? ? ? root /opt/jumpserver/data/;? # 靜態(tài)資源, 如果修改安裝目錄, 此處需要修改
? ? }
? ? location /socket.io/ {
? ? ? ? proxy_pass? ? ? http://localhost:5000/socket.io/;
? ? ? ? proxy_buffering off;
? ? ? ? proxy_http_version 1.1;
? ? ? ? proxy_set_header Upgrade $http_upgrade;
? ? ? ? proxy_set_header Connection "upgrade";
? ? ? ? proxy_set_header X-Real-IP $remote_addr;
? ? ? ? proxy_set_header Host $host;
? ? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
? ? ? ? access_log off;
? ? }
? ? location /coco/ {
? ? ? ? proxy_pass? ? ? http://localhost:5000/coco/;
? ? ? ? proxy_set_header X-Real-IP $remote_addr;
? ? ? ? proxy_set_header Host $host;
? ? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
? ? ? ? access_log off;
? ? }
? ? location /guacamole/ {
? ? ? ? proxy_pass? ? ? http://localhost:8081/;
? ? ? ? proxy_buffering off;
? ? ? ? proxy_http_version 1.1;
? ? ? ? proxy_set_header Upgrade $http_upgrade;
? ? ? ? proxy_set_header Connection $http_connection;
? ? ? ? proxy_set_header X-Real-IP $remote_addr;
? ? ? ? proxy_set_header Host $host;
? ? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
? ? ? ? access_log off;
? ? }
? ? location / {
? ? ? ? proxy_pass http://localhost:8080;
? ? ? ? proxy_set_header X-Real-IP $remote_addr;
? ? ? ? proxy_set_header Host $host;
? ? ? ? proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
? ? }
}