VNC install on Ubuntu 14.04
VNC install on Ubuntu 14.04
ubuntu를 자주 사용하다 보니 vnc 서버를 desktop에 설정하여 사용하게 되었습니다.
제가 읽기 편하게 작성된 글이니 혹시나 필요하신분들 참조하세요 ^^
1. Ubuntu 14.04 – Gnome Desktop 및 vnc 설치
- 우분투 14.04 에서 Gnome deskstop 을 설치하고 vnc 서버를 통해서 사용하는 방법
- 우분투 12.04 도 크게 차이가 없으니 참고하여 설치
1.1. Install gui on ubuntu server 14.04
- $ sudo apt-get install --no-install-recommends ubuntu-desktop
- Use –no-install-recommends 정보는 GUI를 최소 설치
- 설치 중에 gdm 선택하는 화면이 한번 뜹니다. gdm을 선택
1.2. Install VNC server on ubuntu 14.04
1.2.1. Start installing below gnome packages which helps VNC to load properly
- $ sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-termina
- ubuntu desktop에 요구 되는 package 설치
1.2.2. Now install vnc4server package.
- $ sudo apt-get install vnc4server
1.2.3. Open /usr/bin/vncserver file and edit as follows
- $ sudo cp /usr/bin/vncserver /usr/bin/vncserver.bkp
- $ sudo vim /usr/bin/vncserver
- 57번 라인을 찾아서 수정
"# exec /etc/X11/xinit/xinitrc\n\n".
"gnome-panel &\n".
"gnome-settings-daemon &\n".
"metacity &\n".
"nautilus &\n".
"gnome-terminal &\n".
|
1.2.4. Now type the command vncserver to start VNC session
- vnc password 생성 prompt가 나옴
- 암호는 최소 6자리 최대 8자리
$ vncserver
You will require a password to access your desktops.
Password:******
Verify:******
xauth: file /home/boby/.Xauthority does not exist
New 'leela:1 (tmkwon)' desktop is leela:1
Creating default startup script /home/tmkwon/.vnc/xstartup
Starting applications specified in /home/tmkwon/.vnc/xstartup
Log file is /home/krizna/.vnc/leela:1.log
|
1.2.5. xstartup 편집
- 기본으로 설치되는 xstartup 파일을 변경해서 기본 창 관리자를 metacity 로 변경
- 우분투 기본으로 설치되는 unity 는 인터페이스가 너무 난해해서 보통 변경해서 사용
- root 로 실행시는 /root/.vnc/xstartup 이고 vnc 서버를 실행하는 사용자 계정별로 ~/.vnc/xstartup 파일을 편집
#!/bin/sh
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-window-manager &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus -n &
|
1.2.6. vnc 암호 변경시 사용
- # vncpasswd
1.2.7. Now you can view your remote desktop using IP address and port
- Exam : 192.168.1.10:1
1.3. VNC server as service
1.3.1. Create a file vncserver in /etc/init.d/ directory
- vnc 서비스 스크립트를 만들어서 서버 재부팅 시에 자동으로 시작하도록 설정
- service 명령어를 이용해서 vnc 서비스를 실행 또는 종료하도록 설정
- $ sudo /etc/init.d/vncserver
#!/bin/bash
### BEGIN INIT INFO
# Provides: VNCSERVER
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO
unset VNCSERVERARGS
VNCSERVERS=""
[ -f /etc/vncservers.conf ] && . /etc/vncservers.conf
prog=$"VNC server"
start() {
. /lib/lsb/init-functions
REQ_USER=$2
echo -n $"Starting $prog: "
ulimit -S -c 0 >/dev/null 2>&1
RETVAL=0
for display in ${VNCSERVERS}
do
export USER="${display##*:}"
if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then
echo -n "${display} "
unset BASH_ENV ENV
DISP="${display%%:*}"
export VNCUSERARGS="${VNCSERVERARGS[${DISP}]}"
su ${USER} -c "cd ~${USER} && [ -f .vnc/passwd ] && vncserver :${DISP} ${VNCUSERARGS}"
fi
done
}
stop() {
. /lib/lsb/init-functions
REQ_USER=$2
echo -n $"Shutting down VNCServer: "
for display in ${VNCSERVERS}
do
export USER="${display##*:}"
if test -z "${REQ_USER}" -o "${REQ_USER}" == ${USER} ; then
echo -n "${display} "
unset BASH_ENV ENV
export USER="${display##*:}"
su ${USER} -c "vncserver -kill :${display%%:*}" >/dev/null 2>&1
fi
done
echo -e "\n"
echo "VNCServer Stopped"
}
case "$1" in
start)
start $@
;;
stop)
stop $@
;;
restart|reload)
stop $@
sleep 3
start $@
;;
condrestart)
if [ -f /var/lock/subsys/vncserver ]; then
stop $@
sleep 3
start $@
fi
;;
status)
status Xvnc
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
|
1.3.2. Modify execute permission for the file.
- $ sudo chmod -x /etc/init.d/vncserver
1.3.3. Create vncservers.conf file in /etc/ directory as stated in service code.
1.3.3.1. 기본 사용자 설정
- VNCSERVERS 정보에는 vncserver 사용자명 입력
- vnc session을 사용한 사용자와 server 크기 정보를 수정
- $ sudo vim /etc/vncservers.conf
VNCSERVERS="1:krizna"
VNCSERVERARGS[1]="-geometry 1024x768"
|
1.3.3.2. For additional vnc users.
- Login into the user
- krizna@leela:~$ su - bobby
- Create VNC password by the below command
bobby@leela:~$ vncpasswd
Password:
Verify:
|
- vncpasswd 등록한 사용자 vncservers.conf에 추가 등록
- $ sudo vim /etc/vncservers.conf
VNCSERVERS="1:krizna 2:bobby"
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[2]="-geometry 1024x768"
|
1.3.4. Issue the below command to add vncserver service to default runlevels
- $ sudo update-rc.d vncserver defaults
1.3.5. Now start/restart the service
- $ sudo /etc/init.d/vncserver start
- $ sudo /etc/init.d/vncserver restart
1.3.6. VNC Port info
- 5901
1.4. vnc viewer
- vnc viewer 로 접속
- vncviewer ip:num
- exam
- $ vncviewer 10.0.0.47:1
1.5. URL
- How to install VNC server on ubuntu 14.04
- 내용이 영어이지만 더 자세함
- Ubuntu 14.04 – Gnome Desktop 및 vnc 설치
- 한국어 버전
- VNC ( Virtual Network Computing )
Google drive file
https://docs.google.com/document/d/1j6LEgr54Zbb1CPbv-zakrwMIaZPNsK3mwn3iO8SqrCA/edit?usp=sharing
댓글
댓글 쓰기