Language:EN / NE / AE / DE / IT

안녕하세요. 이번에는 U5PVR 에 Guacamole 을 설치해 보겠습니다.


현 최신 버전은 0.9.12 버전입니다.


https://guacamole.incubator.apache.org/




1. 의존성 패키지 설치하기


아래의 명령으로 의존성 패키지를 설치합니다.

(뭔가 많이 설치를 하는 것 같은데 요렇게 하라고 되어 있어서 요렇게 합니다.)


root@u5pvr-debian:~# apt-get install build-essential libcairo2-dev libjpeg-dev libpng12-dev libossp-uuid-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev libvorbis-dev tomcat8 libjpeg-dev libwebp-dev libavcodec-dev libavutil-dev libswscale-dev


설치가 완료 되었으면 tomcat8 을 aid_inet 그룹에 추가하고 정상적으로 구동중인지 확인합니다.


root@u5pvr-debian:~# adduser tomcat8 aid_inet

Adding user `tomcat8' to group `aid_inet' ...

Adding user tomcat8 to group aid_inet

Done.

root@u5pvr-debian:~# service tomcat8 restart

[ ok ] Stopping Tomcat servlet engine: tomcat8 Tomcat servlet engine is not running but pid file exists, cleaning up.

[ ok ] Starting Tomcat servlet engine: tomcat8.

root@u5pvr-debian:~# netstat -nlp | grep java

tcp6       0      0 :::8080                 :::*                    LISTEN      10491/java

root@u5pvr-debian:~#


웹브라우저에서 http://u5pvr_ip_address:8080/ 으로 접속해 봅니다.


정상적으로 작동합니다.


다음으로 mysql 을 설치합니다.


root@u5pvr-debian:~# apt-get install mysql-server mysql-client

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following extra packages will be installed:

  libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl mysql-client-5.5 mysql-common mysql-server-5.5 mysql-server-core-5.5

Suggested packages:

  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libipc-sharedcache-perl mailx tinyca

The following NEW packages will be installed:

  libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl mysql-client mysql-client-5.5 mysql-common mysql-server mysql-server-5.5 mysql-server-core-5.5

0 upgraded, 12 newly installed, 0 to remove and 0 not upgraded.

Need to get 8074 kB of archives.

After this operation, 85.2 MB of additional disk space will be used.

Do you want to continue? [Y/n]


설치 중간에 root 계정 암호를 설정합니다.


두번 입력합니다.




그런데 중간에 에러가 납니다.


Setting up mysql-server-5.5 (5.5.53-0+deb8u1) ...

[ ok ] Stopping MySQL database server: mysqld.

170501 20:54:50 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead.

170501 20:54:50 [Note] Ignoring --secure-file-priv value as server is running with --bootstrap.

170501 20:54:50 [Note] /usr/sbin/mysqld (mysqld 5.5.53-0+deb8u1) starting as process 18125 ...

