日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

test

 印度阿三17 2019-02-24

環(huán)境準(zhǔn)備

  • 系統(tǒng):CentOS 7
  • IP:192.168.10.101
  • 關(guān)閉selinux 和防火墻
# CentOS 7
$ setenforce 0  # 可以設(shè)置配置文件永久關(guān)閉
$ systemctl stop iptables.service
$ systemctl stop firewalld.service

# CentOS6
$ setenforce 0
$ service iptables stop

?

一、準(zhǔn)備?Python3 和 Python 虛擬環(huán)境

1、安裝依賴包

[root@centos7-1 opt]# yum -y install wget sqlite-devel xz gcc automake zlib-devel openssl-devel epel-release git

?

2、編譯安裝

[root@centos7-1 opt]# wget https://www./ftp/python/3.6.1/Python-3.6.1.tar.xz

[root@centos7-1 opt]# tar xvf Python-3.6.1.tar.xz ?&& cd Python-3.6.1

[root@centos7-1 opt]# ./configure && make && make install

?

3、建立 Python 虛擬環(huán)境

因?yàn)?CentOS 6/7?自帶的是?Python2,而?Yum?等工具依賴原來的?Python,為了不擾亂原來的環(huán)境我們來使用?Python?虛擬環(huán)境

[root@centos7-1 opt]# cd /opt

[root@centos7-1 opt]# python3 -m venv py3

[root@centos7-1 opt]# source /opt/py3/bin/activate

注:看到下面的提示符代表成功,以后運(yùn)行 Jumpserver 都要先運(yùn)行以上 source 命令,以下所有命令均在該虛擬環(huán)境中運(yùn)行

(py3) [root@centos7-1 opt]#

?

二、安裝?Jumpserver 1.0.0

1、下載或 Clone 項(xiàng)目

項(xiàng)目提交較多?git clone?時(shí)較大,你可以選擇去?Github?項(xiàng)目頁(yè)面直接下載zip包。

(py3) [root@centos7-1 opt]# cd /opt/

(py3) [root@centos7-1 opt]# git clone --depth=1 https://github.com/jumpserver/jumpserver.git && cd jumpserver && git checkout master

?

2、安裝依賴 RPM 包

(py3) [root@centos7-1 jumpserver]# cd /opt/jumpserver/requirements

(py3) [root@centos7-1 jumpserver]# yum -y install $(cat rpm_requirements.txt) ?#?如果沒有任何報(bào)錯(cuò)請(qǐng)繼續(xù)

?

3、安裝 Python 庫(kù)依賴

(py3) [root@centos7-1 requirements]# pip install -r requirements.txt ?# 不要指定-i參數(shù),因?yàn)殓R像上可能沒有最新的包,如果沒有任何報(bào)錯(cuò)請(qǐng)繼續(xù)

成功如下圖:

?

4、安裝 Redis, Jumpserver 使用 Redis 做 cache 和 celery broke

(py3) [root@centos7-1 requirements]# yum -y install redis

(py3) [root@centos7-1 requirements]# systemctl start redis

?

5、安裝 MySQL

本教程使用 Mysql 作為數(shù)據(jù)庫(kù),如果不使用 Mysql 可以跳過相關(guān) Mysql 安裝和配置

(1)# centos7

(py3) [root@centos7-1 requirements]# yum -y install mariadb mariadb-devel mariadb-server ?# centos7下安裝的是mariadb

(py3) [root@centos7-1 requirements]# systemctl start mariadb.service

(2)# centos6

$ yum -y install mysql mysql-devel mysql-server

$ service mysqld start

?

6、創(chuàng)建數(shù)據(jù)庫(kù) Jumpserver 并授權(quán)

(py3) [root@centos7-1 requirements]# mysql

MariaDB [(none)]> ?create database jumpserver default charset 'utf8';

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> ?grant all on jumpserver.* to 'jumpserver'@'127.0.0.1' identified by 'along';

Query OK, 0 rows affected (0.00 sec)

?

7、修改 Jumpserver 配置文件

(py3) [root@centos7-1 requirements]# cd /opt/jumpserver

(py3) [root@centos7-1 jumpserver]# cp config_example.py config.py

(py3) [root@centos7-1 jumpserver]# vim config.py ??#?我們計(jì)劃修改?DevelopmentConfig中的配置,因?yàn)槟J(rèn)jumpserver是使用該配置,它繼承自Config

class DevelopmentConfig(Config):    #找到這一段,進(jìn)行下面的配置
    DEBUG = True
    DB_ENGINE = 'mysql'
    DB_HOST = '127.0.0.1'
    DB_PORT = 3306
    DB_USER = 'jumpserver'
    DB_PASSWORD = 'along'
    DB_NAME = 'jumpserver'

注意:?配置文件是?Python?格式,不要用?TAB,而要用空格

?

