You can use vnc for gui access to server.
Install the VNC-server
apt-get install vnc4server
Please make sure that you are using only vnc-server & no other VNC-server are installed as this could give errors in future mostly that clipboard sharing between the host Ubuntu Server & vnc-client machine. You can check it as follows:
xxx@yyy ~ $ sudo dpkg -l | grep vnc
ii vnc4server 4.1.1+xorg4.3.0-37ubuntu5 amd64 Virtual network computing server software
xxx@yyy ~ $
Please uninstall if tightvnc or anything similar installed.
Adding VNC user
In my case I am using user=sssss it will differ in your case. You can use any username for the same.
adduser sssss
xxx@server1:~$ sudo adduser sssss
Adding user `sssss' ...
Adding new group `sssss' (1001) ...
Adding new group `sssss' (1001) ...
Adding new user `sssss' (1001) with group `sssss' ...
Creating home directory `/home/sssss' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: <--yourpassword
Retype new UNIX password: <--yourpassword
passwd: password updated successfully
Changing the user information for sssss
Enter the new value, or press ENTER for the default
Full Name []: <--ENTER
Room Number []: <--ENTER
Work Phone []:<--ENTER
Home Phone []:<--ENTER
Other []:<--ENTER
Is the information correct? [Y/n]<--ENTER
Start the vncserver with the user, for this use:
su - srijan
vncserver
It will see:
sssss@server1:~$ vncserver
You will require a password to access your desktops.
Password:<--Put your VNC password
Verify:<--Put your VNC password
Password too long - only the first 8 characters will be used
xauth: file /home/sssss/.Xauthority does not exist
New 'server1:1 (sssss)' desktop is server1:1
Creating default startup script /home/sssss/.vnc/xstartup
Starting applications specified in /home/sssss/.vnc/xstartup
Log file is /home/sssss/.vnc/server1:1.log
sssss@server1:~$
Make backup of the original file & then make the configuration
cp ~/.vnc/xstartup ~/.vnc/xstartup.bak > ~/.vnc/xstartup
vi ~/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
Make the startup script for the vncserver
sudo vi /etc/init.d/vncserver
#!/bin/bash
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
Make it executable:
chmod +x /etc/init.d/vncserver
Make the configuration file for the vncserver by creating file as follows:
mkdir -p /etc/vncserver
vi /etc/vncserver/vncservers.conf
Give the entries like this.
VNCSERVERS="1:sssss"
VNCSERVERARGS[1]="-geometry 1024x768"
Add it into boot startups:
update-rc.d vncserver defaults 99
xxx@server1:~$ sudo update-rc.d vncserver defaults 99
Adding system startup for /etc/init.d/vncserver ...
/etc/rc0.d/K99vncserver -> ../init.d/vncserver
/etc/rc1.d/K99vncserver -> ../init.d/vncserver
/etc/rc6.d/K99vncserver -> ../init.d/vncserver
/etc/rc2.d/S99vncserver -> ../init.d/vncserver
/etc/rc3.d/S99vncserver -> ../init.d/vncserver
/etc/rc4.d/S99vncserver -> ../init.d/vncserver
/etc/rc5.d/S99vncserver -> ../init.d/vncserver
xxx@server1:~$
Reboot the machine.
To access server you can user any vnc
client app, list is here