运行环境

系统版本:CentOS Linux release 7.6.1810 (Core)

软件版本:JumpServer-1.4.8

硬件要求:最低2核4GB

官方文档:https://docs.jumpserver.org/zh/docs/setup_by_centos7.html

安装过程

1、系统配置

  1. [root@localhost ~]# systemctl stop firewalld
  2. [root@localhost ~]# systemctl disable firewalld
  3. [root@localhost ~]# setenforce 0
  4. [root@localhost ~]# sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/sysconfig/selinux

2、安装依赖

  1. [root@localhost ~]# yum -y install wget gcc epel-release git

3、安装Redis

  1. [root@localhost ~]# yum -y install redis
  2. [root@localhost ~]# systemctl enable redis
  3. [root@localhost ~]# systemctl start redis
  4. [root@localhost ~]# systemctl status redis
  5. [root@localhost ~]# netstat -lnupt |grep redis
  6. tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 19387/redis-server

4、安装Mariadb(MYSQL)

  1. [root@localhost ~]# yum -y install mariadb mariadb-devel mariadb-server MariaDB-shared
  2. [root@localhost ~]# systemctl enable mariadb
  3. [root@localhost ~]# systemctl start mariadb
  4. [root@localhost ~]# netstat -lnupt |grep mysqld
  5. tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 19721/mysqld
  6. #设置Mariadb数据库管理员密码
  7. [root@localhost ~]# mysqladmin -uroot -p password 'ABCabc-123'
  8. #创建JumpServer所使用的数据库用户,并授权
  9. [root@localhost ~]# mysql -uroot -p'ABCabc-123'
  10. MariaDB [(none)]> create database jumpserver default charset 'utf8';
  11. MariaDB [(none)]> grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'ABCabc-123';
  12. MariaDB [(none)]> flush privileges;
  13. MariaDB [(none)]> exit

5、安装Nginx

  1. [root@localhost ~]# yum -y install nginx
  2. [root@localhost ~]# systemctl enable nginx

