小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

test

 印度阿三17 2019-02-24

環(huá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

?

一、準備?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)境

因為?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

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

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

?

二、安裝?Jumpserver 1.0.0

1、下載或 Clone 項目

項目提交較多?git clone?時較大,你可以選擇去?Github?項目頁面直接下載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) ?#?如果沒有任何報錯請繼續(xù)

?

3、安裝 Python 庫依賴

(py3) [root@centos7-1 requirements]# pip install -r requirements.txt ?# 不要指定-i參數(shù),因為鏡像上可能沒有最新的包,如果沒有任何報錯請繼續(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ù)庫,如果不使用 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ù)庫 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 ??#?我們計劃修改?DevelopmentConfig中的配置,因為默認jumpserver是使用該配置,它繼承自Config

class DevelopmentConfig(Config):    #找到這一段,進行下面的配置
    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ù)庫表結(jié)構(gòu)和初始化數(shù)據(jù)

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

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

成功如下圖:

?

9、運行 Jumpserver

(1)老版本啟動方法

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

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

?(2)新版本啟動方法

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

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

?

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

注意:

① 第一次運行時可能報錯,(這里只是 Jumpserver, 沒有 Web Terminal,所以訪問 Web Terminal 會報錯)

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

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

賬號: admin 密碼: admin

③ 登錄成功

?

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

1、下載或 Clone 項目

新開一個終端,連接測試機,別忘了 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、查看配置文件并運行

(1)運行

(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? ?# 后臺運行使用 -d 參數(shù)./cocod start -d

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

?

(2)這時需要去 Jumpserver 管理后臺-會話管理-終端管理(http://192.168.10.101:8080/terminal/terminal/)接受 Coco 的注冊

?

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

?

4、測試連接

(1)linux 連接

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

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

$ssh admin@192.168.244.144 2222

密碼: admin

如果能登陸代表部署成功

(3)登錄成功如下圖:

?

四、安裝?Web Terminal 前端: Luna

1、下載 Luna

Luna 已改為純前端,需要 Nginx 來運行訪問

訪問(https://github.com/jumpserver/luna/releases)下載對應版本的 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),可以直接跳過這一步)

因為手動安裝 guacamole 組件比較復雜,這里提供打包好的 docker 使用, 啟動 guacamole

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

① 安裝依賴
[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

③ 國內(nèi)部分用戶可能無法連接docker官網(wǎng)提供的源,這里提供阿里云的鏡像節(jié)點供測試使用
[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

④ 啟動docker
[root@centos7-1 ~]# systemctl start docker
[root@centos7-1 ~]# systemctl status docker

?

2、啟動 Guacamole

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

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

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

② 執(zhí)行過程截圖

?

3、在jumpserver 接受注冊

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

?

六、配置?Nginx 整合各組件

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

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

(1)安裝前準備

① 下載版本包,我以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/ ???# 完成

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

--user=nginx

#指定運行的權(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、準備配置文件

[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、運行 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

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

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多