跳转至

1.5.0 及之后版本升级到最新版本

升级及迁移请保持 SECRET_KEY 与旧版本一致, 否则会导致数据库加密数据无法解密

  • 请先关闭 JumpServer 组件
  • 更新前请一定要做好备份 数据库 和 JumpServer 源代码的工作
mv /opt/jumpserver /opt/jumpserver_bak
mysqldump -uroot -p jumpserver > /opt/jumpserver_bak.sql

升级步骤

请务必认真详细阅读每一个文字并理解后才能操作升级事宜

请先检查自己各组件的当前版本
本文档仅适合 1.5.0 及之后版本 从 1.4.x 版本开始, mysql 版本需要大于等于 5.6, mariadb 版本需要大于等于 5.5.56
更新配置文件需要把对应旧版本的设置复制到新的配置文件

1. 更新代码

cd /opt
wget https://github.com/jumpserver/jumpserver/releases/download/v2.4.0/jumpserver-v2.4.0.tar.gz
tar -xf jumpserver-v2.4.0.tar.gz
mv jumpserver-v2.4.0 jumpserver
cp /opt/jumpserver_bak/config.yml /opt/jumpserver/
\cp -rf /opt/jumpserver_bak/data/* /opt/jumpserver/data/

自行替换 /opt 为你安装的目录

2. 更新依赖

注意载入 py3 虚拟环境

source /opt/py3/bin/activate
cd /opt/jumpserver
pip install wheel
pip install --upgrade pip setuptools
pip install -r requirements/requirements.txt

3. 启动 core

./jms start
可以 -d 参数在后台运行
./jms start -d  

4. 修改 nginx 配置

vi /etc/nginx/conf.d/jumpserver.conf

修改 jumpserver.conf

server {
    listen 80;

    client_max_body_size 100m;  # 录像及文件上传大小限制

    location /ui/ {
        try_files $uri / /index.html;
        alias /opt/lina/;
    }

    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/;  # 静态资源, 如果修改安装目录, 此处需要修改
    }

    location /koko/ {
        proxy_pass       http://localhost:5000;
        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 /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 /ws/ {
        proxy_pass http://localhost:8070;
        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 /api/ {
        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;
    }

    location /core/ {
        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;
    }

    location / {
        rewrite ^/(.*)$ /ui/$1 last;
    }
}
nginx -t
nginx -s reload

5. 更新 lina

cd /opt
rm -rf lina lina.tar.gz
wget https://github.com/jumpserver/lina/releases/download/v2.4.0/lina-v2.4.0.tar.gz
tar -xf lina-v2.4.0.tar.gz
mv lina-v2.4.0 lina

6. 更新 luna

cd /opt
rm -rf luna luna.tar.gz
wget https://github.com/jumpserver/luna/releases/download/v2.4.0/luna-v2.4.0.tar.gz
tar -xf luna-v2.4.0.tar.gz
mv luna-v2.4.0 luna

7. 更新 koko

  • 1.5.2 版本开始 coco 被 koko 取代, 且 coco 后续不再更新, 请手动停止并删除 coco 目录

docker stop jms_koko
docker rm jms_koko
docker run --name jms_koko -d \
  -p 2222:2222 -p 127.0.0.1:5000:5000 \
  -e CORE_HOST=http://<Jumpserver_url> \
  -e BOOTSTRAP_TOKEN=<Jumpserver_BOOTSTRAP_TOKEN> \
  -e LOG_LEVEL=ERROR \
  --restart=always \
  jumpserver/jms_koko:<Tag>
<Jumpserver_url> 为 JumpServer 的 url 地址, <Jumpserver_BOOTSTRAP_TOKEN> 需要从 jumpserver/config.yml 里面获取, 保证一致, <Tag> 是版本

例:

docker run --name jms_koko -d
  -p 2222:2222
  -p 127.0.0.1:5000:5000
  -e CORE_HOST=http://192.168.244.144:8080
  -e BOOTSTRAP_TOKEN=zxffNymGjP79j6BN
  -e LOG_LEVEL=ERROR
  --restart=always
  jumpserver/jms_koko:v2.4.0

8. 更新 guacamole

docker stop jms_guacamole
docker rm jms_guacamole
docker run --name jms_guacamole -d
  -p 127.0.0.1:8081:8080
  -e JUMPSERVER_SERVER=http://<Jumpserver_url>
  -e BOOTSTRAP_TOKEN=<Jumpserver_BOOTSTRAP_TOKEN>
  -e GUACAMOLE_LOG_LEVEL=ERROR
  jumpserver/jms_guacamole:<Tag>
<Jumpserver_url> 为 JumpServer 的 url 地址, <Jumpserver_BOOTSTRAP_TOKEN> 需要从 jumpserver/config.yml 里面获取, 保证一致, <Tag> 是版本

例:

docker run --name jms_guacamole -d
  -p 127.0.0.1:8081:8080
  -e JUMPSERVER_SERVER=http://192.168.244.144:8080
  -e BOOTSTRAP_TOKEN=abcdefg1234
  -e GUACAMOLE_LOG_LEVEL=ERROR
  jumpserver/jms_guacamole:v2.4.0
  • 升级完成后到 Web 会话管理 - 终端管理 查看组件是否已经在线