[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . failed!

invoke-rc.d: initscript mysql, action "start" failed.

dpkg: error processing package mysql-server-5.5 (--configure):

 subprocess installed post-installation script returned error exit status 1

Setting up libhtml-template-perl (2.95-1) ...

Setting up mysql-client (5.5.53-0+deb8u1) ...

dpkg: dependency problems prevent configuration of mysql-server:

 mysql-server depends on mysql-server-5.5; however:

  Package mysql-server-5.5 is not configured yet.


dpkg: error processing package mysql-server (--configure):

 dependency problems - leaving unconfigured

Processing triggers for libc-bin (2.19-18+deb8u7) ...

Processing triggers for systemd (215-17+deb8u6) ...

Errors were encountered while processing:

 mysql-server-5.5

 mysql-server

E: Sub-process /usr/bin/dpkg returned an error code (1)

root@u5pvr-debian:~#


이 에러를 해결하기 위해서 mysql 계정 또한 aid_inet 에 추가합니다.


root@u5pvr-debian:~# adduser mysql aid_inet

Adding user `mysql' to group `aid_inet' ...

Adding user mysql to group aid_inet

Done.


다시 설치를 진행합니다.


root@u5pvr-debian:~# apt-get install mysql-server mysql-client

Reading package lists... Done

Building dependency tree

Reading state information... Done

mysql-client is already the newest version.

mysql-server is already the newest version.

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

2 not fully installed or removed.

After this operation, 0 B of additional disk space will be used.

Do you want to continue? [Y/n]

Setting up mysql-server-5.5 (5.5.53-0+deb8u1) ...

[ ok ] Stopping MySQL database server: mysqld.

[ ok ] Starting MySQL database server: mysqld . ..

[info] Checking for tables which need an upgrade, are corrupt or were

not closed cleanly..

Setting up mysql-server (5.5.53-0+deb8u1) ...

root@u5pvr-debian:~#


제대로 mysql 이 구동중인지 확인합니다.


root@u5pvr-debian:~# netstat -nlp | grep 3306

tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      20026/mysqld

root@u5pvr-debian:~#


정상적으로 설치가 되었습니다.



2. 필요한 파일 다운받기


총 아래의 파일을 다운 받습니다.


저는 root 계정 홈폴더에 받았습니다.

(아래의 자료는 공식 홈페이지에서 그대로 내린 것입니다. wget 으로 받아지지 않아서 제 서버에 직링크 합니다.)


root@u5pvr-debian:~# wget http://download.djjproject.com/linux/guacamole/guacamole-0.9.12-incubating.war

converted 'http://download.djjproject.com/linux/guacamole/guacamole-0.9.12-incubating.war' (ANSI_X3.4-1968) -> 'http://download.djjproject.com/linux/guacamole/guacamole-0.9.12-incubating.war' (UTF-8)

--2017-05-01 20:59:05--  http://download.djjproject.com/linux/guacamole/guacamole-0.9.12-incubating.war

Resolving download.djjproject.com (download.djjproject.com)... 1.226.113.222

Connecting to download.djjproject.com (download.djjproject.com)|1.226.113.222|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 7987723 (7.6M)

Saving to: 'guacamole-0.9.12-incubating.war'


guacamole-0.9.12-incubating.war                      100%[=======================================================================================================================>]   7.62M  7.43MB/s   in 1.0s


2017-05-01 20:59:06 (7.43 MB/s) - 'guacamole-0.9.12-incubating.war' saved [7987723/7987723]


root@u5pvr-debian:~# wget http://download.djjproject.com/linux/guacamole/guacamole-auth-jdbc-0.9.12-incubating.tar.gz

converted 'http://download.djjproject.com/linux/guacamole/guacamole-auth-jdbc-0.9.12-incubating.tar.gz' (ANSI_X3.4-1968) -> 'http://download.djjproject.com/linux/guacamole/guacamole-auth-jdbc-0.9.12-incubating.tar.gz' (UTF-8)

--2017-05-01 20:59:13--  http://download.djjproject.com/linux/guacamole/guacamole-auth-jdbc-0.9.12-incubating.tar.gz

Resolving download.djjproject.com (download.djjproject.com)... 1.226.113.222

Connecting to download.djjproject.com (download.djjproject.com)|1.226.113.222|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 7100011 (6.8M) [application/x-gzip]

Saving to: 'guacamole-auth-jdbc-0.9.12-incubating.tar.gz'


guacamole-auth-jdbc-0.9.12-incubating.tar.gz         100%[=======================================================================================================================>]   6.77M  7.88MB/s   in 0.9s


2017-05-01 20:59:14 (7.88 MB/s) - 'guacamole-auth-jdbc-0.9.12-incubating.tar.gz' saved [7100011/7100011]


root@u5pvr-debian:~# wget http://download.djjproject.com/linux/guacamole/guacamole-server-0.9.12-incubating.tar.gz

converted 'http://download.djjproject.com/linux/guacamole/guacamole-server-0.9.12-incubating.tar.gz' (ANSI_X3.4-1968) -> 'http://download.djjproject.com/linux/guacamole/guacamole-server-0.9.12-incubating.tar.gz' (UTF-8)

--2017-05-01 20:59:20--  http://download.djjproject.com/linux/guacamole/guacamole-server-0.9.12-incubating.tar.gz

Resolving download.djjproject.com (download.djjproject.com)... 1.226.113.222

Connecting to download.djjproject.com (download.djjproject.com)|1.226.113.222|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 851810 (832K) [application/x-gzip]

Saving to: 'guacamole-server-0.9.12-incubating.tar.gz'


guacamole-server-0.9.12-incubating.tar.gz            100%[=======================================================================================================================>] 831.85K  3.85MB/s   in 0.2s


2017-05-01 20:59:20 (3.85 MB/s) - 'guacamole-server-0.9.12-incubating.tar.gz' saved [851810/851810]


root@u5pvr-debian:~# wget http://download.djjproject.com/linux/guacamole/mysql-connector-java-5.1.40.tar.gz

converted 'http://download.djjproject.com/linux/guacamole/mysql-connector-java-5.1.40.tar.gz' (ANSI_X3.4-1968) -> 'http://download.djjproject.com/linux/guacamole/mysql-connector-java-5.1.40.tar.gz' (UTF-8)

--2017-05-01 20:59:29--  http://download.djjproject.com/linux/guacamole/mysql-connector-java-5.1.40.tar.gz

Resolving download.djjproject.com (download.djjproject.com)... 1.226.113.222

Connecting to download.djjproject.com (download.djjproject.com)|1.226.113.222|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 3911557 (3.7M) [application/x-gzip]

Saving to: 'mysql-connector-java-5.1.40.tar.gz'


mysql-connector-java-5.1.40.tar.gz                   100%[=======================================================================================================================>]   3.73M  5.53MB/s   in 0.7s


2017-05-01 20:59:30 (5.53 MB/s) - 'mysql-connector-java-5.1.40.tar.gz' saved [3911557/3911557]


root@u5pvr-debian:~#



3. guacamole server 컴파일 및 설치하기


guacamole-server 파일을 압축을 풉니다. 


풀고 해당 디렉터리로 이동합니다.


root@u5pvr-debian:~# tar xf guacamole-server-0.9.12-incubating.tar.gz

root@u5pvr-debian:~# cd guacamole-server-0.9.12-incubating

root@u5pvr-debian:~/guacamole-server-0.9.12-incubating# ls

AUTHORS       ChangeLog   Dockerfile  Makefile.am  NOTICE  aclocal.m4  compile       config.h.in  configure     depcomp  install-sh  m4       src          tests

CONTRIBUTING  DISCLAIMER  LICENSE     Makefile.in  README  bin         config.guess  config.sub   configure.ac  doc      ltmain.sh   missing  test-driver

root@u5pvr-debian:~/guacamole-server-0.9.12-incubating#


아래의 명령으로 컴파일 및 설치를 진행합니다.


root@u5pvr-debian:~/guacamole-server-0.9.12-incubating# ./configure --with-init-dir=/etc/init.d

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... no

checking for mawk... mawk

checking whether make sets $(MAKE)... yes

checking whether make supports nested variables... yes

checking whether make supports nested variables... (cached) yes

checking build system type... armv7l-unknown-linux-gnueabihf

checking host system type... armv7l-unknown-linux-gnueabihf

checking how to print strings... printf

checking for style of include used by make... GNU

checking for gcc... gcc

checking whether the C compiler works... yes

.................................

------------------------------------------------

guacamole-server version 0.9.12-incubating

------------------------------------------------


   Library status:


     freerdp ............. yes

     pango ............... yes

     libavcodec .......... yes

     libavutil ........... yes

     libssh2 ............. yes

     libssl .............. yes

     libswscale .......... yes

     libtelnet ........... yes

     libVNCServer ........ yes

     libvorbis ........... yes

     libpulse ............ yes

     libwebp ............. yes


   Protocol support:


      RDP ....... yes

      SSH ....... yes

      Telnet .... yes

      VNC ....... yes


   Services / tools:


      guacd ...... yes

      guacenc .... yes


   Init scripts: /etc/init.d


Type "make" to compile guacamole-server.


root@u5pvr-debian:~/guacamole-server-0.9.12-incubating# make && make install && ldconfig

make  all-recursive

make[1]: Entering directory '/root/guacamole-server-0.9.12-incubating'

Making all in src/libguac

make[2]: Entering directory '/root/guacamole-server-0.9.12-incubating/src/libguac'

  CC       libguac_la-audio.lo

  CC       libguac_la-client.lo

  CC       libguac_la-encode-jpeg.lo

  CC       libguac_la-encode-png.lo

  CC       libguac_la-error.lo

  CC       libguac_la-hash.lo

.........................


컴파일은 4분 정도 걸립니다.


정상적으로 실행이 되는지 체크를 합니다.


root@u5pvr-debian:~/guacamole-server-0.9.12-incubating# service guacd restart

Stopping guacd: SUCCESS (not running)

Starting guacd: guacd[798]: INFO:       Guacamole proxy daemon (guacd) version 0.9.12-incubating started

SUCCESS

root@u5pvr-debian:~/guacamole-server-0.9.12-incubating# netstat -nlp | grep guacd

tcp        0      0 127.0.0.1:4822          0.0.0.0:*               LISTEN      800/guacd

root@u5pvr-debian:~/guacamole-server-0.9.12-incubating#


부팅시 자동실행을 위해서 아래의 명령어를 입력합니다.


root@u5pvr-debian:~/guacamole-server-0.9.12-incubating# update-rc.d guacd defaults



4. guacamole war 파일 및 라이브러리 모듈 배치하기


먼저 guacamole-0.9.12-incu......war 파일을 배치합니다.


root@u5pvr-debian:~/guacamole-server-0.9.12-incubating# cd ~

root@u5pvr-debian:~# mkdir /var/lib/guacamole

root@u5pvr-debian:~# cp guacamole-0.9.12-incubating.war /var/lib/guacamole/guacamole.war

root@u5pvr-debian:~# ln -s /var/lib/guacamole/guacamole.war /var/lib/tomcat8/webapps/guacamole.war


아래의 extensions 와 lib 폴더를 만들고 모듈들을 복사합니다.


root@u5pvr-debian:~# mkdir -p /usr/share/tomcat8/.guacamole/{extensions,lib}

root@u5pvr-debian:~# tar xf guacamole-auth-jdbc-0.9.12-incubating.tar.gz

root@u5pvr-debian:~# cd guacamole-auth-jdbc-0.9.12-incubating

root@u5pvr-debian:~/guacamole-auth-jdbc-0.9.12-incubating# ls

DISCLAIMER  LICENSE  NOTICE  bundled  mysql  postgresql

root@u5pvr-debian:~/guacamole-auth-jdbc-0.9.12-incubating# cd mysql

root@u5pvr-debian:~/guacamole-auth-jdbc-0.9.12-incubating/mysql# ls

guacamole-auth-jdbc-mysql-0.9.12-incubating.jar  schema    #찐하게 된 파일이 복사할 대상입니다.

root@u5pvr-debian:~/guacamole-auth-jdbc-0.9.12-incubating/mysql# cp guacamole-auth-jdbc-mysql-0.9.12-incubating.jar /usr/share/tomcat8/.guacamole/extensions/

root@u5pvr-debian:~/guacamole-auth-jdbc-0.9.12-incubating/mysql# cd ~

root@u5pvr-debian:~# tar xf mysql-connector-java-5.1.40.tar.gz

root@u5pvr-debian:~# cd mysql-connector-java-5.1.40

root@u5pvr-debian:~/mysql-connector-java-5.1.40# ls

CHANGES  COPYING  README  README.txt  build.xml  docs  mysql-connector-java-5.1.40-bin.jar  src    #찐하게 된 파일이 복사할 대상입니다.

root@u5pvr-debian:~/mysql-connector-java-5.1.40# cp mysql-connector-java-5.1.40-bin.jar /usr/share/tomcat8/.guacamole/lib/


이렇게 하면 모듈 배치가 끝났습니다.



5. mysql 서버 설정하기


아래의 명령으로 db 생성과 계정 및 권한 설정을 합니다. 


root@u5pvr-debian:~# mysql --host=localhost --user=root --password=????????????     # 설정하신 root 패스워드를 넣습니다.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 43

Server version: 5.5.53-0+deb8u1 (Debian)


Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.


# guacdb 를 생성하는 과정입니다.

mysql> CREATE DATABASE IF NOT EXISTS guacdb;

Query OK, 1 row affected (0.01 sec)


# guacuser 를 생성하고 비밀번호가 djj9405 인 계정을 만듭니다. 적절히 바꾸시면 됩니다.

mysql> CREATE USER 'guacuser'@'localhost' IDENTIFIED BY 'djj9405';

Query OK, 0 rows affected (0.01 sec)


# guacuser 에 권한을 할당합니다.

mysql> grant select,insert,update,delete on guacdb.* to 'guacuser'@'localhost';

Query OK, 0 rows affected (0.00 sec)


mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)


