美文网首页linux运维专辑
Access linux/win server with a w

Access linux/win server with a w

作者: Edsion_H | 来源:发表于2020-11-11 10:22 被阅读0次

    一. Guacamole介绍

    Guacamole是一个提供了基于HTML5 web应用程序的远程桌面代理服务器。通过使用Guacamole服务器,我们很轻松的在浏览器上远程访问Guacamole代理的主机。支持ssh、rdp、vnc等协议。

    我们可以在浏览器访问Guacamole页面的时候,此时,浏览器会通过HTTP使用Guacamole协议与Guacamole 服务器中的Web服务器进行连接。Guacamole Web应用会从用户的请求中读取Guacamole协议,并将其转发给guacd(本地Guacamole代理)。Guacd根据web 应用转发过来的Guacamole协议来代替用户连接到远程桌面服务器。在Guacamole Web应用与guacd进行通信的时候,两者均不需要知道实际使用的远程桌面协议是什么,即协议不可知性。

    在Guacamole的组成中主要包含如下三部分:

    Guacamole协议是用于远程显示和事件传输的协议,不实现特定的桌面环境支持,实现了现有远程桌面的超集。guacd是Guacamole的核心,guacd也不了解任何具体的远程桌面协议,而是实现了通过web应用转发的Guacamole协议来确定哪些协议需要加载,哪些参数必须传递给它。web应用程序是Guacamole与用户进行交互的部分。Apache提供了基于Java的编写的Web应用程序,但是这并不代表Guacamole 只支持Java。Guacamole是一个API。

    image.png

    二. CentOS6安装guacamole

    • 关闭seliux
    
    sed -i 's/SELINUX=enforcing/SELINUX=disabled'  /etc/sysconfig/selinux
    
    setenforce 0
    
    
    • 安装编译环境
    
    yum -y groupinstall "Development Tools" 
    
    
    • 安装guacamole 依赖
    
    yum install -y cairo-devel libjpeg-turbo-devel libpng-devel uuid-devel ffmpeg-devel freerdp-devel pango-devel libssh2-devel libtelnet-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel 
    
    
    • 安装ffmpeg
    
    rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm
    
    yum -y install ffmpeg-devel 
    
    
    • 安装freerdp-devel
    
    yum -y install freerdp-devel
    
    
    • 编译安装guacd
    
    安装路径: /usr/local/guacamole
    
    wget http://archive.apache.org/dist/guacamole/1.0.0/source/guacamole-server-1.0.0.tar.gz
    
    tar -zxvf guacamole-server-1.0.0.tar.gz
    
    cd guacamole-server-1.0.0
    
    ./configure --with-init-dir=/etc/init.d --disable-guacenc --prefix=/usr/local/guacamole
    
    make && make install
    
    ldconfig
    
    /etc/init.d/guacd start
    
    chkconfig guacd on
    
    
    • 为guacmole配置环境变量
    
    vim /etc/profile(尾部) 
    
    export GUACAMOLE_HOME=/etc/guacamole
    
    source /etc/profile
    
    echo $GUACAMOLE_HOME
    
    
    • 配置guacamole
    
    mkdir -p /etc/guacamole/{extensions,lib,sqlauth}
    
    vi /etc/guacamole/guacamole.properties
    
    ####guacamole.properties####
    
    guacd-hostname: localhost
    
    guacd-port:     4822
    
    # user-mapping: /etc/guacamole/user-mapping.xml
    
    # MySQL properties
    
    mysql-hostname: localhost
    
    mysql-port: 3306
    
    mysql-database: guacamole_db
    
    mysql-username: guacamole
    
    mysql-password: guacamole
    
    ####guacamole.properties####
    
    
    • 开启guacamole debug 日志
    
    vi /etc/guacamole/logback.xml
    
    <configuration>
    
        <!-- Appender for debugging -->
    
        <appender name="GUAC-DEBUG" class="ch.qos.logback.core.ConsoleAppender">
    
            <encoder>
    
                <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
    
            </encoder>
    
        </appender>
    
        <!-- Log at DEBUG level -->
    
        <root level="debug">
    
            <appender-ref ref="GUAC-DEBUG"/>
    
        </root>
    
    </configuration>
    
    
    • guacmole安装数据库扩展驱动
    
    cd /etc/guacamole/sqlauth
    
    wget https://mirrors.tuna.tsinghua.edu.cn/apache/guacamole/1.0.0/binary/guacamole-auth-jdbc-1.0.0.tar.gz
    
    tar -zxvf guacamole-auth-jdbc-1.0.0.tar.gz
    
    cp guacamole-auth-jdbc-1.0.0/mysql/guacamole-auth-jdbc-mysql-1.0.0.jar /etc/guacamole/extensions/
    
    wget http://ftp.ntu.edu.tw/MySQL/Downloads/Connector-J/mysql-connector-java-5.1.48.tar.gz
    
    tar -xzvf mysql-connector-java-5.1.48.tar.gz
    
    cp mysql-connector-java-5.1.48/mysql-connector-java-5.1.48-bin.jar /etc/guacamole/lib/
    
    
    • 安装jdk,配置java 环境变量
    
    jdk1.8安装路径: /usr/local/jdk
    
    vi /etc/profile (尾部)
    
    export JAVA_HOME=/usr/local/jdk
    
    export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
    
    export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
    
    source /etc/profile
    
    
    • 创建数据库
    
    mysql -uroot -p
    
    mysql> CREATE DATABASE guacamole_db;
    
    mysql> CREATE USER 'guacamole'@'localhost' IDENTIFIED BY 'guacamole';
    
    mysql> CREATE USER 'guacamole'@'127.0.0.1' IDENTIFIED BY 'guacamole';
    
    mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole'@'localhost';
    
    mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON guacamole_db.* TO 'guacamole'@'127.0.0.1';
    
    mysql> FLUSH PRIVILEGES;
    
    mysql> quit
    
    cat /etc/guacamole/sqlauth/guacamole-auth-jdbc-1.0.0/mysql/schema/*.sql | mysql -uroot -p{密码} guacamole_db
    
    
    • 安装tomcat8

    安装路径: /usr/local/tomcat

    • 配置 tomcat 启动脚本
    
    vim /etc/init.d/tomcat
    
    #!/bin/sh
    
    # 
    
    # tomcat startup script for the Tomcat server 
    
    # 
    
    # chkconfig: 345 80 20 
    
    # description: start the tomcat deamon 
    
    # 
    
    # Source function library 
    
    . /etc/rc.d/init.d/functions 
    
    prog=tomcat
    
    export JAVA_HOME=/usr/local/jdk
    
    export CATALANA_HOME=/usr/local/tomcat
    
    case "$1" in 
    
    start) 
    
      echo "Starting Tomcat..." 
    
      $CATALANA_HOME/bin/startup.sh 
    
      ;; 
    
    stop) 
    
      echo "Stopping Tomcat..." 
    
      $CATALANA_HOME/bin/shutdown.sh 
    
      ;; 
    
    restart) 
    
      echo "Stopping Tomcat..." 
    
      $CATALANA_HOME/bin/shutdown.sh 
    
      sleep 3
    
      echo 
    
      echo "Starting Tomcat..." 
    
      $CATALANA_HOME/bin/startup.sh 
    
      ;; 
    
    *) 
    
      echo "Usage: $prog {start|stop|restart}" 
    
      ;; 
    
    esac 
    
    exit 0
    
    
    • tomcat服务启停
    
    #脚本授权
    
    chmod 755 /etc/init.d/tomcat
    
    #启动服务 
    
    /etc/init.d/tomcat start  
    
    #关闭服务   
    
    /etc/init.d/tomcat stop   
    
    #开机启动   
    
    chkconfig tomcat on 
    
    
    • 部署官方编译完的war包
    
    wget https://mirrors.tuna.tsinghua.edu.cn/apache/guacamole/1.0.0/binary/guacamole-1.0.0.war
    
    cp guacamole-1.0.0.war /usr/local/tomcat/webapps/guacamole.war
    
    
    • 重启 tomcat 访问 默认账号"guacadmin"密码 "guacadmin"

    http://IP:8080/guacamole-1.0.0/

    • 字体设置
    
    mkdir -p /usr/share/fonts/chinese
    
    # 例如:将windows系统中的 simhei.ttf(黑体) 与 simsun.ttc(宋体) 拷贝至此文件夹
    
    ttmkfdir -e /usr/share/X11/fonts/encodings/encodings.dir
    
    fc-cache
    
    fc-list
    
    
    • 文档

    连接参数

    api文档

    相关文章

      网友评论

        本文标题:Access linux/win server with a w

        本文链接:https://www.haomeiwen.com/subject/mzcebktx.html