Setting up GUI Desktop on a VM: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(37 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Draft}}
<translate>
These instructions are for the Ubuntu operating system:
<!--T:1-->
<languages />


<!--T:3-->
Some software that you can install on your virtual machine (VM, or instance) are only, or best accessed, through their graphical user interface (GUI). It is possible to use a GUI through SSH + X11 forwarding. However, you may observe better performance when using VNC to connect to a remote desktop running on your VM.
<!--T:4-->
Below, we outline steps for setting a remote desktop with VNC. Please note that these instructions are for a VM running a Ubuntu operating system.
<!--T:5-->
<ol>
<ol>
<li>install MATE
<li>Install a GUI Desktop on your VM.<br/>
There are lots of different Desktop packages available. For example some common Desktop packages available for the Ubuntu operating system are:
* [https://ubuntuunity.org/| ubuntu-unity-desktop]
* [https://ubuntu-mate.org/| ubuntu-mate-desktop]
* [https://lubuntu.net/| lubuntu-desktop]
* [https://xubuntu.org/screenshots/| xubuntu-desktop]
* [https://www.xfce.org/| xfce4]
* ubuntu-desktop
* [https://kde.org/plasma-desktop/| kde-plasma-desktop]
* ubuntu-desktop-minimal
* [https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment)| cinnamon]
* [https://ice-wm.org/| icewm]
 
<!--T:2-->
[https://cloudinfrastructureservices.co.uk/best-ubuntu-desktop-environments This article] shows a few of these different desktops. Below are the commands to install the MATE desktop.
{{Commands
{{Commands
|sudo apt update
|sudo apt update
|sudo apt upgrade -y
|sudo apt upgrade -y
|sudo apt install ubuntu-mate-desktop}}
|sudo apt install ubuntu-mate-desktop}}
During the installation of the <code>ubuntu-mate-desktop</code> package it will ask you to choose the default display manager, a good option is <code>lightdm</code>. Installing the <code>ubuntu-mate-desktop</code> package can take a fair amount of itme (maybe something like 15-30 mins?).
During the installation of the <code>ubuntu-mate-desktop</code> package it will ask you to choose the default display manager, a good option is [https://en.wikipedia.org/wiki/LightDM|<code>lightdm</code>]. Installing the <code>ubuntu-mate-desktop</code> package can take a fair amount of time (something like 15-30 mins).
</li>
</li>
<li>install tightvncserver
<li>Install TigerVNC server.<br/>
{{Command|sudo apt install tightvncserver}}
This software runs on your VM and allows you to use the GUI desktop you installed in step 1. remotely using a client software.
For details about using VNC servers and clients see our docs on [[VNC]].
{{Command|sudo apt install -y tigervnc-common tigervnc-standalone-server}}
This command will install the TigerVNC server and some supporting software. For details about using VNC servers and clients see our docs on [[VNC]].
</li>
</li>
<li>configuring tightvncserver
<li>Start the vnc server
{{Command
{{Command
|vncserver
|vncserver
Line 20: Line 43:
-> enter a password
-> enter a password
-> enter "n" for view-only password
-> enter "n" for view-only password
}} vncpasswd command can be used to change password later
}} The first time you start a vnc server it will ask you to set a password. This password is used later when connecting to the vnc desktop. You don't need a view-only password. The <code>vncpasswd</code> command can later be used to change your password.
</li>
</li>
<li>Open port <code>5901</code> and test connection (see [[OpenStack#Security_Groups security groups]] for more information about opening ports to your VMs with OpenStack). However, this is not secure as the data sent to and from your VM will not be encrypted.
<li>Test your connection by opening port <code>5901</code> (see [[Managing_your_cloud_resources_with_OpenStack#Security_Groups | security groups]] for more information about opening ports to your VMs with OpenStack) and connecting using a VNC viewer, for example [https://tigervnc.org/ TigerVNC]. However, this is not a secure connection; data sent to and from your VM will not be encrypted. This is only meant to test your server-client connection before connecting securely with an SSH tunnel (the next step). If you are confident in your ability to setup an SSH tunnel, you may skip this step.
</li>
</li>
<li>Connect using an SSH tunnel
<li>Connect using an SSH tunnel (see [[SSH_tunnelling]]). There is [[VNC#Compute_Nodes|an example of creating an SSH tunnel to a VNC server running on a compute node of one of our clusters]].
See [[SSH_tunnelling]]. There is an example of creating an SSH tunnel to a VNC server running on a compute node of one of our clusters here: [[VNC#Compute_Nodes]]
Below are instructions for connecting using an SSH tunnel for linux or mac:  
*Open your terminal
*Type the following in your local terminal: <code>SSH -i filepathtoyoursshkey/sshprivatekeyfile.key -L5901:localhost:5901 ubuntu@ipaddressofyourVM</code>
*Start your VNC viewer.
*In the VNC server field enter: <code>localhost:5901</code>.
*Your GUI desktop for your remote session should now open
</li>
</li>
<li>Close port 5901. Once you have you are connecting to your VNC server using an SSH tunnel you no longer require port 5901 open so it is recommended that you remove this rule from your security groups. (see [[OpenStack#Security_Groups security groups]] for more information).
<li>Close port <code>5901</code>. Once you are connected to your VNC server using an SSH tunnel, you no longer require port 5901 open so it is recommended that you remove this rule from your security groups. (see [[Managing_your_cloud_resources_with_OpenStack#Security_Groups|security groups]] for more information).
</li>
</li>
<li>To stop the vncserver
<li>Once you are finished using the remote desktop you may stop the vncserver with:
{{Command|vncserver -kill :1}}
{{Command|vncserver -kill :1}}
</ol>
</ol>
</translate>
[[Category:Cloud]]

Latest revision as of 21:01, 27 February 2023

Other languages:

Some software that you can install on your virtual machine (VM, or instance) are only, or best accessed, through their graphical user interface (GUI). It is possible to use a GUI through SSH + X11 forwarding. However, you may observe better performance when using VNC to connect to a remote desktop running on your VM.

Below, we outline steps for setting a remote desktop with VNC. Please note that these instructions are for a VM running a Ubuntu operating system.

  1. Install a GUI Desktop on your VM.
    There are lots of different Desktop packages available. For example some common Desktop packages available for the Ubuntu operating system are: This article shows a few of these different desktops. Below are the commands to install the MATE desktop.
    [name@server ~]$ sudo apt update
    [name@server ~]$ sudo apt upgrade -y
    [name@server ~]$ sudo apt install ubuntu-mate-desktop
    

    During the installation of the ubuntu-mate-desktop package it will ask you to choose the default display manager, a good option is lightdm. Installing the ubuntu-mate-desktop package can take a fair amount of time (something like 15-30 mins).

  2. Install TigerVNC server.
    This software runs on your VM and allows you to use the GUI desktop you installed in step 1. remotely using a client software.
    Question.png
    [name@server ~]$ sudo apt install -y tigervnc-common tigervnc-standalone-server
    

    This command will install the TigerVNC server and some supporting software. For details about using VNC servers and clients see our docs on VNC.

  3. Start the vnc server
    Question.png
    [name@server ~]$ vncserver
    -> enter a password
    -> enter "n" for view-only password
    
    The first time you start a vnc server it will ask you to set a password. This password is used later when connecting to the vnc desktop. You don't need a view-only password. The vncpasswd command can later be used to change your password.
  4. Test your connection by opening port 5901 (see security groups for more information about opening ports to your VMs with OpenStack) and connecting using a VNC viewer, for example TigerVNC. However, this is not a secure connection; data sent to and from your VM will not be encrypted. This is only meant to test your server-client connection before connecting securely with an SSH tunnel (the next step). If you are confident in your ability to setup an SSH tunnel, you may skip this step.
  5. Connect using an SSH tunnel (see SSH_tunnelling). There is an example of creating an SSH tunnel to a VNC server running on a compute node of one of our clusters. Below are instructions for connecting using an SSH tunnel for linux or mac:
    • Open your terminal
    • Type the following in your local terminal: SSH -i filepathtoyoursshkey/sshprivatekeyfile.key -L5901:localhost:5901 ubuntu@ipaddressofyourVM
    • Start your VNC viewer.
    • In the VNC server field enter: localhost:5901.
    • Your GUI desktop for your remote session should now open
  6. Close port 5901. Once you are connected to your VNC server using an SSH tunnel, you no longer require port 5901 open so it is recommended that you remove this rule from your security groups. (see security groups for more information).
  7. Once you are finished using the remote desktop you may stop the vncserver with:
    Question.png
    [name@server ~]$ vncserver -kill :1