8、生成數(shù)據(jù)庫(kù)表結(jié)構(gòu)和初始化數(shù)據(jù)

(py3) [root@centos7-1 jumpserver]#?cd /opt/jumpserver/utils

(py3) [root@centos7-1 utils]#?bash make_migrations.sh

成功如下圖:

?

9、運(yùn)行 Jumpserver

(1)老版本啟動(dòng)方法

(py3) [root@centos7-1?utils]# cd /opt/jumpserver

(py3) [root@centos7-1?jumpserver]# python run_server.py all

?(2)新版本啟動(dòng)方法

(py3) [root@centos7-1?jumpserver]# ./jms start all? ? ?# 后臺(tái)運(yùn)行使用-d 如:參數(shù)./jms start all -d

# 新版本更新了運(yùn)行腳本,使用方式./jms start|stop|status|restart all 后臺(tái)運(yùn)行請(qǐng)?zhí)砑?-d 參數(shù)

?

10、瀏覽器訪問http://192.168.10.101:8080/

注意:

① 第一次運(yùn)行時(shí)可能報(bào)錯(cuò),(這里只是 Jumpserver, 沒有 Web Terminal,所以訪問 Web Terminal 會(huì)報(bào)錯(cuò))

② 終止程序,再次執(zhí)行,就可以登錄了

(py3) [root@centos7-1?jumpserver]# ./jms start all?

賬號(hào): admin 密碼: admin

③ 登錄成功

?

三、安裝?SSH Server 和 WebSocket Server: Coco

1、下載或 Clone 項(xiàng)目

新開一個(gè)終端,連接測(cè)試機(jī),別忘了 source /opt/py3/bin/activate

[root@centos7-1 ~]# source /opt/py3/bin/activate

(py3) [root@centos7-1 ~]# cd /opt/

(py3) [root@centos7-1 opt]# git clone https://github.com/jumpserver/coco.git && cd coco && git checkout master

?

2、安裝依賴

(py3) [root@centos7-1 coco]# cd /opt/coco/requirements

(py3) [root@centos7-1 requirements]# yum -y ?install $(cat rpm_requirements.txt)

(py3) [root@centos7-1 requirements]# pip install -r requirements.txt

成功如下圖:

?

3、查看配置文件并運(yùn)行

(1)運(yùn)行

(py3) [root@centos7-1 requirements]# cd /opt/coco

(py3) [root@centos7-1 coco]# cp conf_example.py conf.py

(py3) [root@centos7-1 coco]#?./cocod start? ?# 后臺(tái)運(yùn)行使用 -d 參數(shù)./cocod start -d

# 新版本更新了運(yùn)行腳本,使用方式./cocod start|stop|status|restart 后臺(tái)運(yùn)行請(qǐng)?zhí)砑?-d 參數(shù)

?

(2)這時(shí)需要去 Jumpserver 管理后臺(tái)-會(huì)話管理-終端管理(http://192.168.10.101:8080/terminal/terminal/)接受 Coco 的注冊(cè)

?

(3)命令行終端顯示連接成功

?

4、測(cè)試連接

(1)linux 連接

[root@centos7-1 ~]# ssh -p2222 admin@192.168.10.101 ??#新開一個(gè)終端去連接密碼: admin

(2)如果是用在 Windows 下,Xshell Terminal 登錄語(yǔ)法如下

$ssh admin@192.168.244.144 2222

密碼: admin

如果能登陸代表部署成功

(3)登錄成功如下圖:

?

四、安裝?Web Terminal 前端: Luna

1、下載 Luna

Luna 已改為純前端,需要 Nginx 來運(yùn)行訪問

訪問(https://github.com/jumpserver/luna/releases)下載對(duì)應(yīng)版本的 release 包,直接解壓,不需要編譯

[root@centos7-1 ~]# cd /opt/

[root@centos7-1 opt]# wget https://github.com/jumpserver/luna/releases/download/v1.0.0/luna.tar.gz

?

2、解壓 Luna

[root@centos7-1 opt]# tar xvf luna.tar.gz

[root@centos7-1 opt]# ls /opt/luna

?

五、安裝?Windows 支持組件(如果不需要管理 windows 資產(chǎn),可以直接跳過這一步)

因?yàn)槭謩?dòng)安裝 guacamole 組件比較復(fù)雜,這里提供打包好的 docker 使用, 啟動(dòng) guacamole

1、Docker安裝 (僅針對(duì)CentOS7,CentOS6,安裝Docker相對(duì)比較復(fù)雜)

① 安裝依賴
[root@centos7-1 ~]# yum remove docker-latest-logrotate  docker-logrotate  docker-selinux dockdocker-engine
[root@centos7-1 ~]# yum install -y yum-utils  device-mapper-persistent-data   lvm2

② 安裝docker
添加docker官方源
[root@centos7-1 ~]# yum-config-manager --add-repo https://download./linux/centos/docker-ce.repo
[root@centos7-1 ~]# yum makecache fast
[root@centos7-1 ~]# yum install docker-ce

