HomeMath IT SupportRemote Access to Math AccountsSetting Up Your VNC Service

7.5. Setting Up Your VNC Service


  • The following steps show you how to set up your own persistent VNC server (i.e. remote desktop) which will run  on a computation server or a  VNC gateway.   When you are done with these steps, you will connect  to the server to start a computation job or access your math network files. 

    Setup: starting up the VNC server

    First you will create a VNC server (i.e. virtual desktop.) You can leave the VNC Server running for weeks or months. However, Please do not run multiple VNC servers on the same machine, or on multiple chivos.

    • Pick a VNC host.
      • For light work via VNC, we provide Phoenix (grads) and Dragon (faculty.)
      • For heavy computation, faculty can use their office desktops, grad students can use the chivos
    • Use SSH to connect to the VNC host. You will need to maintain either a Math VPN connection or a SSH Tunnel to the VNC host while using your vnc viewer.
      • For VNC via Math VPN ,
        • First connect to the MATH VPN
        • Then ssh to the machine (ssh to yourmathaccount@vnchost.math.arizona.edu) Replace vnchost with the machine you are connecting to (e.g. chivo, chivoX, yourdesktopname, dragon or phoenix.)
      • For VNC without Math VPN you will instead create an SSH session w/ Tunneling.
    • Use the command vncserver on the VNC host to create your remote desktop. The command will display the number of your new VNC server. EG: ":7", or ":13". You must remember that number! (Advanced users can specify additional options to vncserver. See the bottom of this page for information.)
    • Your remote desktop is now alive! You can use a VNC viewer to connect to your remote desktop.
    • You will be prompted to set a vnc password the first time you create a session. You will need to use this password every time you connect. If you ever forget this password, you can reset it.

    Setup: starting up the VNC server on Ubuntu 16.04 (e.g. the grad chivos).

    VNC server configurations that work on older versions of Ubuntu may not work on Ubuntu 16.04.  If you start your VNC client and see nothing but a grey screen after connecting to the VNC server, follow these instructions to fix the problem.

    • Decide whether you want an xfce4 or a gnome desktop.  The gnome desktop will probably look more familiar, but the xfce4 desktop will be faster and more responsive.
      • If you decide to try the xfce4 desktop, backup your current ~/.vnc/xstartup file and replace the contents with this:
        #!/bin/sh
        
        startxfce4 &

  • If you decide to stick with the gnome desktop, backup your current ~/.vnc/xstartup file and replace the contents with this:
    #!/bin/sh
    
    export XKL_XMODMAP_DISABLE=1
    unset SESSION_MANAGER
    unset DBUS_SESSION_BUS_ADDRESS
     
    gnome-panel &
    gnome-settings-daemon &
    metacity &
    nautilus &
    gnome-terminal &
After updating your xstartup file, make sure execute permissions are set on it:
bobburton@chivo:~/.vnc$ ls -ld xstartup
-rwxr-xr-x 1 bobburton users  24 Feb 13 10:35 xstartup
Kill your current VNC server process if you have one:
bobburton@chivo:~/.vnc$ ps -ef | grep vnc | grep bobburton
bobburt+ 24506 1 0 08:57 pts/8 00:00:00 Xvnc4 :2 -desktop chivo:2 (bobburton) -httpd /usr/share/vnc-java -auth /u5/bobburton/.Xauthority -geometry 1024x768 -depth 16 -rfbwait 30000 -rfbauth /u5/bobburton/.vnc/passwd -rfbport 5902 -pn -fp /usr/X11R6/lib/X11/fonts/Type1/,/usr/X11R6/lib/X11/fonts/Speedo/,/usr/X11R6/lib/X11/fonts/misc/,/usr/X11R6/lib/X11/fonts/75dpi/,/usr/X11R6/lib/X11/fonts/100dpi/,/usr/share/fonts/X11/misc/,/usr/share/fonts/X11/Type1/,/usr/share/fonts/X11/75dpi/,/usr/share/fonts/X11/100dpi/ -co /etc/X11/rgb
bobburton@chivo:~/.vnc$ vncserver -kill :2
Killing Xvnc4 process ID 24506
bobburton@chivo:~/.vnc$
Restart the VNC server:
bobburton@chivo:~/.vnc$ vncserver -geometry 1680x1000 -depth 24
Found /usr/share/vnc-java for http connections.

New 'chivo:2 (bobburton)' desktop is chivo:2

Starting applications specified in /u5/bobburton/.vnc/xstartup
Log file is /u5/bobburton/.vnc/chivo:2.log

bobburton@chivo:~/.vnc$

  • Many warnings will be spewed to the log file, e.g. ~/.vnc/chivo1:2.log, but none prevent the desktop from running.

How to reset your vnc password

Use ssh to connect to any networked linux machine (e.g.  phoenix, dragon or a chivo) and enter the command "vncpasswd." You will be prompted for a new password.

How to figure out your desktop number

If you've forgotten your desktop number, you can connect to the VNC host via ssh then issue the command:

ps -ef | grep vnc | grep myusername

How to permanently kill your remote desktop

To kill your remote desktops, first use SSH to connect to the VNC host, as described above. To kill a particular desktop, for example desktop number 7, use the command:

vncserver -kill :7

To kill all your desktops at once, use the command:

killall Xvnc4 

You can ignore any "Operation not permitted" error messages.

Advanced VNC Hints

  • The simpler the graphics on your desktop, the less information needs to be transferred, and the faster your VNC connection will be.       
    • Change your desktop background color to a solid color. Use solid white or solid black.
    • Simplify your desktop theme to one that uses rectangular windows, and uses a solid color (as opposed to gradient shading) for controls, window titles, etc.
    • Turn off any graphics, like moving charts or eyeballs that follow the mouse cursor...
  • To make VNC it as fast as possible you can use a smaller desktop, and use fewer bits per pixel. For example: vncserver -depth 8 -geometry 800x600.
  • When you create your VNC server with the command vncserver, you can use a different resolution and/or color depth. You can match your vnc screen resolution to that of your home computer and run your VNC viewer in fullscreen mode.       
    • For example, say your Windows box at home has a display resolution of 1280x1024 at 24 bits/pixel. (To see this information, right-click on the background of the desktop and bring up Properties.)
    • When you create your VNC server, you could use the command vncserver -depth 24 -geometry 1280x1024. (see "man vncserver" for more info.)
    • When you connect from your Windows box, right-click on the titlebar of the outermost VNC window and select "Full Screen". It will tell you the keystrokes to escape from full-screen mode.
    • At this point, instead of seeing Linux inside a VNC window inside Microsoft Windows, all you see in front of you is your remote Linux desktop!
  • Please disable the screensaver on your remote desktop. (Otherwise your virtual desktop will use too many CPU cycles "saving" a non-existent screen.) On our remote desktop gateways, the screensaver has already been disabled - but if you run a VNC server on some other computer, then the first time you connect to your remote desktop, disable your X screensaver (go to Start/Programs/Settings/Desktop/Screensaver).

connect  to the server


This page was: Helpful | Not Helpful