Friday, 22 February 2013

Homeserver - Setting up VNC

You will probably learn to do most things on the server over SSH, but it is always nice to have a VNC session that you can use if there is any GUI applications you need to setup. I decided to go with XFCE as my shell as it is lightweight (perfect for occasional use).

  • Update your repo references - sudo apt-get update
  • Install XFCE - sudo apt-get install xfce4
  • Get a cup of tea, it will take a few minutes to install :)
  • Install the VNC server - sudo apt-get install vnc4server
  • Launch the VNC server - vncserver
  • Enter a password, this will be required every time you try to log on to a VNC session.
  • Kill the session we created - vncserver -kill :1
  • Edit the VNC xstartup file - vi ~/.vnc/xstartup
  • Your file should look like the following:
# Uncomment the following two lines for normal desktop:
# exec /etc/X11/xinit/xinitrc

[ -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" &
startxfce4 &
  • You are now ready to launch VNC, you can specify the resolution of the screen while launching -  vncserver -geometry 1920x1080
  • When you log in to the server using a VNC client (I recommend VNC viewer or Tight VNC) you should get the below:
VNC session using the XFCE shell
  • Now you are ready to go! You can have multiple VNC sessions that are different resolutions for different devices. 

No comments:

Post a Comment