③ 國(guó)內(nèi)部分用戶可能無法連接docker官網(wǎng)提供的源,這里提供阿里云的鏡像節(jié)點(diǎn)供測(cè)試使用
[root@centos7-1 ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@centos7-1 ~]# rpm --import http://mirrors.aliyun.com/docker-ce/linux/centos/gpg
[root@centos7-1 ~]# yum makecache fast
[root@centos7-1 ~]# yum -y install docker-ce

④ 啟動(dòng)docker
[root@centos7-1 ~]# systemctl start docker
[root@centos7-1 ~]# systemctl status docker

?

2、啟動(dòng) Guacamole

① 這里所需要注意的是 guacamole 暴露出來的端口是 8081,若與主機(jī)上其他端口沖突請(qǐng)自定義

修改 JUMPSERVER_SERVER 環(huán)境變量的配置,填上 Jumpserver 的內(nèi)網(wǎng)地址

# 注意:這里一定要改寫一下本機(jī)的IP地址, 否則會(huì)出錯(cuò), 帶寬有限, 下載時(shí)間可能有點(diǎn)長(zhǎng),可以喝杯咖啡,撩撩對(duì)面的妹子
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://<填寫本機(jī)的IP地址>:8080 registry.jumpserver.org/public/guacamole:1.0.0?

② 執(zhí)行過程截圖

?

3、在jumpserver 接受注冊(cè)

啟動(dòng)成功后去 Jumpserver 會(huì)話管理-終端管理(http://192.168.10.101:8080/terminal/terminal/)接受[Gua]開頭的一個(gè)注冊(cè),如果頁(yè)面顯示不正??梢缘炔渴鹜瓿珊笤偬幚?

?

六、配置?Nginx 整合各組件

1、安裝 Nginx 根據(jù)喜好選擇安裝方式和版本

nginx?官網(wǎng)https:///en/download.html

(1)安裝前準(zhǔn)備

① 下載版本包,我以nginx-1.12.2為例

[root@centos7-1 nginx]# wget -c https:///download/nginx-1.12.2.tar.gz

[root@centos7-1 nginx]# tar -xvf nginx-1.12.2.tar.gz

② 下載依賴包

[root@centos7-1 nginx]# yum?install gc gcc gcc-c pcre-devel zlib-devel openssl-devel

③ 創(chuàng)建nginx用戶、組

[root@centos7-1 nginx-1.12.2]# groupadd nginx

[root@centos7-1 nginx-1.12.2]# useradd -s /sbin/nologin -g nginx -M nginx

?

(2)編譯安裝

[root@centos7-1 nginx-1.12.2]# ./configure --user=nginx --group=nginx --prefix=/mnt/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module

[root@centos7-1 nginx-1.12.2]# make && make install

[root@centos7-1 nginx-1.12.2]# cd /mnt/nginx/ ???# 完成

注釋:#指定運(yùn)行權(quán)限的用戶

--user=nginx

#指定運(yùn)行的權(quán)限用戶組

--group=nginx

#指定安裝路徑

--prefix=/usr/local/nginx

#支持nginx狀態(tài)查詢

--with-http_stub_status_module

#開啟ssl支持

--with-http_ssl_module

#開啟GZIP功能

--with-http_gzip_static_module

?

(3)使systemctl 控制nginx 服務(wù)

[root@centos7-1 nginx]# vim /usr/lib/systemd/system/nginx.service

[Unit]
Description=nginx - high performance web server
Documentation=http:///en/docs/
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/mnt/nginx/logs/nginx.pid
ExecStartPre=/mnt/nginx/sbin/nginx -t -c /mnt/nginx/conf/nginx.conf
ExecStart=/mnt/nginx/sbin/nginx -c /mnt/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

?

2、準(zhǔn)備配置文件

[root@centos7-1 ~]# vim /mnt/nginx/conf/nginx.conf ??清除已有的server段

server {
    listen 80;

    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 /luna/ {
        try_files $uri / /index.html;
        alias /opt/luna/;
    }

    location /media/ {
        add_header Content-Encoding gzip;
        root /opt/jumpserver/data/;
    }

    location /static/ {
        root /opt/jumpserver/data/;
    }

    location /socket.io/ {
        proxy_pass       http://localhost:5000/socket.io/;
        proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    location /guacamole/ {
        proxy_pass       http://localhost:8081/;
        proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $http_connection;
        access_log off;
    }

    location / {
        proxy_pass http://localhost:8080;
    }
}

?

3、運(yùn)行 Nginx

[root@centos7-1 ~]# /mnt/nginx/sbin/nginx -t ??# 檢查配置文件

[root@centos7-1 ~]# service nginx start

?

4、訪問?http://192.168.10.101

?

來源:http://www./content-4-121751.html

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多