Let's suppose that for some reason you need to install a graphical user interface on Linux running Ubuntu Server that you want to connect to using Remote Desktop from a Windows machine. Here is how to do that.
Install the following packages:
sudo apt-get install -y ubuntu-desktop gnome-session-fallback tightvncserver xrdp
gnome-session-fallback will install a desktop environment,
tightvncserver will install a VNC server and
xrdp will install an RDP server that you can connect to with Remote Desktop (it uses the RDP protocol).
Now we need to set up it all up.
mkdir -p ~/.vnc echo password | vncpasswd -f > ~/.vnc/passwd chmod 600 ~/.vnc/passwd
Make sure that the desktop environment is launched when you connect with VNC:
cat > ~/.vnc/xstartup <<EOF export XKL_XMODMAP_DISABLE=1 unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS gnome-panel & gnome-settings-daemon & metacity & nautilus & gnome-terminal & EOF chmod +x ~/.vnc/xstartupdef
xrdp will actually connect to the VNC server so we need to configure
sudo bash -c 'cat > /etc/xrdp/xrdp.ini <<EOF [globals] bitmap_cache=yes bitmap_compression=yes port=3389 crypt_level=low channel_code=1 [vnc1] name=vncserver lib=libvnc.so ip=localhost port=5901 username= password=password EOF'
Silence some warnings about non-existing files/folders:
touch ~/.Xauthority mkdir -p ~/.config
Let's start the VNC server:
Now you should be able to connect to your server.
- VNC: port
5901, no username, password:
- Remote Desktop: port
3389, no username, no password
This is what it will look like:
If you need to, you can stop the VNC server with:
vncserver -kill :1
Ubuntu Desktop requires downloading about 500 MB of packages and an additional 2 GB of disk space. If that's too much, you can install a more lightweight desktop environment called Xfce. It's just 45 MB of packages that use an extra 175 MB of space.
Install it like this:
sudo apt-get install -y xfce4 tightvncserver xrdp
Here's is the startup configuration file:
cat > ~/.vnc/xstartup <<EOFstartxfce4 & EOF chmod +x ~/.vnc/xstartup
This is what it looks like:
Only use this on a computer on a local network or in Vagrant, or secure the ports
3389 in the firewall.
By default anyone will be able to connect to the server via Remote Desktop and VNC is password protected with a very weak password.
Tested with Ubuntu Server 14.04 LTS using Vagrant.