mysql> exit

Bye

root@u5pvr-debian:~#


다음은 초기 db 값을 올리는 작업입니다.


root@u5pvr-debian:~# cd guacamole-auth-jdbc-0.9.12-incubating

guacamole-auth-jdbc-0.9.12-incubating/        guacamole-auth-jdbc-0.9.12-incubating.tar.gz

root@u5pvr-debian:~# cd guacamole-auth-jdbc-0.9.12-incubating/mysql/schema/


root@u5pvr-debian:~/guacamole-auth-jdbc-0.9.12-incubating/mysql/schema# ls

001-create-schema.sql  002-create-admin-user.sql  upgrade        # 요 두 sql 파일이 올리는 파일입니다.


# 루트 계정 비밀번호를 ????????? 에 넣습니다.

root@u5pvr-debian:~/guacamole-auth-jdbc-0.9.12-incubating/mysql/schema# cat ./*.sql | mysql --host=localhost --user=root --password=??????????? guacdb

root@u5pvr-debian:~/guacamole-auth-jdbc-0.9.12-incubating/mysql/schema#


끝났습니다.



6. 설정파일 만들기 및 연동


아래처럼 폴더를 하나 만들고 설정파일을 만듭니다.


root@u5pvr-debian:~# mkdir /etc/guacamole

