How to set up GUI and graphical environment on VMs running Linux
Case description
You need to use graphical applications on VM instances running Linux.
Solution
There are several options that allow you to use a graphical desktop environment on Linux VMs:
You can connect to a VM over remote access protocols, such as VNC or RDP. To do this, follow these steps:
- Install the desktop environment.
- Install the
xrdportightvncserverpackage to connect over RDP or VNC, respectively.
We recommend combining the use of a VNC server only listening to localhost, and an SSH tunnel. Thus you will prevent interception of a VNC session to your VM, encrypt VNC traffic, and exclude one of the possible ways of compromising access to your VM.
Check this guide
You can forward a GUI of an application running within an Xorg session on your VM, to your local computer. There are numerous articles online on how to do this. For Microsoft Windows®, you can use the Xming
- Install any desktop environment (e.g., KDE, Gnome, XFCE, LXQT, Cinnamon, etc.) on your VM. You can just install the metapackage of the desktop environment you need. All required dependencies, including Xorg, will be installed automatically.
- Set up Xorg forwarding in your SSH client and connect to the VM.
- Start the graphical application from within the SSH session.
- The GUI of the application you need will be rendered in a separate window.
You can use Terraform to create a VM with the pre-installed graphical environment. You can use the basic Terraform scenario from this article
-
Run a ready-made lightweight Ubuntu image with the pre-installed LXDE graphical environment and x11vnc VNC server:
docker run -p 127.0.0.1:6080:80 -e HTTP_PASSWORD=<your_password> -v /dev/shm:/dev/shm dorowu/ubuntu-desktop-lxde-vnc -
After running a container, forward port
6080to your VM. -
Open
http://<address>:6080in your browser and sign in using therootlogin and your password. Use the left-hand menu for clipboard and pressing additional keys (Ctrl,Alt,Win, andTab). -
Install and run the graphical application.
Alert
Our support team does not provide advice on the setup and use of third-party software on VM instances. Yandex Cloud users are solely responsible for administering operating systems, setting up third-party software, and writing code in various programming languages.