centos7:Jumpserver安装与部署(二)

上一篇搭建部署了Jumpserver,但是还未彻底完成,这篇继续接着上一篇搭建部署Jumpserver。

1、test-env

hostname

ip

role

cs74s

192.168.10.15

server

systemctl stopNetworkManager

systemctl disableNetworkManager

systemctl stopfirewalld

扫描二维码关注公众号,回复: 2635101 查看本文章

systemctl disablefirewalld

setenforce 0

sed -i'/^SELINUX=/cSELINUX=disabled' /etc/selinux/config

特别注意:
    一定要注意目录的切换和source

2、安装ssh server和websocket server:coco

    # 下载或clone项目

        cd /opt/

        source /opt/py3/bin/activate

        git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master

        echo "source /opt/py3/bin/activate" > /opt/coco/.env

    # 安装依赖

        cd /opt/coco/requirements/

        yum install -y $(cat rpm_requirements.txt)

        pip install -r requirements.txt -i https://pypi.org/simple

    # 查看配置文件,运行

        cd /opt/coco/

        cp conf_example.py conf.py

        ./cocod start -d ---> -d 在后台执行

        启动成功后去Jumpserver 会话管理-终端管理(http://192.168.10.15:8080/terminal/terminal/)接受coco的注册,如果页面不正常可以等部署完成后再处理

3、安装web terminal前端:luna

访问(https://github.com/jumpserver/luna/releases)下载对应版本的 release 包,直接解压,不需要编译

    # 解压luna

        cd /opt/

        wget https://github.com/jumpserver/luna/releases/download/1.3.0/dist.tar.gz

        tar xf dist.tar.gz

        mv dist luna

        ls luna/

    注:我总感觉luna没有安装完,但是找了好多帖子都没有详细完整的安装步骤,如果你们知道如何安装,希望能分享下,谢谢。

4、安装windows的支持组件--->如果不需要管理windows资产,可省

    # 安装guacamole组件,使用打包好的docker

        yum remove docker-latest-logrotate docker-logrotate docker-selinux dockdocker-engine

        yum install -y yum-utils device-mapper-persistent-data lvm2

        yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

        yum makecache fast

        yum install -y docker-ce

    # 如果上面的失败了,可以试试这个aliyun的

        yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

        rpm --import http://mirrors.aliyun.com/docker-ce/linux/centos/gpg

        yum makecache fast

        yum install -y docker-ce

    # 启动docker

        systemctl start docker

        systemctl enable docker

    # 启动Guacamole ---> 这个过程会有点慢,要下载好多东西

        # 这里所需要注意的是 guacamole 暴露出来的端口是 8081,若与主机上其他端口冲突请自定义

        # 修改下面 docker run 里的 JUMPSERVER_SERVER 参数,填上 Jumpserver 的 url 地址, 启动成功后去 Jumpserver 会话管理-终端管理(http://192.168.10.15:8080/terminal/terminal/)接受[Gua]开头的一个注册,如果页面显示不正常可以等部署完成后再处理

        [root@cs74s opt]# docker run --name jms_guacamole -d \
        > -p 8081:8080 \
        > -v /opt/guacamole/key:/config/guacamole/key \
        > -e JUMPSERVER_KEY_DIR=/config/guacamole/key \
        > -e JUMPSERVER_SERVER=http://192.168.10.15 \    --->  这个ip是jumpserver的ip

        > registry.jumpserver.org/public/guacamole:latest

   

5、配置nginx整合各组件

    # 安装nginx

        yum install -y nginx

    # 修改配置文件

        cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak

        vim /etc/nginx/nginx.conf

             38     server {
             39         listen       80;
             40
             41         proxy_set_header X-Real-IP $remote_addr;
             42         proxy_set_header Host $host;
             43         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             44
             45         location /luna/ {
             46             try_files $uri / /index.html;
             47             alias /opt/luna/;
             48         }
             49
             50         location /media/ {
             51             add_header Content-Encoding gzip;
             52             root /opt/jumpserver/data/;
             53         }
             54
             55         location /socket.io/ {
             56             proxy_pass http://localhost:5000/socket.io/;
             57             proxy_buffering off;
             58             proxy_http_version 1.1;
             59             proxy_set_header Upgrade $http_upgrade;
             60             proxy_set_header Connection "upgrade";
             61         }
             62
             63         location /guacamole/ {
             64             proxy_pass http://localhost:8081/;
             65             proxy_buffering off;
             66             proxy_http_version 1.1;
             67             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             68             proxy_set_header Upgrade $http_upgrade;
             69             proxy_set_header Connection $http_connection;
             70             access_log off;
             71         }
             72
             73         location / {
             74             proxy_pass http://localhost:8080;
             75         }
             76

             77     }

    # 启动

        systemctl start nginx

        systemctl enable nginx

    # 开始使用Jumpserver

        # 检查应用是否都正常运行,如果没有,请 重新运行

        cd /opt/jumpserver/

        ./jms status

        cd /opt/coco/

        ./cocod status

        docker ps

    # 服务全部运行后,访问:http://192.168.10.15;8080  (默认用户名和密码,admin,admin)

    # 如果部署的过程中没有接收到应用的注册申请,需要到Jumpserver的会话管理-终端管理去接接受coco,guacamole等应用的注册。

    # 连接测试

        如果登录客户端是Linux,登录语法如下:
        ssh -p2222 [email protected]
        sftp -P2222 [email protected]
        密码: admin

        如果登录客户端是Windows、Xshell Terminal,登录语法如下:
        ssh [email protected] 2222
        sftp [email protected] 2222
        密码: admin

        如果能登陆代表部署成功
        # sftp默认上传的位置在资产的/tmp目录下

参考文档:

http://docs.jumpserver.org/zh/docs/step_by_step.html

猜你喜欢

转载自blog.csdn.net/qq_34889607/article/details/80448035