6、安装Docker

  1. [root@localhost ~]# yum -y install epel-release.noarch yum-utils
  2. [root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  3. [root@localhost ~]# yum -y install device-mapper-persistent-data lvm2
  4. [root@localhost ~]# yum -y install docker-ce
  5. [root@localhost ~]# systemctl start docker
  6. [root@localhost ~]# systemctl enable docker
  7. [root@localhost ~]# curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://f1361db2.m.daocloud.io
  8. [root@localhost ~]# systemctl restart docker
  9. [root@localhost ~]# systemctl status docker

7、安装Python3.6

JumpServer基于Python3.6开发,所以需要Python3.6运行环境。

  1. [root@localhost ~]# yum -y install python36 python36-devel
  2. #开启Python3.6虚拟运行环境,"py3"是这个虚拟环境名,可以自定义
  3. [root@localhost ~]# cd /opt
  4. [root@localhost opt]# python3.6 -m venv py3
  5. #退出虚拟环境可以使用"deactivate"命令
  6. [root@localhost opt]# source /opt/py3/bin/activate
  7. #看到下面的提示符代表成功, 以后运行JumpServer都要先运行以上"source"命令, 载入环境后默认以下所有命令均在该虚拟环境中运行
  8. (py3) [root@localhost opt]#

8、安装JumpServer

JumpServer系统的核心后端应用服务。

  1. #下载JumpServer
  2. (py3) [root@localhost opt]# git clone --depth=1 https://github.com/jumpserver/jumpserver.git
  3. #安装软件包依赖
  4. (py3) [root@localhost opt]# yum -y install $(cat /opt/jumpserver/requirements/rpm_requirements.txt)
  5. #安装Python依赖
  6. (py3) [root@localhost opt]# pip install --upgrade pip setuptools
  7. (py3) [root@localhost opt]# pip install -r /opt/jumpserver/requirements/requirements.txt
  8. #生成加密密钥
  9. [root@localhost jumpserver]# cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 49
  10. mTUbunBOhz6FqY06MWidwklGzROg3Od9k68FDJQda044CLRRH
  11. #生成引导令牌
  12. [root@localhost jumpserver]# cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 16
  13. 4dNPSDcgKguMLx0b
  14. #配置JumpServer
  15. (py3) [root@localhost opt]# cd jumpserver/
  16. (py3) [root@localhost jumpserver]# cp config_example.yml config.yml
  17. (py3) [root@localhost jumpserver]# vim config.yml
  18. SECRET_KEY: mTUbunBOhz6FqY06MWidwklGzROg3Od9k68FDJQda044CLRRH #设置加密密钥
  19. BOOTSTRAP_TOKEN: 4dNPSDcgKguMLx0b #设置引导令牌
  20. DEBUG: false #设置禁用调试模式
  21. LOG_LEVEL: ERROR #设置日志级别为ERROR级别
  22. SESSION_EXPIRE_AT_BROWSER_CLOSE: true #设置当浏览器关闭时Session过期
  23. DB_ENGINE: mysql #设置使用的数据库为MYSQL(Mariadb)
  24. DB_HOST: 127.0.0.1 #设置MYSQL数据库连接地址
  25. DB_PORT: 3306 #设置MYSQL数据库连接端口
  26. DB_USER: jumpserver #设置MYSQL数据库连接账号
  27. DB_PASSWORD: ABCabc-123 #设置MYSQL数据库连接密码
  28. DB_NAME: jumpserver #设置MYSQL数据库名
  29. HTTP_BIND_HOST: 0.0.0.0 #设置JumpServer WEB服务监听地址
  30. HTTP_LISTEN_PORT: 8080 #设置JumpServer WEB服务监听端口
  31. REDIS_HOST: 127.0.0.1 #设置Redis连接地址
  32. REDIS_PORT: 6379 #设置Redis连接端口
  33. #将JumpServer服务交给系统管理(system),并运行服务
  34. (py3) [root@localhost jumpserver]# wget -O /usr/lib/systemd/system/jms.service https://demo.jumpserver.org/download/shell/centos/jms.service
  35. (py3) [root@localhost jumpserver]# chmod 755 /usr/lib/systemd/system/jms.service
  36. (py3) [root@localhost jumpserver]# vim /usr/lib/systemd/system/jms.service
  37. [Unit]
  38. Description=jms
  39. After=network.target mariadb.service redis.service docker.service
  40. Wants=mariadb.service redis.service docker.service
  41. [Service]
  42. Type=forking
  43. Environment="PATH=/opt/py3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
  44. ExecStart=/opt/jumpserver/jms start -d
  45. ExecReload=
  46. ExecStop=/opt/jumpserver/jms stop
  47. [Install]
  48. WantedBy=multi-user.target
  49. (py3) [root@localhost jumpserver]# systemctl daemon-reload
  50. (py3) [root@localhost jumpserver]# systemctl start jms
  51. (py3) [root@localhost jumpserver]# systemctl enable jms
  52. (py3) [root@localhost jumpserver]# systemctl status jms
  53. (py3) [root@localhost jumpserver]# netstat -lnupt |grep 8080
  54. tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 36499/python3.6

9、安装koko和guacamole

在Docker中运行koko和guacamole应用服务。

koko :基于SSH协议,为用户提供JumpServer的操作终端。

guacamole :基于HTML5的VNC查看器,允许用户在WEB-UI管理控制台中进行VNC远程操作。

  1. (py3) [root@localhost jumpserver]# 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`
  2. (py3) [root@localhost jumpserver]# BOOTSTRAP_TOKEN='4dNPSDcgKguMLx0b'
  3. (py3) [root@localhost jumpserver]# docker run --name jms_koko -d -p 2222:2222 -p 127.0.0.1:5000:5000 -e CORE_HOST=http://$Server_IP:8080 -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN --restart=always jumpserver/jms_koko:1.5.2
  4. (py3) [root@localhost jumpserver]# docker run --name jms_guacamole -d -p 127.0.0.1:8081:8081 -e JUMPSERVER_SERVER=http://$Server_IP:8080 -e BOOTSTRAP_TOKEN=$BOOTSTRAP_TOKEN --restart=always jumpserver/jms_guacamole:1.5.2
  5. (py3) [root@localhost jumpserver]# docker ps
  6. [root@localhost ~]# netstat -lnupt |grep 5000
  7. tcp 0 0 127.0.0.1:5000 0.0.0.0:* LISTEN 37806/docker-proxy
  8. [root@localhost ~]# netstat -lnupt |grep 8081
  9. tcp 0 0 127.0.0.1:8081 0.0.0.0:* LISTEN 38042/docker-proxy

10、下载管理控制台-luna(前端页面)

luna为JumpServer提供一个WEB-UI的管理控制台。

  1. (py3) [root@localhost jumpserver]# cd /opt
  2. (py3) [root@localhost opt]# wget https://demo.jumpserver.org/download/luna/1.5.2/luna.tar.gz
  3. (py3) [root@localhost opt]# tar xf luna.tar.gz
  4. (py3) [root@localhost opt]# chown -R root:root luna

11、配置Nginx

配置Nginx发布前端页面和反代后端应用服务(jumpserver、koko、guacamole)。

  1. (py3) [root@localhost opt]# rm -rf /etc/nginx/conf.d/default.conf
  2. (py3) [root@localhost opt]# vim /etc/nginx/nginx.conf
  3. user nginx;
  4. worker_processes auto;
  5. error_log /var/log/nginx/error.log;
  6. pid /run/nginx.pid;
  7. include /usr/share/nginx/modules/*.conf;
  8. events {
  9. worker_connections 1024;
  10. }
  11. http {
  12. log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  13. '$status $body_bytes_sent "$http_referer" '
  14. '"$http_user_agent" "$http_x_forwarded_for"';
  15. access_log /var/log/nginx/access.log main;
  16. sendfile on;
  17. tcp_nopush on;
  18. tcp_nodelay on;
  19. keepalive_timeout 65;
  20. types_hash_max_size 2048;
  21. include /etc/nginx/mime.types;
  22. default_type application/octet-stream;
  23. include /etc/nginx/conf.d/*.conf;
  24. }
  25. (py3) [root@localhost opt]# vim /etc/nginx/conf.d/jumpserver.conf
  26. server {
  27. listen 80;
  28. client_max_body_size 100m;
  29. #限制文件上传大小。
  30. location /luna/ {
  31. try_files $uri / /index.html;
  32. alias /opt/luna/;
  33. }
  34. #前端页面-luna目录路径
  35. location /media/ {
  36. add_header Content-Encoding gzip;
  37. root /opt/jumpserver/data/;
  38. }
  39. #录像数据。
  40. location /static/ {
  41. root /opt/jumpserver/data/;
  42. }
  43. #静态数据。
  44. location /socket.io/ {
  45. proxy_pass http://localhost:5000/socket.io/;
  46. proxy_buffering off;
  47. proxy_http_version 1.1;
  48. proxy_set_header Upgrade $http_upgrade;
  49. proxy_set_header Connection "upgrade";
  50. proxy_set_header X-Real-IP $remote_addr;
  51. proxy_set_header Host $host;
  52. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  53. access_log off;
  54. }
  55. location /coco/ {
  56. proxy_pass http://localhost:5000/coco/;
  57. proxy_set_header X-Real-IP $remote_addr;
  58. proxy_set_header Host $host;
  59. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  60. access_log off;
  61. }
  62. location /guacamole/ {
  63. proxy_pass http://localhost:8081/;
  64. proxy_buffering off;
  65. proxy_http_version 1.1;
  66. proxy_set_header Upgrade $http_upgrade;
  67. proxy_set_header Connection $http_connection;
  68. proxy_set_header X-Real-IP $remote_addr;
  69. proxy_set_header Host $host;
  70. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  71. access_log off;
  72. }
  73. location / {
  74. proxy_pass http://localhost:8080;
  75. proxy_set_header X-Real-IP $remote_addr;
  76. proxy_set_header Host $host;
  77. proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  78. }
  79. }
  80. (py3) [root@localhost opt]# nginx -t
  81. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  82. nginx: configuration file /etc/nginx/nginx.conf test is successful
  83. (py3) [root@localhost opt]# systemctl start nginx
  84. (py3) [root@localhost opt]# systemctl enable nginx
  85. (py3) [root@localhost opt]# systemctl status nginx

12、访问JumpServer管理控制台(luna)

在浏览器中直接输入"http://服务器地址/luna"即可。

默认管理员账号:admin

默认管理员密码:admin

13、访问JumpServer操作终端(koko)

使用SSH的方式访问到JumpServer操作终端。

  1. [root@localhost ~]# ssh -p 2222 admin@172.16.254.128
  2. admin@172.16.254.128's password:
  3. Administrator, 欢迎使用Jumpserver开源堡垒机系统
  4. 1) 输入 ID 进行直接登陆.
  5. 2) 输入 部分IP、主机名、备注 进行进行搜索登录(如果唯一).
  6. 3) 输入 / + IP, 主机名 or 备注 进行搜索, 如: /192.168.
  7. 4) 输入 p 进行显示您有权限的主机.
  8. 5) 输入 g 进行显示您有权限的节点.
  9. 6) 输入 r 进行刷新最新的机器和节点信息.
  10. 7) 输入 h 进行显示帮助.
  11. 8) 输入 q 进行退出.
  12. Opt> q

安装JumpServer到CentOS(YUM)的更多相关文章

  1. Ejabberd2:安装和操作指南(centos yum 安装ejabberd)

    (1)首先安装EPEL Repository     ## RHEL/CentOS 6 32-Bit ##  # wget http://download.fedoraproject.org/pub/ ...

  2. centos yum 安装 mongodb 以及php扩展

    centos yum 安装 mongodb 以及php扩展 投稿:hebedich 字体:[增加 减小] 类型:转载 MongoDB是一个基于分布式文件存储的数据库.由C++语言编写.旨在为WEB应用 ...

  3. yum-config-manager YUM安装遭遇: [Errno 256] No more mirrors to try CentOS yum之$releasever和$basearch

    YUM安装遭遇: [Errno 256] No more mirrors to try createrepo 有问题. CentOS yum之$releasever和$basearch分类: 操作系统 ...

  4. redhat centos yum源的安装

    redhat centos yum源的安装 1.除旧 #cd /etc/yum.repos.d #mv rhel-debuginfo.repo rhel-debuginfo.repo.bak 此处将其 ...

  5. 【转】CentOS yum安装和卸载软件的使用方法

    在CentOS yum安装和卸载软件的使用方法安装方法安装一个软件时.   CentOS yum -y install httpd安装多个相类似的软件时   CentOS yum -y install ...

  6. CentOS6.5系统挂载NTFS分区的移动硬盘 centos安装repoforge源(yum)

    CentOS6.5系统挂载NTFS分区的移动硬盘 作为IT的工作者,避免不了使用Linux系统,我现在使用的系统是CentOS6.5 X86_64位版本,但是插入NTFS移动硬盘没有办法识别.通过下面 ...

  7. centos的软件安装方法rpm和yum

    centos的软件安装大致可以分为两种类型: [centos]rpm文件安装,使用rpm指令  类似[ubuntu]deb文件安装,使用dpkg指令 [centos]yum安装   类似[ubuntu ...

  8. RHEL 6.3使用CentOS yum源 (redhat yum安装失败)

    由于Redhat的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件.所以yum install 命令每次都安装失败 下面介绍一种更改yum源的方式: 系统说明: 系统:Red ...

  9. CentOS yum 安装 PHP 5.6.24

    配置yum源 追加CentOS 6.5的epel及remi源. # rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/6/x86_64/epel- ...

随机推荐

  1. wordpress 如何正确升级

    http://www.admin5.com/article/20141230/578710.shtml 正确的版本升级应该是,备份数据库和文件,然后禁用所有的插件后在执行升级.这样也避免不了升级过后启 ...

  2. tensorflow feed_dict()

    import tensorflow as tf a=tf.Variable(100) b=tf.Variable(200) c=tf.Variable(300) update1=tf.assign(c ...

  3. 2019icpc徐州现场赛 H Yuuki and a problem (树状数组套主席树)

    题意 2e5的数组,q个操作 1.将\(a[x]\)改为y 2.求下标l到r内所有的\(a[i]\)通过加法不能构成的最小的值 思路 通过二操作可以知道需要提取l到r内的值及其数量,而提取下标为l到r ...

  4. BZOJ 1601 [Usaco2008 Oct]灌水 (建图+mst)

    题意: 300个坑,每个坑能从别的坑引水,或者自己出水,i从j饮水有个代价,每个坑自己饮水也有代价,问让所有坑都有谁的最少代价 思路: 先建一个n的完全图,然后建一个超级汇点,对每个点连w[i],跑m ...

  5. python练习——第1题

    原GitHub地址:https://github.com/Yixiaohan/show-me-the-code 题目:做为 Apple Store App 独立开发者,你要搞限时促销,为你的应用生成激 ...

  6. Linux学习2-云服务器上安装java和tomcat环境

    在linux上部署java的项目,首先要安装JDK和Tomcat,具体要求怎么操作呢,我们一起来学习吧! JDK的安装步骤如下: 1.首先我们从官网下载jdk-8u231-linux-x64.rpm安 ...

  7. tar命令详解及使用实例

    tar命令 [root@linux ~]# tar [-cxtzjvfpPN] 文件与目录 …. 参数: -c :创建压缩文件 -x :解开压缩文件 -t :查看tar包里面的文件! 上面3个参数只能 ...

  8. JVM性能优化系列-(4) 编写高效Java程序

    4. 编写高效Java程序 4.1 面向对象 构造器参数太多怎么办? 正常情况下,如果构造器参数过多,可能会考虑重写多个不同参数的构造函数,如下面的例子所示: public class FoodNor ...

  9. RFC笔记,IPv6 Node Requirements

    Request for Comments: 6434,IPv6 Node Requirements 路由器节点必须能够生成链路本地地址 5.9.2. IPv6 Stateless Address Au ...

  10. Python 调用 Shell命令

    python程序中调用shell命令,是件很酷且常用的事情今天来总结一下   1.使用os模块 的  system         此函数会启动子进程,在子进程中执行command,并返回comman ...