I.K.Picture & IT Info.

[Ubuntu] xfce4를 활용한 GUI 원격 (VNC) 본문

Desktop and Mobile/Linux

[Ubuntu] xfce4를 활용한 GUI 원격 (VNC)

helpful-intruder 2018. 10. 2. 13:38
반응형

xfce4 사용시 문제가되는 부분이 있을 수도 있는 팁에 대해 아래 포스터에 있습니다.

2018/09/11 - [Desktop and Mobile/Linux] - xfce4 desktop 환경에서 터미널 Tab 이 안될 경우



리눅스의 경우 VNC로 GUI 원격을 할 수가 있습니다.


apt를 통해 설치하면됩니다. 


$sudo apt install xfce4 xfce4-goodies tightvncserver 


설치 한 후에 몇가지 설정을 해줘야합니다.


1. 비밀번호 설정


$vncserver   //얘를 작성후 엔터하면 아래와 같이 비밀번호를 설정하라고 나옵니다 

You will require a password to access your desktops.


Password: 

Verify:   

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

Password: 

Verify:   


New 'X' desktop is datacube:1


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

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

Log file is /home/intruder/.vnc/datacube:1.log


$ vncserver -kill :1    //그 다음 설정을 위해 vncserver를 종료해줍니다.


2. 리눅스 실행과 동시에 작동하도록 init.d에 등록


$sudo vi /etc/init.d/vncserver 


vncserver 내용

#!/bin/bash

### BEGIN INIT INFO

# Provides:          vncserver

# Required-Start:    networking

# Required-Stop:     networking

# Default-Start:     2 3 4 5

# Default-Stop:      0 1 6

### END INIT INFO


PATH="$PATH:/usr/bin/"

export USER="intruder"               ##사용자 이름으로 변경해주세요


DISPLAY="1"

DEPTH="16"

GEOMETRY="1024x768"


OPTIONS="-depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"


. /lib/lsb/init-functions


case "$1" in

  start)

    log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"

    su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"

  ;;

  stop)

    log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}"

    su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"

  ;;

  restart)

    $0 stop

    $0 start

  ;;

esac

exit 0 


다음 실행 권한을 변경 후 init.d를 업데이트해줍니다.

$ sudo chmod +x /etc/init.d/vncserver 

$ sudo update-rc.d vncserver defaults



3. 원격 실행 시 수행되는 프로그램 설정

  vnc 설정파일에 아래와 같이 내용을 추가해줍니다.


만약 추가적으로 원격을 실행했을 때 자동으로 실행되면 좋겠다 하는 프로그램이 있으면 다음 설정에 추가해주면됩니다.

위치  :   ~/.vnc/xstartup


#!/bin/sh


xrdb $HOME/.Xresources

xsetroot -solid grey

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

#x-window-manager &

# Fix to make GNOME work

export XKL_XMODMAP_DISABLE=1

/etc/X11/Xsession 


startxfce4 &


아까 분명 vncserver를 정리했기 때문에 다시 실행해줘야겠죠??

$vncserver

vncViewer 같은 경우 전 Real VNC Viewer 를 씁니다.


https://www.realvnc.com/en/connect/download/viewer/


기본 우분투(유니티) UI와는 다르지만 그래도 뭔가 친근한 UI로 원격 GUI를 사용할 수 있습니다 :)





최근에 XRDP로 하는 방법이 좀 더 간편하다는것을 확인했습니다. 

조만간 정리해서 올릴 예정입니다. 

반응형
Comments