deprecated | author | description | keywords | tags | license | aliases | modified | modified_by | published | title | external_resources | relations | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
true |
|
How to install and connect to a desktop environment on your Linode |
|
|
[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0) |
|
2014-08-21 |
|
2014-04-10 |
Using VNC to Operate a Desktop on Ubuntu 12.04 |
|
|
This guide details how to install a graphic desktop environment on your Linode running Ubuntu 12.04 and connect to it from your local computer using VNC.
-
Before you begin it's good practice to make sure your system is up to date:
sudo apt-get update sudo apt-get upgrade
-
Ubuntu has several desktop environments available in its repositories. The following command installs the default desktop, Unity:
sudo apt-get install ubuntu-desktop
-
Next install the VNC server:
sudo apt-get install vnc4server
The default VNC connection is unencrypted. In order to secure your passwords and data, you will need to tunnel the traffic through an SSH connection to a local port.
-
From your desktop, connect to your Linode with the following command. Be sure to replace user@example.com with your username and your Linode's hostname or IP address:
ssh -L 5901:127.0.0.1:5901 user@example.com
-
Launch the VNC server manually to test your connection. You will need to specify a password to use:
vncserver :1
-
Initiate your connection as per the steps listed in the following section.
-
Open PuTTY and navigate under the
SSH
menu toTunnels
. Add a new forwarded port as shown below, replacing example.com with your Linode's IP address or hostname: -
Return to the 'Session' screen. Enter your Linode's hostname or IP address and a title for your session. Click save to save your settings for future use, and then click open to initiate your SSH tunnel.
-
Launch the VNC server manually to test your connection. You will need to specify a password to use:
vncserver :1
-
Initiate your connection as per the steps listed in the following section.
While there are many options for OS X and Windows, this guide will use RealVNC Viewer.
-
After installing and opening the viewer, connect to the localhost through your VNC client :
-
You will be warned that the connection is unencrypted, however if you have followed the steps above for securing your VNC connection, your session will be securely tunneled to your Linode. To proceed, press Continue.
-
You will be prompted to enter the password you specified when first launching the VNC Server. See Secure your VNC Connection if you have not yet started a VNC server on your Linode.
-
After connecting you will be greeted with a terminal emulator window.
In the next section we will configure your Linode to launch a full desktop.
There are a variety of VNC clients available for Ubuntu desktops. You can find the list here. For this guide, we'll be using Remmina, which is installed by default.
-
Open Remmina.
-
Click the button to
Create a new remote desktop profile
. Name your profile, specify the VNC protocol, and enter localhost :1 in the server field. Be sure to include the:1
in theServer
section. In the password section fill in the password you specified in Secure your VNC connection: -
Press Connect.
In the next section we will configure your Linode to launch a full desktop.
In the next few steps we'll configure VNC to launch the full Gnome desktop.
-
Once you've successfully connected, exit the connection. Close the VNC server:
vncserver -kill :1
-
In your preferred text editor, open the xstartup file in your home folder under the
.vnc
directory:{{< file "~/.vnc/xstartup" >}} #!/bin/sh
[ -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" & x-window-manager &
{{< /file >}}
-
Edit the last line of the file, replacing it with the following:
gnome-session &
-
Save and exit the file. Begin another VNC session:
vncserver :1
You should now see the full Ubuntu Desktop:
Below we've outlined optional steps to ensure that the VNC server starts automatically after reboot.
-
Open your crontab. If you've never edited it before, you may be prompted to choose a text editor:
crontab -e no crontab for user - using an empty one Select an editor. To change later, run 'select-editor'. 1. /bin/ed 2. /bin/nano <---- easiest 3. /usr/bin/vim.basic 4. /usr/bin/vim.tiny Choose 1-4 [2]:
-
Add
@reboot /usr/bin/vncserver :1
to the bottom of the file. Your crontab should look like this:{{< file "crontab" >}}
@reboot /usr/bin/vncserver :1
{{< /file >}}
- Save and exit the file. Test by rebooting your Linode and attempting to connect to the VNC server.