It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In RegisterIt looks like you're new here. If you want to get involved, click one of these buttons!
nano /etc/apt/sources.list
deb http://ubuntu-archive.mirror.serveriai.lt/ precise main restricted universe
deb http://ubuntu-archive.mirror.serveriai.lt/ precise-updates main restricted universe
deb http://ubuntu-archive.mirror.serveriai.lt/ precise-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu precise partner
Save and proceed to next step.apt-get update
apt-get upgrade
Use apt-get to install GNOME and necessary font packages:apt-get install gnome-core xfonts-100dpi xfonts-100dpi-transcoded xfonts-75dpi xfonts-75dpi-transcoded xfonts-base
apt-get remove network-manager
apt-get install vnc4server
adduser vncuser
mkdir -p /etc/vncserver
touch /etc/vncserver/vncservers.conf
nano /etc/vncserver/vncservers.conf
Add the following lines to the file:
VNCSERVERS="1:vncuser"
VNCSERVERARGS[1]="-geometry 1024x768"
Since we'll want the VNC server to start on boot, we'll need to create a service for it. In the next steps, we'll be creating a service script for this purpose. Simply copy and paste the code below into the file:
touch /etc/init.d/vncserver
chmod +x /etc/init.d/vncserver
nano /etc/init.d/vncserver
Contents of /etc/init.d/vncserver:
#!/bin/bash
### BEGIN INIT INFO
# Provides: vncserver
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: vnc server
# Description:
#
### END INIT INFO
unset VNCSERVERARGS
VNCSERVERS=""
[ -f /etc/vncserver/vncservers.conf ] && . /etc/vncserver/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
Register the service:update-rc.d vncserver defaults 99
su vncuser
vncpasswd
We need to start then stop the server to generate a configuration file:vncserver :1; vncserver -kill :1
nano ~/.vnc/xstartup
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
gnome-session --session=gnome-classic &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# x-window-manager &
Drop back to root shell:exit
service vncserver start