Install LXDE Desktop with TightVNC

From Embedded Workshop
Jump to navigation Jump to search

NC: Virtual Network Computing
On your server, begin by updating your list of packages:

$ sudo apt-get update

Install LXDE - Lubuntu Desktop (This is a rather bloated selection that includes the kitchen sink)

    • This installation took many minutes...
$ sudo apt-get install -y lubuntu-desktop
$ sudo reboot

Stop and check diskspace:

ubuntu@ip-172-31-26-122:~$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1       8065444 3829584   4219476  48% /

Check RAM utilization:

ubuntu@ip-172-31-23-78:~$ free
              total        used        free      shared  buff/cache   available
Mem:        1007528      180620      514904        3972      312004      679388
Swap:             0           0           0

Alternatively, Install Minimal LXDE

$ sudo apt-get install lubuntu-core
$ sudo apt-get install firefox --no-install-recommends
$ sudo reboot

Once the desktop environment is in place, install the TightVNC service:

$ sudo apt-get install tightvncserver

Stop and check diskspace:

ubuntu@ip-172-31-23-78:~$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/xvda1       8065444 3836632   4212428  48% /

Run the following to create the password(s) and configuration files for your VNC service:
Password must be between six and eight characters in length.
Passwords longer than eight characters will be truncated.
At this time, you can also create a "View Only" password.

$ tightvncserver

We will now configure the VNC service, but first, we must stop the service: (use either one)

$ vncserver -kill :1
$ tightvncserver -kill :1

We are going to be modifying the xstartup file. Before doing that, copy the original file:

$ cp ~/.vnc/xstartup ~/.vnc/xstartup.bak

Edit the xstartup file

$ sudo nano ~/.vnc/xstartup

Commands in this file are executed whenever you start or restart the VNC service. We need VNC to start our desktop environment if it isn't already started. Edit the xstartup file as follows:

#!/bin/sh
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
#autocutsel -fork
openbox &
/usr/bin/lxsession -s Lubuntu &

Now, restart the VNC service:

$ vncserver

To connect a VNC client, we need to open access to port 5901 (default port number for VNC)

Security Groups -> launch-wizard-1, click on "Inbound" tab
Click Edit
Click "Add Rule" in the Edit inbound rules dialog box
Custom TCP Rule, TCP, 5901, Anywhere 0.0.0.0/0,::/0 , VNC Port

Determine the VNC port number open on the server:

$ cd ~/.vnc
$ ll               (alias for ls -al)
$ cat *2.log
25/03/19 15:08:41 Xvnc version TightVNC-1.3.10
25/03/19 15:08:41 Copyright (C) 2000-2009 TightVNC Group
25/03/19 15:08:41 Copyright (C) 1999 AT&T Laboratories Cambridge
25/03/19 15:08:41 All Rights Reserved.
25/03/19 15:08:41 See http://www.tightvnc.com/ for information on TightVNC
25/03/19 15:08:41 Desktop name 'X' (ip-172-31-23-78:2)
25/03/19 15:08:41 Protocol versions supported: 3.3, 3.7, 3.8, 3.7t, 3.8t
25/03/19 15:08:41 Listening for VNC connections on TCP port {{#if:|{{#ifexpr:({{#time:U|{{{3}}}}} - {{#time:U|now}}) > 0|5902|5902}}|5902}}
Font directory '/usr/share/fonts/X11/Type1/' not found - ignoring
Font directory '/usr/share/fonts/X11/75dpi/' not found - ignoring
xrdb: No such file or directory
xrdb: can't open file '/home/ubuntu/.Xresources'


If using the Real VNC, VNC Viewer, when entering the host name, also define the port 5901/5902

example:  bill.hopto.org:5901

Once everything appears to be working (more or less)... Install Chromium Web Browser

$ sudo apt install -y chromium-browser


References:
https://homecircuits.eu/blog/lubuntu-installing-vnc-server/