반응형
/********************************************************************************************
-- Title : [Lnx] CentOS에 VNC Server 구축 및 설정
-- Reference : 웹검색
-- Key word : vnc vncserver 원격연결 원격 연결
********************************************************************************************/
-- 1. 설치 확인
   ㅇ CentOS 설치시 자동으로 설치된다.
   ㅇ http://www.uvnc.com/download/ 에서 필요시 다운로드.
   ㅇ /etc/init.d/vncserver가 있나 확인.

-- 2. 설치 안되어 있으면 설치
    # yum -y install vnc-server

-- 3. 설치 다시 확인
    # ls -l /usr/bin |grep vnc

-- 4. 환경 설정( # vi /etc/sysconfig/vncservers)
...
# 아래 추가
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768"

-- 5. 암호 설정
    ㅇ /root/.vnc/passwd 파일에 저장됨.
# vncpasswd
Password : ********
Verify: ********


-- 6. /root/.vnc/xstartup 편집(Optional)
    ㅇ xstartup 파일 편집이 안되면 CentOS 원래 화면이 나오지 않아서 설정해야 됨.
    ㅇ 원래 생기는 것인지, 최초 VNCVIEWER 접속 후 생기는 건지 모르겠음.
    ㅇ 어쩌다(?) xstartup 파일이 없어 생성하고, 접속해 보고 하다보니 되었음.

#!/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 &                  # 이 행 주석처리하고 아래 행 추가
gnome-session &

-- 7. vncserver 서비스 시작/상태/종료
# service vncserver startup/status/stop

-- 8. 프로세스 확인
    ㅇ 아래에서 블록(포트)를 반드시 써줘야 클라인언트 viewer에서 접속 되더라~!!

   root      2616     1  0 May27 ?        00:00:00 Xvnc :1 -desktop InfraOra:1 (root)
             -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024x768
             -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -pn
   root      2646     1  0 May27 ?        00:00:00 vncconfig -iconic
   root     14013     1  0 12:52 pts/4    00:00:00 Xvnc :2 -desktop InfraOra:2 (root)
             -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry 1024x768
             -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5902 -pn
   root     14020     1  0 12:53 pts/4    00:00:00 vncconfig -iconic
   root     14180 13566  0 12:53 pts/4    00:00:00 grep vnc

-- 9. 자동 Start 설정
# chkconfig vncserver on

-- 10. VNC VIEWER 접속
    ㅇ 다른 방법이 있는지 모르겠지만 포트를 써줘야만 연결 되었음.
    ㅇ 방화벽 처리와 Port 설정은 모름(걍~ 테스트 서버라 다 오픈).



반응형

+ Recent posts