웹사이트 검색

Ubuntu 20.04 LTS에 웹 기반 Guacamole 원격 데스크톱 클라이언트를 설치하는 방법


이 튜토리얼은 다음 OS 버전에 대해 존재합니다.

  • Ubuntu 20.04(Focal Fossa)
  • Ubuntu 18.04(Bionic Beaver)

이 페이지에서

  1. 전제 조건
  2. 시작하기\n
  3. 필수 종속성 설치\n
  4. Tomcat 서버 설치
  5. 과카몰리 설치
  6. Guacamole 클라이언트 설치
  7. Guacomole 구성
  8. Guacamole 웹 인터페이스 액세스
  9. Guacamole용 Nginx 구성
  10. 결론

Guacamole은 웹 브라우저에서 Linux 및 Windows 시스템을 관리하는 데 사용되는 무료 오픈 소스 및 웹 기반 원격 데스크탑 제어판입니다. VNC, RDP, SSH 및 Kubernetes와 같은 표준 프로토콜을 지원하며 클라이언트 컴퓨터에 소프트웨어를 설치할 필요가 없습니다. 클립보드, SFTP를 통한 파일 전송을 지원하고 여러 원격 데스크톱 세션을 관리할 수 있습니다.

이 튜토리얼에서는 Ubuntu 20.04 서버에 Guacamole 원격 데스크톱 클라이언트를 설치하고 구성하는 방법을 보여줍니다.

전제 조건

  • 최소 2GB RAM으로 Ubuntu 20.04를 실행하는 서버.\n
  • 루트 암호는 서버에 구성됩니다.\n

시작하기

먼저 시스템을 최신 안정 버전으로 업데이트해야 합니다. 다음 명령을 사용하여 모든 시스템 패키지를 업데이트하면 됩니다.

apt-get update -y

시스템이 업데이트되면 시스템을 다시 시작하여 변경 사항을 적용하십시오.

필수 종속성 설치

먼저 소스에서 Guacamole을 컴파일하려면 서버에 일부 종속 항목을 설치해야 합니다. 다음 명령으로 모두 설치할 수 있습니다.

apt-get install make gcc g++ libcairo2-dev libjpeg-turbo8-dev libpng-dev libtool-bin libossp-uuid-dev libavcodec-dev libavutil-dev libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libvncserver-dev libtelnet-dev libssl-dev libvorbis-dev libwebp-dev -y

모든 종속성이 설치되면 다음 단계로 진행할 수 있습니다.

톰캣 서버 설치

Guacamole은 Tomcat을 사용하여 웹 브라우저를 통해 Guacamole 서버에 연결하는 사용자에게 Guacamole 클라이언트 콘텐츠를 제공합니다. 따라서 서버에 Tomcat 서버가 설치되어 있어야 합니다. 설치되어 있지 않은 경우 다음 명령으로 설치할 수 있습니다.

apt-get install tomcat9 tomcat9-admin tomcat9-common tomcat9-user -y

Tomcat 서버를 설치한 후 Tomcat 서비스를 시작하고 다음 명령을 사용하여 시스템 재부팅 시 시작되도록 활성화합니다.

systemctl start tomcat9
systemctl enable tomcat9

다음 명령을 사용하여 Tomcat 서비스의 상태를 확인할 수도 있습니다.

systemctl status tomcat9

다음과 같은 결과가 표시되어야 합니다.

