윈도우에서 linux 머신에 x - window로 접속하기 위해 tightvncserver나 vnc4server등의 VNC tool을 이용해서 접속할 수 있다. vnc4server를 이용해왔었는데, 더 간단한 tightvncserver라는 tool을 이용하면 좀더 간단한 것같다. 아래는 2가지 tool의 설치 및 설정 법.



A. tightvncserver 이용


0. tightvncserver 설치

$sudo apt-get install tightvncserver


1. xstartup 파일 설정

$ vi ~/.vnc/xstartup


#!/bin/sh


# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER

unset DBUS_SESSION_BUS_ADDRESS

exec /etc/X11/xinit/xinitrc


gnome-session &


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

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

xsetroot -solid grey

vncconfig -iconic &

#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#x-window-manager &



2. VNC server 실행
vncserver -geometry 1680x1050 :2

3. 패스워드 설정


You will require a password to access your desktops.


Password:

Verify:


New 'X' desktop is panol-desktop:2

Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/panol-desktop:2.log


4. 윈도우에서 VNCviewer 이용해서 접속
VNC viewer 프로그램을 이용해 서버로 접속한다.
무료 VNCviewer 다운: http://www.tightvnc.com/download.php


(안되면) 5. xstartup 설정 
$ vi ~/.vnc/xstartup

#!/bin/sh

# VNC Server (Virtual-Mode) start-up script compatible with Ubuntu 12.04

[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey

vncconfig -iconic &

if [ -f /usr/bin/gnome-session ]; then
  # Some gnome session types won't work with Xvnc, try to pick a sensible 
  # default.
  for SESSION in "ubuntu-2d" "2d-gnome"; do
    if [ -f /usr/share/gnome-session/sessions/$SESSION.session ]; then
      DESKTOP_SESSION=$SESSION; export DESKTOP_SESSION
      GDMSESSION=$SESSION; export GDMSESSION
      STARTUP="/usr/bin/gnome-session --session=$SESSION"; export STARTUP
    fi
  done
fi

if   [ -x /etc/X11/Xsession ]; then /etc/X11/Xsession
elif [ -x /etc/X11/xdm/Xsession ]; then /etc/X11/xdm/Xsession
elif [ -x /etc/X11/xinit/Xsession ]; then /etc/X11/xinit/Xsession
elif [ -x /etc/gdm/Xsession ]; then /etc/gdm/Xsession gnome-session
elif [ -x /etc/kde/kdm/Xsession ]; then /etc/kde/kdm/Xsession
elif [ -x /usr/dt/bin/Xsession ]; then
  XSTATION=1 DTXSERVERLOCATION=local /usr/dt/bin/Xsession
elif [ -x /usr/dt/bin/dtsession ]; then /usr/dt/bin/dtsession
else
  if which twm > /dev/null 2>&1; then
    xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    twm
  else
    xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop"
  fi
fi










B. vnc4server 이용



0. vncserver 설치


$ sudo apt-get install vnc4server xinetd



1. 패스워드 설정

$ vnc4server 


You will require a password to access your desktops.

Password:

Verify:

New 'panol-desktop:1 (panol)' desktop is panol-desktop:1


Creating default startup script /home/panol/.vnc/xstartup

Starting applications specified in /home/panol/.vnc/xstartup

Log file is /home/panol/.vnc/panol-desktop:1.log


$ vnc4server -kill :1





2. xstartup 파일 설정

$ vi ~/.vnc/xstartup


#!/bin/sh


# Uncomment the following two lines for normal desktop:

unset SESSION_MANAGER

unset DBUS_SESSION_BUS_ADDRESS

exec /etc/X11/xinit/xinitrc


gnome-session &


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

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

xsetroot -solid grey

vncconfig -iconic &

#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

#x-window-manager &



3. 권한변경
$ sudo chmod 755 /etc/X11/xinit/xinitrc



4. VNC server 실행
vncserver -geometry 1680x1050 :1

5. 클라이언트 접속
이제 client에서는 hostname(IP)과 vnc number를 이용하여 접속.




댓글을 달아 주세요

  1. 2013.03.06 12:08  댓글주소  수정/삭제  댓글쓰기

    비밀댓글입니다