2

I have a server running remotely by ip address 5.231.XX.XXX running Ubuntu 13.10 Operating system. I am using Ubuntu 14.04 on my laptop.

I am able to connect to my server via terminal by ssh login as:

ssh [email protected]

I am also able to connect via nautilus and open its folders.

I have also installed GUI Interface on my server by using commands via ssh login

# sudo apt-get install ubuntu-desktop

Now, how could I be able to connect and view my server remotely with GUI Interface.

2 Answers 2

9

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

1
  • Wow! Good one! (and an upvote!)
    – Fabby
    Mar 10, 2015 at 22:15
0

Before beginning, ensure you are logged in to your VPS as the root user, and run the following:

apt-get update
apt-get upgrade
  1. Install GNOME:

    apt-get install gnome-desktop-environment
    
  2. Install required fonts:

    apt-get install xfonts-100dpi
    apt-get install xfonts-100dpi-transcoded
    apt-get install xfonts-75dpi
    apt-get install xfonts-75dpi-transcoded
    apt-get install xfonts-base
    
  3. Install TightVNCServer:

    apt-get install tightvncserver
    
  4. Start TightVNCServer for the first time, it will copy config files and prompt you for a password:

    tightvncserver :1
    
  5. Stop the VNC server, so we can continue to configure it:

    tightvncserver -kill :1
    
  6. Edit the xstartup file:

    vi ~/.vnc/xstartup
    

    Press "A" to enter edit mode. Replace the contents of the file with the following (or edit to match):

    /bin/shxrdb $HOME/.Xresources
xsetroot -solid grey
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
# x-window-manager &
gnome-session &
    

    Press ESC, type :wq, then press enter to save and close the file.

  7. Start the VNC server with your desired resolution:

    tightvncserver -geometry 1024x768 :1
    

You can now access your server's remote GNOME desktop with a desktop VNC client. Enter your server's main IP address, Port 1 (or 5901, alternately), and the password you set earlier to connect to the desktop.

Use this Program : https://www.realvnc.com/download/viewer/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .