1. 程式人生 > >rhel6.4部署gateone

rhel6.4部署gateone

c語言 編譯器 ssh python gateone



檢查python版本

[[email protected] gateone]# python -V
Python 2.6.6


獲取pip並安裝

[[email protected] gateone]# wget --no-check-certificate https://bootstrap.pypa.io/get-pip.py
[[email protected] gateone]# python get-pip.py


安裝tornado

[[email protected] gateone]# pip install tornado
[[email protected]
/* */ gateone]# python -c "import tornado; print(tornado.version)" 4.5.1


到git官網下載git

https://www.kernel.org/pub/software/scm/git/


上傳到服務器,解壓到當前目錄

[[email protected] ~]# ls git*
git-2.9.1.tar.gz
[[email protected] ~]# tar -zxvf git-2.9.1.tar.gz


編譯時出錯,提示沒有c語言編譯器

[[email protected] git-2.9.1]# ./configure
configure: Setting lib to ‘lib‘ (the default)
configure: Will try -pthread then -lpthread to enable POSIX Threads.
configure: CHECKS for site configuration
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/root/git-2.9.1‘:
configure: error: no acceptable C compiler found in $PATH
See `config.log‘ for more details


先安裝gcc,把系統盤掛載上,在裏面找安裝包

[[email protected] mnt]# mkdir /mnt/cdrom
[[email protected] mnt]# mount -t iso9660 /dev/cdrom /mnt/cdrom
mount: block device /dev/sr0 is write-protected, mounting read-only
[[email protected] mnt]# cd /mnt/cdrom/
[[email protected] cdrom]# ls
EFI      EULA_pt           README                    RELEASE-NOTES-it-IT.html  RELEASE-NOTES-ru-RU.html  RPM-GPG-KEY-redhat-release
EULA     EULA_zh           RELEASE-NOTES-as-IN.html  RELEASE-NOTES-ja-JP.html  RELEASE-NOTES-si-LK.html  ScalableFileSystem
EULA_de  GPL               RELEASE-NOTES-bn-IN.html  RELEASE-NOTES-kn-IN.html  RELEASE-NOTES-ta-IN.html  Server
EULA_en  HighAvailability  RELEASE-NOTES-de-DE.html  RELEASE-NOTES-ko-KR.html  RELEASE-NOTES-te-IN.html  TRANS.TBL
EULA_es  images            RELEASE-NOTES-en-US.html  RELEASE-NOTES-ml-IN.html  RELEASE-NOTES-zh-CN.html
EULA_fr  isolinux          RELEASE-NOTES-es-ES.html  RELEASE-NOTES-mr-IN.html  RELEASE-NOTES-zh-TW.html
EULA_it  LoadBalancer      RELEASE-NOTES-fr-FR.html  RELEASE-NOTES-or-IN.html  repodata
EULA_ja  media.repo        RELEASE-NOTES-gu-IN.html  RELEASE-NOTES-pa-IN.html  ResilientStorage
EULA_ko  Packages          RELEASE-NOTES-hi-IN.html  RELEASE-NOTES-pt-BR.html  RPM-GPG-KEY-redhat-beta


依次安裝

[[email protected] Packages]# rpm -ivh glibc-common-2.12-1.107.el6.x86_64.rpm      
[[email protected] Packages]# rpm -ivh kernel-headers-2.6.32-358.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh libgcc-4.4.7-3.el6.x86_64.rpm       
[[email protected] Packages]# rpm -ivh glibc-2.12-1.107.el6.x86_64.rpm       
[[email protected] Packages]# rpm -ivh libgomp-4.4.7-3.el6.x86_64.rpm        
[[email protected] Packages]# rpm -ivh nscd-2.12-1.107.el6.x86_64.rpm
[[email protected] Packages]# rpm -ivh glibc-headers-2.12-1.107.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh glibc-devel-2.12-1.107.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh mpfr-2.4.1-6.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh ppl-0.10.2-11.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh cloog-ppl-0.15.7-1.2.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh cpp-4.4.7-3.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh gcc-4.4.7-3.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh libstdc++-4.4.7-3.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh libstdc++-devel-4.4.7-3.el6.x86_64.rpm 
[[email protected] Packages]# which gcc
/usr/bin/gcc
[[email protected] Packages]# rpm -q gcc
gcc-4.4.7-3.el6.x86_64


重新編譯安裝git

[[email protected] ~]# cd git-2.9.1    
[[email protected] git-2.9.1]# ./configure 
configure: Setting lib to ‘lib‘ (the default)
configure: Will try -pthread then -lpthread to enable POSIX Threads.
configure: CHECKS for site configuration
checking for gcc... gcc
checking whether the C compiler works... yes
......


make時又報錯,原因:缺少zlib頭文件,開發包沒安裝

In file included from credential-store.c:1:
cache.h:21:18: warning: zlib.h: No such file or directory
In file included from credential-store.c:1:
cache.h:23: error: expected specifier-qualifier-list before ‘z_stream’
make: *** [credential-store.o] Error 1


解決方法(依然掛載系統盤,找到下面2個安裝包安裝):

[[email protected] Packages]# rpm -ivh zlib-1.2.3-29.el6.x86_64.rpm 
[[email protected] Packages]# rpm -ivh zlib-devel-1.2.3-29.el6.x86_64.rpm


重新make成功

[[email protected] git-2.9.1]# make
    GEN config.status
/bin/sh: autoconf: command not found
    CC credential-store.o
    * new link flags
    CC abspath.o
    CC advice.o
    CC alias.o
    CC alloc.o
    ......
    GEN bin-wrappers/test-urlmatch-normalization
    GEN bin-wrappers/test-wildmatch
    GEN git-remote-testgit
[[email protected] git-2.9.1]# sudo make install


git安裝成功

[[email protected] ~]# git --version
git version 2.9.1


下面獲取gateone源碼進行安裝,報錯,因為git環境沒有安裝完全

[[email protected] ~]# git clone https://github.com/liftoff/GateOne.git
正克隆到 ‘GateOne‘...
fatal: Unable to find remote helper for ‘https‘

解決方法,暫時用git代替https:

[[email protected] ~]# git clone git://github.com/liftoff/GateOne.git
[[email protected] ~]# cd GateOne


發現這個包執行不下去報錯原因沒找到,我到

https://github.com/downloads/liftoff/GateOne/gateone-1.1-1.noarch.rpm

重新下了個包

[[email protected] ~]# tar -zxvf gateone-1.1-1.noarch.rpm
[[email protected] ~]# cd gateone



報錯,原因tornado版本不對:

[[email protected] gateone]# ./gateone.py 
Traceback (most recent call last):
  File "./gateone.py", line 289, in <module>
    tornado.options.enable_pretty_logging()
AttributeError: ‘module‘ object has no attribute ‘enable_pretty_logging‘
[[email protected] gateone]# python -c "import tornado; print(tornado.version)"
4.4.1


解決方法,安裝2.4版本的tornado:

[[email protected] ~]wget https://pypi.python.org/packages/2d/9a/38e855094bd11cba89cd2a50a54c31019ef4a45785fe12be6aa9a7c633de/tornado-2.4.tar.gz
[[email protected] ~]# tar zxvf tornado-2.4.tar.gz
[[email protected] ~]# cd tornado-2.4
[[email protected] tornado-2.4]# python  setup.py build
[[email protected] tornado-2.4]# python2 setup.py install
[[email protected] tornado-2.4]# python -c "import tornado; print(tornado.version)"
2.4


啟動成功:

[[email protected] gateone]# ./gateone.py 
[I 170518 19:43:11 gateone:2748] /opt/gateone/server.conf not found or missing cookie_secret.  A new one will be generated.
[W 170518 19:43:11 gateone:2893] dtach command not found.  dtach support has been disabled.
[I 170518 19:43:11 gateone:2917] Connections to this server will be allowed from the following origins: ‘http://localhost https://localhost http://127.0.0.1 https://127.0.0.1‘
[I 170518 19:43:11 gateone:2957] No SSL private key found.  One will be generated.
[I 170518 19:43:13 gateone:2307] No authentication method configured. All users will be ANONYMOUS
[I 170518 19:43:13 gateone:2404] Loaded plugins: bookmarks, convenience, example, help, logging, logging_plugin, mobile, notice, playback, ssh
[I 170518 19:43:13 gateone:3054] Listening on 
[I  170518  19:43:13  gateone:3060]  Process running with pid 2630


發現用WAN的ip訪問不了,Ctrl+C,編輯配置文件,修改允許訪問的IP地址,以‘;’隔開

[[email protected] gateone]# vim server.conf


origins = "http://localhost;https://localhost;http://127.0.0.1;https://127.0.0.1;https://192.168.20.128;https://192.168.10.10"


重新啟動gateone

[[email protected] gateone]# ./gateone.py 
[W 170518 19:57:01 gateone:2893] dtach command not found.  dtach support has been disabled.
[I 170518 19:57:01 gateone:2917] Connections to this server will be allowed from the following origins: ‘http://localhost https://localhost http://127.0.0.1 https://127.0.0.1 https://192.168.20.128 https://192.168.10.10‘
[I 170518 19:57:01 gateone:2307] No authentication method configured. All users will be ANONYMOUS
[I 170518 19:57:01 gateone:2404] Loaded plugins: bookmarks, convenience, example, help, logging, logging_plugin, mobile, notice, playback, ssh
[I 170518 19:57:01 gateone:3054] Listening on https://*:443/
[I 170518 19:57:01 gateone:3060] Process running with pid 2630


瀏覽器連接成功:

技術分享

[[email protected] gateone]# ./gateone.py 
[W 170518 19:57:01 gateone:2893] dtach command not found.  dtach support has been disabled.
[I 170518 19:57:01 gateone:2917] Connections to this server will be allowed from the following origins: ‘http://localhost https://localhost http://127.0.0.1 https://127.0.0.1 https://192.168.20.128 https://192.168.10.10‘
[I 170518 19:57:01 gateone:2307] No authentication method configured. All users will be ANONYMOUS
[I 170518 19:57:01 gateone:2404] Loaded plugins: bookmarks, convenience, example, help, logging, logging_plugin, mobile, notice, playback, ssh
[I 170518 19:57:01 gateone:3054] Listening on https://*:443/
[I 170518 19:57:01 gateone:3060] Process running with pid 2630
[I 170518 19:57:11 web:1462] 302 GET / (192.168.10.1) 1.16ms
[I 170518 19:57:11 auth:181] Creating user directory: /opt/gateone/users/ANONYMOUS
[I 170518 19:57:11 web:1462] 302 GET /auth?next=%2F (192.168.10.1) 4.19ms
[I 170518 19:57:11 web:1462] 200 GET / (192.168.10.1) 31.56ms
[I 170518 19:57:11 web:1462] 200 GET /static/gateone.css (192.168.10.1) 55.38ms
[I 170518 19:57:11 web:1462] 200 GET /static/gateone.js (192.168.10.1) 53.57ms
[I 170518 19:57:11 web:1462] 200 GET /combined_js (192.168.10.1) 58.23ms
[I 170518 19:57:11 web:1462] 200 GET /static/favicon.ico (192.168.10.1) 1.53ms
[I 170518 19:57:11 web:1462] 200 GET /auth?check=True (192.168.10.1) 2.47ms
[I 170518 19:57:11 gateone:1063] WebSocket opened (ANONYMOUS).
[I 170518 19:57:12 web:1462] 200 GET /static/bookmarks/images/star.svg (192.168.10.1) 5.14ms
[I 170518 19:57:12 web:1462] 200 GET /static/ubuntumono-normal.woff (192.168.10.1) 8.31ms


一旦Ctrl+c就不能連接登錄了,所以我們需要後臺運行,啟動gateone的服務,並且開機啟動

[[email protected] gateone]# service gateone start
Starting Gate One:                                         [確定]
[[email protected] gateone]# chkconfig gateone on


至此簡單的gateone部署完成

本文出自 “謝育政” 博客,請務必保留此出處http://kurol.blog.51cto.com/11433546/1927303

rhel6.4部署gateone