root@u5pvr-debian:~# nano /etc/guacamole/guacamole.properties




mysql-hostname: localhost

mysql-port: 3306

mysql-database: guacdb

mysql-username: guacuser

mysql-password: djj9405    # 이때 패스워드는 guacuser 의 패스워드 입니다.

mysql-disallow-duplicate-connections: false


guacamole 에서 읽을 수 있도록 심링크를 해 줍니다.


root@u5pvr-debian:~# ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat8/.guacamole/


설치가 끝났습니다.


++ 아쉽게도 RDP 의 부가기능 (사운드 마이크 프린터 공유 공유폴더 등은 동작하지 않네요.. 아쉽습니다.)

아닙니다. 됩니다. 아래 명령으로 모듈 등록 해 주시면 됩니다.

 

root@u5pvr-debian:~# mkdir /usr/lib/arm-linux-gnueabihf/freerdp

root@u5pvr-debian:~# ln -s /usr/local/lib/freerdp/guac*.so /usr/lib/arm-linux-gnueabihf/freerdp

root@u5pvr-debian:/usr/lib/arm-linux-gnueabihf/freerdp# ls

guacai-client.so  guacdr-client.so  guacsnd-client.so  guacsvc-client.so

root@u5pvr-debian:/usr/lib/arm-linux-gnueabihf/freerdp#


위의 구조대로 라이브러리 배치가 되면 정상적으로 작동합니다.




7. 재부팅 후 사용해보기


재부팅 후 http://u5pvr_ip_address:8080/guacamole 로 이동하여 페이지가 열리는 지 확인합니다.


(초기에 tomcat 에서 웹앱 설치가 되는 시간이 쪼금 걸림으로 바로 열리지는 않습니다. 한번 설치가 되면 빨리 빨리 열립니다.)


초기 로그인 아이디 비밀번호는 guacadmin 입니다.




















감사합니다.