블로그 이미지
BJcomm
bjcomm

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

calendar

1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
03-29 05:13

CentOS 5.5 VNC 설정 및 사용방법

2014. 11. 25. 17:47 | Posted by bjcomm
CentOS 5.5 에는 기본적으로 VNC Server가 설치되어 있어 환경설정과 서비스 등록만으로 VNC를 사용할 수 있다.


1. 환경

- CentOS 5.5 : 설치됨
- VNC Viewer : http://www.uvnc.com/download/ 에서 다운로드



2. 설정

# vi /etc/sysconfig/vncservers



3. vncservers 내용 수정

# The VNCSERVERS variable is a list of display:user pairs.

#

# Uncomment the lines below to start a VNC server on display :2

# as my 'myusername' (adjust this to your own). You will also

# need to set a VNC password; run 'man vncpasswd' to see how

# to do that.

#

# DO NOT RUN THIS SERVICE if your local area network is

# untrusted! For a secure way of using VNC, see

# <URL:http://www.uk.research.att.com/archive/vnc/sshvnc.html>.


# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.


# Use "-nohttpd" to prevent web-based VNC clients connecting.


# Use "-localhost" to prevent remote VNC clients connecting except when

# doing so through a secure tunnel. See the "-via" option in the

# `man vncviewer' manual page.


# VNCSERVERS="2:myusername"

# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -nohttpd -localhost"


VNCSERVERS="1:root"

VNCSERVERARGS[1]="-geometry 12800x800"

 



4. VNC 암호 설정

# vncpasswd
Password:
Verify:



5. Port 확인 및 방화벽 오픈

# netstat -antp

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 0.0.0.0:5801 0.0.0.0:* LISTEN 25974/Xvnc

tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 25974/Xvnc

tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 2629/portmap

tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 25974/Xvnc



# vi /etc/sysconfig/iptables

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT
(추가)


5-1. iptable restart
# /etc/rc.d/init.d/iptables restart


6. VNC Server 시작

# service vncserver start



7. 서버 부팅시 자동 실행 service로 등록

# chkconfig vncserver on



8. 윈도우에서 그래픽모드로 보기 위한 설정

# vi /root/.vnc/xstartup



#!/bin/sh


wing 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 &


# 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 &


 




9. VNC Viewer로 접속 확인

 



10. 접속화면

 





++ xhost 문제가 나온다면
[root@CJDP_DB jdk1.6.0_13]# DISPLAY=localhost:2.0
[root@CJDP_DB jdk1.6.0_13]# export DISPLAY
[root@CJDP_DB jdk1.6.0_13]# xhost +