우분투 vnc 설정

카테고리 없음 2010. 12. 31. 23:47




우분투에서 vncserver를 사용하는 사람이 별로 없는지 관련 자료를 찾는게 쉽지 않다 ..

결국 하나 찾아서 성공한 것이 vnc4server 이다. 

Step 1  vncserver 를 위해서 2개의 패키지를 설치해야 한다. 
- xinet  (telnet 설치했다면 기본적으로 깔려있을것이다.)
- vnc4server

** 시냅틱 패키지 관리자를 이용해서 설치할수 있다 다음과 같이 커맨드 창에서 설치도 가능하다 
sudo apt-get install vnc4server xinetd


Step 2  vnc4server 패스워드 설정 

citylock@ubuntu910:~$ vnc4server 

You will require a password to access your desktops.
Password:
Verify:
New 'ubuntu910:1 (citylock)' desktop is ubuntu910:1

Creating default startup script /home/citylock/.vnc/xstartup
Starting applications specified in /home/citylock/.vnc/xstartup
Log file is /home/citylock/.vnc/ubuntu910:1.log

citylock@ubuntu910:~$ vnc4server -kill :1

- vnc 클라이언트에서 접속할 패스워드 입력 
- ubuntu910:1 에서 :1 은 vncserver의 display 번호이다. 연결시 필요한 번호라 기억해 줘야 한다. 
vnc4server -kill :1 다음 설정을 위해서 vnc4server를 중지 시킨다. 

참고로 패스워드를 설정하면 ~/,vnc/ 에 아래과 같은 파일이 생성된다. 
citylock@ubuntu910:~/.vnc$ ls -al
합계 20
-rw-------  1 citylock citylock    8 2010-01-29 09:37 passwd  (패스워드)
-rw-r--r--  1 citylock citylock 1442 2010-01-29 09:42 ubuntu910:1.log
-rwxr-xr-x  1 citylock citylock  334 2010-01-29 09:39 xstartup (vnc4server 설정파일)
citylock@ubuntu910:~/.vnc$ 


Step 3  xstartup 설정 변경
(before)
#!/bin/sh
# Uncomment the following two lines for normal desktop:
#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
 
(after)
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
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 &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &


Step 4  /etc/X11/xinit/xinitrc 파일의 권한 변경 (실행가능파일)
sudo chmod 755 /etc/X11/xinit/xinitrc

Step 5  vnc4server 실행 
citylock@ubuntu910:~$ vnc4server 
New 'ubuntu910:1 (citylock)' desktop is ubuntu910:1
Starting applications specified in /home/citylock/.vnc/xstartup
Log file is /home/citylock/.vnc/ubuntu910:1.log

Step 6 vnc 클라이언트 접속 





(참고) 
- vnc4server 중지
citylock@ubuntu910:~/.vnc$ vnc4server -kill :1
Killing Xvnc process ID 2591
citylock@ubuntu910:~/.vnc$ 

- vnc4server 실행확인 방법
citylock@ubuntu910:~/.vnc$ netstat -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:5901            0.0.0.0:*               LISTEN     (  세션 번호에 따라서 5901 번부터 할당된다. ) 
tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN     
tcp6       0      0 :::6001                 :::*                    LISTEN     
tcp6       0      0 ::1:631                 :::*                    LISTEN     
citylock@ubuntu910:~/.vnc$ 

에고 ..이거 때문에 반나절 고생했네요 ... 

다른 분들은 저처럼 고생하지 말라고 포스팅 합니다. 

자료 출처 : http://www.ehow.com/how_5089245_install-vnc-server-ubuntu.html