升级文档

    环境说明

    • 从 v2.5 开始, 要求 MySQL >= 5.7
    • 从 v2.6 开始, 要求 Redis >= 5
    • 推荐使用外置 数据库 和 Redis, 方便日后扩展升级

    v2.6 版本升级说明

    • 统一企业版本与开源版本安装方式, 企业版和社区版可以无缝切换
    • 今后只会维护此安装方式, 其他安装方式不再提供技术支持
    • 安装完成后配置文件在 /opt/jumpserver/config/config.txt

    备份数据库

    手动部署

    1. ./koko -s stop
    2. # 更老的版本使用的 coco
    3. # cd /opt/coco
    4. # ./cocod stop
    1. /etc/init.d/guacd stop
    2. sh /config/tomcat9/bin/shutdown.sh
    1. cd /opt/jumpserver
    2. source /opt/py3/bin/activate
    3. ./jms stop
    1. cd /opt
    2. mv /opt/jumpserver /opt/jumpserver_bak
    1. mysqldump -h127.0.0.1 -P3306 -ujumpserver -p jumpserver > /opt/jumpserver.sql
    1. docker stop jms_koko jms_guacamole
    2. docker rm jms_koko jms_guacamole
    3. # 更老的版本使用的 coco
    4. # docker stop jms_coco
    5. # docker rm jms_coco
    1. cd /opt/jumpserver
    2. source /opt/py3/bin/activate
    3. ./jms stop
    1. cd /opt
    2. mv /opt/jumpserver /opt/jumpserver_bak
    1. mysqldump -h127.0.0.1 -P3306 -ujumpserver -p jumpserver > /opt/jumpserver.sql

    setuptools 脚本部署

    1. cd /opt/setuptools
    2. ./jmsctl.sh stop
    3. docker rm jms_koko jms_guacamole
    4. systemctl disable jms_core
    5. mv /opt/jumpserver /opt/jumpserver_bak
    1. mysqldump -h127.0.0.1 -P3306 -ujumpserver -p jumpserver > /opt/jumpserver.sql

    docker 部署

    1. docker exec -it jms_all /bin/bash
    2. mysqldump -h$DB_HOST -P$DB_PORT -u$DB_USER -p$DB_PASSWORD $DB_NAME > /opt/jumpserver.sql
    3. exit
    1. docker cp jms_all:/opt/jumpserver.sql /opt
    2. docker stop jms_all

    docker-compose 部署

    1. docker cp jms_core:/opt/jumpserver /opt/jumpserver_bak
    2. docker exec -it jms_core env | egrep "SECRET_KEY|BOOTSTRAP_TOKEN"
    1. docker exec -it jms_mysql /bin/bash
    2. mysqldump -uroot jumpserver > /opt/jumpserver.sql
    3. exit
    1. docker cp jms_mysql:/opt/jumpserver.sql /opt
    2. cd /opt/Dockerfile
    3. docker-compose stop

    修改数据库字符集

    1. if grep -q 'COLLATE=utf8_bin' /opt/jumpserver.sql; then
    2. cp /opt/jumpserver.sql /opt/jumpserver_bak.sql
    3. sed -i 's@COLLATE=utf8_bin@@g' /opt/jumpserver.sql
    4. sed -i 's@COLLATE utf8_bin@@g' /opt/jumpserver.sql
    5. else
    6. echo "备份数据库字符集正确";
    7. fi
    1. cd /opt
    2. yum -y install wget
    3. wget https://github.com/jumpserver/installer/releases/download/v2.9.2/jumpserver-installer-v2.9.2.tar.gz
    4. tar -xf jumpserver-installer-v2.9.2.tar.gz
    5. cd jumpserver-installer-v2.9.2
    1. vi config-example.txt
    1. # 修改下面选项, 其他保持默认
    2. ### 注意: SECRET_KEY 与旧版本不一致, 加密的数据将无法解密
    3. # Core 配置
    4. ### 启动后不能再修改,否则密码等等信息无法解密
    5. SECRET_KEY= # 从旧版本的配置文件获取后填入 (*)
    6. BOOTSTRAP_TOKEN= # 从旧版本的配置文件获取后填入 (*)
    7. LOG_LEVEL=ERROR
    8. # SESSION_COOKIE_AGE=86400
    9. SESSION_EXPIRE_AT_BROWSER_CLOSE=true # 关闭浏览器后 session 过期

    开始部署 JumpServer

    使用内置数据库

    1. ./jmsctl.sh install
    1. ██╗██╗ ██╗███╗ ███╗██████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗
    2. ██║██║ ██║████╗ ████║██╔══██╗██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗
    3. ██║██║ ██║██╔████╔██║██████╔╝███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝
    4. ██ ██║██║ ██║██║╚██╔╝██║██╔═══╝ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗
    5. ╚█████╔╝╚██████╔╝██║ ╚═╝ ██║██║ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║
    6. ╚════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
    7. Version: v2.9.2
    8. >>> 安装配置 Docker
    9. 1. 安装 Docker
    10. 开始下载 Docker 程序 ...
    11. 完成
    12. 开始下载 Docker Compose 程序 ...
    13. 完成
    14. 2. 配置 Docker
    15. 是否需要自定义 Docker 数据目录, 默认将使用 /var/lib/docker 目录? (y/n) (默认为 n): n
    16. 完成
    17. 3. 启动 Docker
    18. Docker 版本发生改变 Docker 配置文件发生变化,是否要重启? (y/n) (默认为 y): y
    19. 完成
    20. Docker: Pulling from jumpserver/core:v2.9.2 [ OK ]
    21. Docker: Pulling from jumpserver/koko:v2.9.2 [ OK ]
    22. Docker: Pulling from jumpserver/luna:v2.9.2 [ OK ]
    23. Docker: Pulling from jumpserver/nginx:alpine2 [ OK ]
    24. Docker: Pulling from jumpserver/redis:6-alpine [ OK ]
    25. Docker: Pulling from jumpserver/lina:v2.9.2 [ OK ]
    26. Docker: Pulling from jumpserver/mysql:5 [ OK ]
    27. Docker: Pulling from jumpserver/guacamole:v2.9.2 [ OK ]
    28. >>> 安装配置 JumpServer
    29. 1. 检查配置文件
    30. 配置文件位置: /opt/jumpserver/config
    31. /opt/jumpserver/config/config.txt [ ]
    32. /opt/jumpserver/config/nginx/lb_http_server.conf [ ]
    33. /opt/jumpserver/config/nginx/lb_ssh_server.conf [ ]
    34. /opt/jumpserver/config/core/config.yml [ ]
    35. /opt/jumpserver/config/koko/config.yml [ ]
    36. /opt/jumpserver/config/mysql/my.cnf [ ]
    37. /opt/jumpserver/config/redis/redis.conf [ ]
    38. 完成
    39. 2. 配置 Nginx
    40. 配置文件位置:: /opt/jumpserver/config/nginx/cert
    41. /opt/jumpserver/config/nginx/cert/server.crt [ ]
    42. /opt/jumpserver/config/nginx/cert/server.key [ ]
    43. 完成
    44. 3. 备份配置文件
    45. 备份至 /opt/jumpserver/config/backup/config.txt.2021-03-19_08-01-51
    46. 完成
    47. 4. 配置网络
    48. 是否需要支持 IPv6? (y/n) (默认为 n): n
    49. 完成
    50. 5. 配置加密密钥
    51. SECRETE_KEY: ICAgIGluZXQ2IDI0MDk6OGE0ZDpjMjg6ZjkwMTo6ZDRjLzEyO
    52. BOOTSTRAP_TOKEN: ICAgIGluZXQ2IDI0
    53. 完成
    54. 6. 配置持久化目录
    55. 是否需要自定义持久化存储, 默认将使用目录 /opt/jumpserver? (y/n) (默认为 n): n
    56. 完成
    57. 7. 配置 MySQL
    58. 是否使用外部mysql (y/n) (默认为n): n
    59. 8. 配置 Redis
    60. 是否使用外部redis (y/n) (默认为n): n
    61. >>> 安装完成了
    62. 1. 可以使用如下命令启动, 然后访问
    63. ./jmsctl.sh start
    64. 2. 其它一些管理命令
    65. ./jmsctl.sh stop
    66. ./jmsctl.sh restart
    67. ./jmsctl.sh backup
    68. ./jmsctl.sh upgrade
    69. 更多还有一些命令, 你可以 ./jmsctl.sh --help 来了解
    70. 3. Web 访问
    71. http://192.168.100.248:8080
    72. https://192.168.100.248:8443
    73. 默认用户: admin 默认密码: admin
    74. 4. SSH/SFTP 访问
    75. ssh admin@192.168.100.248 -p2222
    76. sftp -P2222 admin@192.168.100.248
    77. 5. 更多信息
    78. 我们的官网: https://www.jumpserver.org/
    79. 我们的文档: https://docs.jumpserver.org/

    使用外置数据库

    1. ██╗██╗ ██╗███╗ ███╗██████╗ ███████╗███████╗██████╗ ██╗ ██╗███████╗██████╗
    2. ██║██║ ██║████╗ ████║██╔══██╗██╔════╝██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗
    3. ██║██║ ██║██╔████╔██║██████╔╝███████╗█████╗ ██████╔╝██║ ██║█████╗ ██████╔╝
    4. ██ ██║██║ ██║██║╚██╔╝██║██╔═══╝ ╚════██║██╔══╝ ██╔══██╗╚██╗ ██╔╝██╔══╝ ██╔══██╗
    5. ╚█████╔╝╚██████╔╝██║ ╚═╝ ██║██║ ███████║███████╗██║ ██║ ╚████╔╝ ███████╗██║ ██║
    6. ╚════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
    7. Version: v2.9.2
    8. >>> 安装配置 Docker
    9. 1. 安装 Docker
    10. 开始下载 Docker 程序 ...
    11. 完成
    12. 开始下载 Docker Compose 程序 ...
    13. 完成
    14. 2. 配置 Docker
    15. 是否需要自定义 Docker 数据目录, 默认将使用 /var/lib/docker 目录? (y/n) (默认为 n): n
    16. 完成
    17. 3. 启动 Docker
    18. Docker 版本发生改变 Docker 配置文件发生变化,是否要重启? (y/n) (默认为 y): y
    19. 完成
    20. >>> 加载 Docker 镜像
    21. Docker: Pulling from jumpserver/core:v2.9.2 [ OK ]
    22. Docker: Pulling from jumpserver/koko:v2.9.2 [ OK ]
    23. Docker: Pulling from jumpserver/luna:v2.9.2 [ OK ]
    24. Docker: Pulling from jumpserver/nginx:alpine2 [ OK ]
    25. Docker: Pulling from jumpserver/redis:6-alpine [ OK ]
    26. Docker: Pulling from jumpserver/lina:v2.9.2 [ OK ]
    27. Docker: Pulling from jumpserver/mysql:5 [ OK ]
    28. >>> 安装配置 JumpServer
    29. 配置文件位置: /opt/jumpserver/config
    30. /opt/jumpserver/config/config.txt [ ]
    31. /opt/jumpserver/config/nginx/lb_http_server.conf [ ]
    32. /opt/jumpserver/config/nginx/lb_ssh_server.conf [ ]
    33. /opt/jumpserver/config/core/config.yml [ ]
    34. /opt/jumpserver/config/koko/config.yml [ ]
    35. /opt/jumpserver/config/mysql/my.cnf [ ]
    36. /opt/jumpserver/config/redis/redis.conf [ ]
    37. 完成
    38. 2. 配置 Nginx
    39. 配置文件位置:: /opt/jumpserver/config/nginx/cert
    40. /opt/jumpserver/config/nginx/cert/server.crt [ ]
    41. /opt/jumpserver/config/nginx/cert/server.key [ ]
    42. 完成
    43. 3. 备份配置文件
    44. 备份至 /opt/jumpserver/config/backup/config.txt.2021-03-19_08-01-51
    45. 完成
    46. 4. 配置网络
    47. 是否需要支持 IPv6? (y/n) (默认为 n): n
    48. 完成
    49. 5. 配置加密密钥
    50. SECRETE_KEY: ICAgIGluZXQ2IDI0MDk6OGE0ZDpjMjg6ZjkwMTo6ZDRjLzEyO
    51. BOOTSTRAP_TOKEN: ICAgIGluZXQ2IDI0
    52. 完成
    53. 6. 配置持久化目录
    54. 是否需要自定义持久化存储, 默认将使用目录 /opt/jumpserver? (y/n) (默认为 n): n
    55. 完成
    56. 7. 配置 MySQL
    57. 是否使用外部mysql (y/n) (默认为n): y
    58. 请输入mysql的主机地址 (无默认值): 192.168.100.11
    59. 请输入mysql的端口 (默认为3306): 3306
    60. 请输入mysql的数据库(事先做好授权) (默认为jumpserver): jumpserver
    61. 请输入mysql的用户名 (无默认值): jumpserver
    62. 请输入mysql的密码 (无默认值): weakPassword
    63. 完成
    64. 8. 配置 Redis
    65. 是否使用外部redis (y/n) (默认为n): y
    66. 请输入redis的主机地址 (无默认值): 192.168.100.11
    67. 请输入redis的端口 (默认为6379): 6379
    68. 请输入redis的密码 (无默认值): weakPassword
    69. 完成
    70. >>> 安装完成了
    71. 1. 可以使用如下命令启动, 然后访问
    72. ./jmsctl.sh start
    73. 2. 其它一些管理命令
    74. ./jmsctl.sh stop
    75. ./jmsctl.sh restart
    76. ./jmsctl.sh backup
    77. ./jmsctl.sh upgrade
    78. 更多还有一些命令, 你可以 ./jmsctl.sh --help 来了解
    79. 3. Web 访问
    80. http://192.168.100.248:8080
    81. https://192.168.100.248:8443
    82. 默认用户: admin 默认密码: admin
    83. 4. SSH/SFTP 访问
    84. ssh admin@192.168.100.248 -p2222
    85. sftp -P2222 admin@192.168.100.248
    86. 5. 更多信息
    87. 我们的官网: https://www.jumpserver.org/
    88. 我们的文档: https://docs.jumpserver.org/
    1. mkdir -p /opt/jumpserver/core/
    2. mv /opt/jumpserver_bak/data /opt/jumpserver/core/
    1. ./jmsctl.sh start
    1. Creating network "jms_net" with driver "bridge"
    2. Creating jms_core ... done
    3. Creating jms_celery ... done
    4. Creating jms_luna ... done
    5. Creating jms_lina ... done
    6. Creating jms_guacamole ... done
    7. Creating jms_koko ... done
    8. Creating jms_nginx ... done
    1. docker exec -it jms_mysql /bin/bash
    2. mysql -uroot -p$DB_PASSWORD
    1. drop database jumpserver;
    2. create database jumpserver default charset 'utf8';
    3. exit
    4. exit
    1. ./jmsctl.sh restore_db /opt/jumpserver.sql
    1. 开始还原数据库: /opt/jumpserver.sql
    2. mysql: [Warning] Using a password on the command line interface can be insecure.
    3. 数据库恢复成功!
    1. ./jmsctl.sh restart

    升级说明

    要求说明

    • jumpserver 版本 >= v2.6.0
    • jumpserver 版本 < v2.6.0 的请先参考上面的迁移文档迁移到最新版本

    升级步骤

    1. cd /opt
    2. yum -y install wget
    3. wget https://github.com/jumpserver/installer/releases/download/v2.9.2/jumpserver-installer-v2.9.2.tar.gz
    4. tar -xf jumpserver-installer-v2.9.2.tar.gz
    5. cd jumpserver-installer-v2.9.2
    1. ./jmsctl.sh upgrade