? tomcat9.service - Apache Tomcat 9 Web Application Server
     Loaded: loaded (/lib/systemd/system/tomcat9.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2020-08-25 14:48:50 UTC; 29min ago
       Docs: https://tomcat.apache.org/tomcat-9.0-doc/index.html
    Process: 27982 ExecStartPre=/usr/libexec/tomcat9/tomcat-update-policy.sh (code=exited, status=0/SUCCESS)
   Main PID: 27990 (java)
      Tasks: 38 (limit: 4691)
     Memory: 241.5M
     CGroup: /system.slice/tomcat9.service
             ??27990 /usr/lib/jvm/default-java/bin/java -Djava.util.logging.config.file=/var/lib/tomcat9/conf/logging.properties -Djava.util.l>

완료되면 다음 단계로 진행할 수 있습니다.

과카몰리 설치

기본적으로 Guacamole 패키지는 Ubuntu 20.04 기본 리포지토리에서 사용할 수 없습니다. 따라서 소스에서 컴파일해야 합니다.

먼저 다음 명령을 사용하여 Apache 웹 사이트에서 최신 버전의 Guacamole을 다운로드합니다.

wget https://downloads.apache.org/guacamole/1.1.0/source/guacamole-server-1.1.0.tar.gz

다운로드가 완료되면 다음 명령을 사용하여 다운로드한 파일의 압축을 풉니다.

tar -xvzf guacamole-server-1.1.0.tar.gz

다음으로 디렉토리를 추출된 디렉토리로 변경하고 구성 스크립트를 실행하여 필요한 종속성이 누락되었는지 확인합니다.

cd guacamole-server-1.1.0
./configure --with-init-dir=/etc/init.d

모든 것이 정상이면 다음 출력이 표시됩니다.

     freerdp2 ............ yes
     pango ............... yes
     libavcodec .......... yes
     libavutil ........... yes
     libssh2 ............. yes
     libssl .............. yes
     libswscale .......... yes
     libtelnet ........... yes
     libVNCServer ........ yes
     libvorbis ........... yes
     libpulse ............ no
     libwebsockets ....... no
     libwebp ............. yes
     wsock32 ............. no

   Protocol support:

      Kubernetes .... no
      RDP ........... yes
      SSH ........... yes
      Telnet ........ yes
      VNC ........... yes

   Services / tools:

      guacd ...... yes
      guacenc .... yes
      guaclog .... yes

   FreeRDP plugins: /usr/lib/x86_64-linux-gnu/freerdp2
   Init scripts: /etc/init.d
   Systemd units: no

Type "make" to compile guacamole-server.

이제 다음 명령을 실행하여 Guacamole Server를 컴파일하고 설치합니다.

make
make install

그런 다음 다음 명령을 실행하여 설치된 라이브러리의 시스템 캐시를 업데이트합니다.

ldconfig

다음으로 다음 명령을 사용하여 Guacamole 서비스를 활성화하고 시작합니다.

systemctl enable guacd
systemctl start guacd

이제 다음 명령을 사용하여 Guacamole 서비스의 상태를 확인할 수 있습니다.

systemctl status guacd

다음과 같은 결과가 표시되어야 합니다.

? guacd.service - LSB: Guacamole proxy daemon
     Loaded: loaded (/etc/init.d/guacd; generated)
     Active: active (running) since Tue 2020-08-25 12:02:26 UTC; 4s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 27536 ExecStart=/etc/init.d/guacd start (code=exited, status=0/SUCCESS)
      Tasks: 1 (limit: 4691)
     Memory: 10.1M
     CGroup: /system.slice/guacd.service
             ??27555 /usr/local/sbin/guacd -p /var/run/guacd.pid

Aug 25 12:02:26 ubunt4 systemd[1]: Starting LSB: Guacamole proxy daemon...
Aug 25 12:02:26 ubunt4 guacd[27551]: Guacamole proxy daemon (guacd) version 1.1.0 started
Aug 25 12:02:26 ubunt4 guacd[27536]: Starting guacd:
Aug 25 12:02:26 ubunt4 guacd[27551]: Starting guacd:
Aug 25 12:02:26 ubunt4 guacd[27551]: uacd[27551]: INFO:        Guacamole proxy daemon (guacd) versio
Aug 25 12:02:26 ubunt4 systemd[1]: Started LSB: Guacamole proxy daemon.
Aug 25 12:02:26 ubunt4 guacd[27555]: Listening on host 127.0.0.1, port 4822
Aug 25 12:02:26 ubunt4 guacd[27536]: uacd[275

완료되면 다음 단계로 진행할 수 있습니다.

Guacamole 클라이언트 설치

다음으로 서버에 Guacamole 클라이언트를 설치해야 합니다. Guacamole 클라이언트는 Java로 작성되었으며 크로스 플랫폼입니다. 이것은 당신에게 제시될 최종 HTML5 애플리케이션을 구성할 것입니다.

먼저 다음 명령을 사용하여 Guacamole 바이너리를 다운로드합니다.

wget https://mirrors.estointernet.in/apache/guacamole/1.1.0/binary/guacamole-1.1.0.war

Guacamole 바이너리를 다운로드한 후 다음 명령을 사용하여 /etc/guacamole 디렉토리에 복사합니다.

mkdir /etc/guacamole
mv guacamole-1.1.0.war /etc/guacamole/guacamole.war

다음으로 다음 명령을 사용하여 과카몰리 클라이언트의 Tomcat webapps 디렉터리에 대한 심볼릭 링크를 생성합니다.

ln -s /etc/guacamole/guacamole.war /var/lib/tomcat9/webapps/

마지막으로 Tomcat 및 Guacamole 서비스를 다시 시작하여 새 웹 애플리케이션을 배포합니다.

systemctl restart tomcat9
systemctl restart guacd

완료되면 다음 단계로 진행할 수 있습니다.

구아코몰 구성

다음으로 Guacamole이 제대로 작동하려면 사용자와 연결을 구성해야 합니다.

먼저 guacamole.properties라는 Guacamole 기본 구성 파일을 만듭니다.

nano /etc/guacamole/guacamole.properties

다음 줄을 추가합니다.

guacd-hostname: localhost
guacd-port:    4822
user-mapping:    /etc/guacamole/user-mapping.xml

완료되면 파일을 저장하고 닫습니다.

다음으로 라이브러리 및 확장을 위한 디렉토리를 생성해야 합니다. 다음 명령으로 생성할 수 있습니다.

mkdir /etc/guacamole/{extensions,lib}

다음으로 과카몰리 홈 디렉토리 환경 변수를 설정하고 /etc/default/tomcat9 구성 파일에 추가합니다.

echo "GUACAMOLE_HOME=/etc/guacamole" >> /etc/default/tomcat9

다음으로 Guacamole 웹 UI에 액세스할 수 있는 사용자를 정의하기 위해 user-mapping.xml이라는 파일을 생성해야 합니다.

만들기 전에 다음 명령을 사용하여 암호에 대한 md5 해시를 생성합니다.

echo -n yoursecurepassword | openssl md5

다음 출력이 표시되어야 합니다.

(stdin)= 55b38b03e7587a45fd886977842ff9b8

참고: 위의 md5 암호를 기억하십시오. user-mapping.xml 파일에서 이를 정의해야 합니다.

다음으로 다음 명령을 사용하여 새 user-mapping.xml을 만듭니다.

nano /etc/guacamole/user-mapping.xml
<user-mapping>
    <authorize 
            username="admin"
            password="55b38b03e7587a45fd886977842ff9b8"
            encoding="md5">

        <connection name="Ubuntu20.04-Server">
            <protocol>ssh</protocol>
            <param name="hostname">192.168.10.50</param>
            <param name="port">22</param>
            <param name="username">root</param>
        </connection>
        <connection name="Windows Server">
            <protocol>rdp</protocol>
            <param name="hostname">192.168.10.51</param>
            <param name="port">3389</param>
        </connection>
    </authorize>
</user-mapping>

완료되면 파일을 저장하고 닫습니다.

어디에:

  • 192.168.10.50은 원격 Ubuntu 서버의 IP 주소입니다.
  • 192.168.10.51은 제거된 Windows 서버의 IP 주소입니다.

다음으로 Tomcat 및 Guacamole 서비스를 다시 시작하여 변경 사항을 적용합니다.

systemctl restart tomcat9
systemctl restart guacd

이 시점에서 Guacamole 서버와 클라이언트가 설치 및 구성되었습니다.

Guacamole 웹 인터페이스에 액세스

이제 웹 브라우저를 열고 URL http://your-server-ip:8080/guacamole을 사용하여 Guacamole 웹 인터페이스에 액세스하십시오. Guacamole 로그인 페이지로 리디렉션됩니다.

user-mapping.xml 파일에서 정의한 사용자 이름과 비밀번호를 제공하고 로그인 버튼을 클릭합니다. 다음 페이지에 Guacamole 대시보드가 표시되어야 합니다.

이제 Ubuntu20.04-Server를 클릭하여 SSH 프로토콜을 사용하여 원격 서버에 연결합니다. 아래와 같이 Ubuntu 서버의 로그인 화면이 표시되어야 합니다.

Ubuntu 서버의 루트 암호를 입력하고 Enter 키를 누릅니다. 아래와 같이 Ubuntu 서버에 로그인됩니다.

Guacamole용 Nginx 구성

포트 80을 통해 Guacamole에 액세스하려면 Nginx를 리버스 프록시로 구성하는 것이 좋습니다.

먼저 다음 명령을 사용하여 Nginx 웹 서버를 설치합니다.

apt-get install nginx -y

Nginx를 설치한 후 새 Nginx 가상 호스트 구성 파일을 만듭니다.

nano /etc/nginx/sites-available/guacamole.conf

다음 줄을 추가합니다.

server {
        listen 80;
        server_name your-server-ip;
        access_log  /var/log/nginx/guac_access.log;
        error_log  /var/log/nginx/guac_error.log;

        location / {
                    proxy_pass http://your-server-ip:8080/guacamole/;
                    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;
                    proxy_cookie_path /guacamole/ /;
        }

}

완료되면 파일을 저장하고 닫습니다. 그런 다음 다음 명령을 사용하여 Nginx 가상 호스트를 활성화합니다.

ln -s /etc/nginx/sites-available/guacamole.conf /etc/nginx/sites-enabled/

그런 다음 Nginx 서비스를 다시 시작하여 구성 변경 사항을 적용합니다.

systemctl restart nginx

이제 URL http://your-server-ip를 사용하여 Guacamole에 액세스할 수 있습니다.

결론

축하합니다! Ubuntu 20.04 서버에 Guacamole 원격 데스크톱 클라이언트를 성공적으로 설치하고 구성했습니다. 이제 Guacamole에 더 많은 RDP 또는 VNC 연결을 추가하고 웹 기반 인터페이스에서 관리를 시작할 수 있습니다.