Bite Bits/Debian 9

debian linux 에 서 vnc 설정하기

상영 2018. 1. 8. 17:18

debian에서는 raspbian과 달리realvnc 패키지가 검색되지 않는다. (참고 : http://blog.daum.net/to302/38 )

하지만, vnc 관 련패키지가 없는것은 아닌데, 찾은 결과 vnc4server  패키지가 vnc 서버로서 제일 적합한 듯.


젤 아래 나오는 x11vnc 를 사용하기로 결정하고, 적용함.

(관련글 : http://blog.daum.net/to302/76 )


위의 vnc4server 는 로컬의 화면이 아닌 guest 용 화면을 별도로 만들어 보여줌.

raspbian 에서 사용하던 realvnc 는 local 화면과 원격 접속화면이 동일 (:0) 

동일한 기능을 구현해주는 x11vnc 가 적합하다고 판단.



$ sudo aptitude install vnc4server
The following NEW packages will be installed:
  tigervnc-common{a} tigervnc-standalone-server{a} vnc4server
0 packages upgraded, 3 newly installed, 0 to remove and 87 not upgraded.
Need to get 1,071 kB of archives. After unpacking 2,993 kB will be used.
Do you want to continue? [Y/n/?] Y

--- *중략* ---

update-alternatives: using /usr/bin/tigervncconfig to provide /usr/bin/vncconfig (vncconfig) in auto mode
update-alternatives: using /usr/bin/tigervncpasswd to provide /usr/bin/vncpasswd (vncpasswd) in auto mode
tigervnc-standalone-server (1.7.0+dfsg-7) 설정하는 중입니다 ...
update-alternatives: using /usr/bin/tigervncserver to provide /usr/bin/vncserver (vncserver) in auto mode
update-alternatives: using /usr/bin/Xtigervnc to provide /usr/bin/Xvnc (Xvnc) in auto mode

--- *하략* ---



vnc 접근용 패스워드 설정

vnc 접근용 user 를 별도로 추가해도 되고, 사용하는 계정으로 그냥 사용해도 됨.

$ vncpasswd 

Password:

Verify:

Would you like to enter a view-only password (y/n)? n


vnc server 에서 client pc 로 클립보드 공유를 위한 패키지 설치.

$ sudo aptitude install autocutsel


vnc 세션(xfce) 설정 및 서버 구동

$ cat > ~/.vnc/xstartup
#!/bin/bash

env -i /bin/sh -c "export PATH=$PATH;
                   export XAUTHORITY=$XAUTHORITY;
                   export DISPLAY=$DISPLAY;
                   export HOME=$HOME;
                   export LOGNAME=$LOGNAME;
                   export USER=$USER;
                   /usr/bin/xfce4-session"


$ vncserver :1 -geometry 1600x900 -depth 24 -localhost no


아래의 것으로 나중에 수정함.

$ cat > ~/.vnc/xstartup

#!/bin/sh

unset SESSION_MANAGER

unset DBUS_SESSION_BUS_ADDRESS

+ autocutsel -fork

/usr/bin/startxfce4 &


[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

xsetroot -solid grey

vncconfig -iconic &


클라이언트에서 접속할 때는<ip>:<display>  예) 192.168.1.10:1

display 번호는 실행 명령vncserver :1 에서 (:1) 이 부분.


현재 실행 중인 세션 확인 및 종료 처리

$ vncserver -list


TigerVNC server sessions:

X DISPLAY #    PROCESS ID
:1        10663

$ vncserver -kill :1


vnc port 확인하는 방법

$ ss -ltp | grep vnc


vnc port 는 첫번째 display (:1) 5901 부터 사용 두번째 display(:2)는 5902 , 이렇게 증가한다.


VNC 클라이언트 Ultra VNC  http://www.uvnc.com/   (서버기능도 있음 - GNU license)


* 참 고:

- (*) Debian 9 Stretch : Configure VNC Server, https://www.server-world.info/en/note?os=Debian_9&p=desktop&f=6

- VNC server/client setup on Debian 9 Stretch Linux, https://linuxconfig.org/vnc-server-client-setup-on-debian-9-stretch-linux

- How To Set Up VNC Server on Debian 8, https://www.digitalocean.com/community/tutorials/how-to-set-up-vnc-server-on-debian-8

- (*) Running xfce4 under vnc xfce4-session, https://bugzilla.xfce.org/show_bug.cgi?id=7502

- Gentoo에 Xfce, SLiM, ibus, TigerVNC 종합 설치, https://seedbox.ip.or.kr/entry/xfce-slim-ibus-tigervnc-on-gentoo

- (VNC 에서 한글입력, 클립보드 공유 관련), http://docs.iorchard.co.kr/uvdi/xrdp_test

- Ubuntu 14.04 – Gnome Desktop 및 vnc 설치, http://www.fun25.co.kr/blog/ubuntu-14-04-gnome-desktop-vnc-install

- 우분투. VNC기반 원격접속 Desktop Sharing 설정, http://igotit.tistory.com/entry/%EC%9A%B0%EB%B6%84%ED%88%AC-%EC%9B%90%EA%B2%A9%EC%A0%91%EC%86%8D-Desktop-Sharing



-------

Is it possible to start vncserver on :0 when its already started on :1 without having to reboot the system?


vncserver tries to create a full window manager and all that, and your :0 likely already has those things going for it.

What you are looking for is using "x11vnc." I believe it will give you the desired effect, even without the :0 argument. There is a distinct yum-package, "x11vnc."