CentOS6下搭建最新jumpserver开源堡垒机(一)

一。准备Python3环境
1.1安装依赖包
$ yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release git
1.2编译安装
$ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
$ tar xvf Python-3.6.1.tar.xz && cd Python-3.6.1
$ ./configure && make && make install
1.3修改默认蟒蛇为python3
$ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tar.xz
$ tar xvf Python-3.6.1.tar.xz && cd Python-3.6.1
$ ./configure && make && make install
由于百胜餐饮是支持python2的,需要改百胜配置
查看python2的版本(我这里是python2.6的)
$ ls / usr / bin / python *

修改yum的配置文件第一行
$ vim / usr / bin / yum


二。安装Jumpserver
2.1下载jumpserer
$ cd / opt /
$ git clone --depth = 1 https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master
如果GIT中下不下来的话,可以去官网手动下https://github.com/jumpserver/jumpserver,然后上传解压

$ cd / opt
$ unzip jumpserver-master
$ mv jumpserver-master jumpserver 
$ cd jumpserver 
2.2安装依赖RPM包
$ cd / opt / jumpserver / requirements
$ yum -y install $(cat rpm_requirements.txt) 
2.3安装Python库依赖
$ pip install -r requirements.txt
2.4安装Redis,Jumpserver使用Redis做缓存和芹菜破碎
$ yum -y安装redis
$ /etc/init.d/redis start
2.5安装MySQL
$ yum -y安装mysql mysql-devel mysql-server
$ /etc/init.d/mysqld start
2.6创建数据库Jumpserver并授权
$ mysql
>创建数据库跳转服务器默认字符集'utf8';
>全部授予jumpserver。*跳转到'123456'标识的'localhost';
2.7修改Jumpserver配置文件
$ cd / opt / jumpserver
$ cp config_example.py config.py
$ vi config.py
##注意:配置文件是Python格式,不要用TAB,而要用空格
class DevelopmentConfig(Config):
    DEBUG = True
    DB_EN​​GINE ='mysql'
    DB_HOST ='localhost'
    DB_PORT = 3306
    DB_USER ='jumpserver'
    DB_PASSWORD ='123456'
    DB_NAME ='jumpserver'
2.8生成数据库表结构和初始化数据
$ cd / opt / jumpserver / utils
$ bash make_migrations.sh
2.9运行Jumpserver
$ cd / opt / jumpserver
$ ./jms start all#后台运行使用-d参数./jms start all -d
#新版本更新了运行脚本,使用方式./jms start | stop | status | restart所有后台运行请添加-d参数
浏览器访问http://10.0.0.63:8080/默认账号:admin密码:admin(本机ip地址为10.0.0.63)




三。安装SSH服务器和WebSocket服务器:Coco
3.1下载或Clone项目
$ git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master
同样如果下不下来可以去GitHub的网站下载的zip包解压
3.2安装依赖
$ cd / opt / coco / requirements
$ yum -y install $(cat rpm_requirements.txt)
$ pip install -r requirements.txt -i https://pypi.org/simple
3.3查看配置文件并运行
$ cd / opt / coco
$ cp conf_example.py conf.py#如果coco与jumpserver分开部署,请手动修改conf.py
$ ./cocod start#后台运行使用-d参数./cocod start -d
启动成功后去Jumpserver会话管理 - 终端管理接受coco的注册。
四。安装Web终端前端:Luna
4.1下载解压Luna
$ cd / opt
$ wget https://github.com/jumpserver/luna/releases/download/1.3.0/dist.tar.gz(下不下来的话手动去github上下)
$ tar xf dist.tar.gz
$ mv dist luna
五。配置Nginx整合各组件
6.1安装Nginx
$ yum -y安装nginx
6.2准备配置文件修改/etc/nginx/nginx.conf
内容如下:
$ vim /etc/nginx/nginx.conf
...省略
#把默认服务器配置块改成这样

服务器{
    听80;

    proxy_set_header X-Real-IP $ remote_addr;
    proxy_set_header主机$主机;
    proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;

    位置/卢纳/ {
        try_files $ uri / /index.html;
        别名/ opt / luna /;
    }

    location / media / {
        add_header内容编码gzip;
        root / opt / jumpserver / data /;
    }

    位置/静态/ {
        root / opt / jumpserver / data /;
    }

    位置/socket.io/ {
        proxy_pass http:// localhost:5000 / socket.io /; #如果coco安装在别的服务器上,请填写它的ip
        proxy_buffering关闭;
        proxy_http_version 1.1;
        proxy_set_header升级$ http_upgrade;
        proxy_set_header连接“升级”;
    }

    位置/鳄梨酱/ {
        proxy_pass http:// localhost:8081 /; #如果guacamole安装在别的服务器上,请填写它的ip
        proxy_buffering关闭;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
        proxy_set_header升级$ http_upgrade;
        proxy_set_header连接$ http_connection;
        access_log off;
    }

    位置 / {
        proxy_pass http:// localhost:8080; #如果jumpserver安装在别的服务器上,请填写它的ip
    }
}
...省略
6.3运行Nginx
$ nginx -t#确保配置没有问题,有问题请先解决
$ /etc/init.d/nginx start
6.4开始使用Jumpserver
$ cd / opt / jumpserver
$ ./jms status#确定jumpserver已经运行,如果没有运行请重新启动jumpserver

$ cd / opt / coco
$ ./cocod status#确定jumpserver已经运行,如果没有运行请重新启动coco
服务全部启动后,访问 http://10.0.0.63
默认账号:admin密码:admin
七名.web界面测试



有关jumpserver使用介绍请关注我的这篇博客






评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值