Install LXDE with VNC in Debian server
As everyone knows, Linux / Unix server is used by more people as a server than Windows server because it is lighter and faster. Moreover, Linux / Unix server is mostly open source, large community, easy to customize. But for newbies, working with the command line is not an easy challenge. So in this article, I will guide you to install LXDE desktop environment and VNC.
Note 1: If you really need the GUI (interface), you can follow this article. I do not recommend installing GUI for large web servers. Once you've decided to use Linux / Unix based, you should learn to use about the command line.
Note 2: This tutorial is only for Debian OS and some Debian-based OS like Ubuntu. It works well inside an unprivileged LXC container VPS
# A little conceptual.
If you are wondering what the desktop environment is, you can simply think of it as the interface, which is what you see on the screen instead of just the command line. It makes it possible to run applications that require graphical user interfaces, or GUIs in short.
Read more about the Desktop environment at Wikipedia
VNC is a GUI sharing method for anyone to control your computer anywhere. That is, when someone has been granted access to our VNC server, the data (event) from that person's keyboard and mouse will transfer to our computer. Through that update the user interface on both sides.
Find out more at Wikipedia
# Install the LXDE desktop environment
In this section, I will show you the two most common ways to install LXDE. Before starting, you should update the system with the following command:
sudo apt update && sudo apt upgrade
1. Use Tasksel
Tasksel is a pre-written tool to help users install Desktop Environment, web server more quickly. To install Tasksel, run the following command:
sudo apt install tasksel
Next we install LXDE as follows:
sudo tasksel install lubuntu-core
2. Use APT
APT is a package management tool built into most Debian-based OS. When installing a package, run the following command:
apt install <package name>
Same as above, with LXDE we install with the following command:
apt install lxde
# Installing VNC Server
There are many vnc servers, but in this section I will install tightvncserver:
sudo apt install tightvncserver
Next, we will initialize vncserver for the first time:
vncserver
To proceed with configuring vnc server with LXDE, we need to kill the session on:
vncserver -kill: 1
Edit the VNC configuration to start the VNC Server will start the lXDE session, run the following command to edit the vnc configuration file:
nano ~/.vnc/xstartup
Edit the file to the following content:
#!/bin /bash
xrdb $HOME/.Xresources
exec startlxde &
Save the file and then restart vncserver.
vncserver
# Connecting with VNC Client
You need to have a VNC Client to connect to VNC Server. You can download the RealVNC Viewer here. Open VNC CLient to connect with the host:
<server IP> : <Port number>
The port number here is usually 5901. And here is the result:
Good luck!
Thanks @Not_Oles for helping me
Comments
Awesome use of the Ides of March Free VPS! Congrats to @quangthang!
MetalVPS
I would add that IMO it's a MUCH BETTER idea to tunnel into VNC via SSH then to leave a vnc connection option to the world.
I know but It's not easy for a beginner
MetalVPS
@quangthang Maybe you might want to try these instructions (with a couple of minor changes that I think you will understand):
https://www.techrepublic.com/article/how-to-connect-to-vnc-using-ssh/
On Windows, maybe these instructions about PuTTY might be helpful (but maybe RealVNC Viewer has the ssh functionality built in; I don't remember):
https://helpdeskgeek.com/how-to/tunnel-vnc-over-ssh/
Please message me if you cannot get the tunnel to work.
MetalVPS
Bitvise is personally my favorite windows ssh client. Makes it very simple IMO
Mine is Termius. It supports port forwarding and many features.
I'll learn about it soon, thank!
MetalVPS
I really like the snippits and auto complete features in termus but the monthly subscription is a bit silly
I never heard of termius before.
From a quick look at the Termius website at https://termius.com/ :
About Termius not being open source: https://support.termius.com/forums/215251-general/suggestions/7150574-can-i-trust-you
How much is Termius' Monthly Recurring Recenue (MRR)? Monthly fee for Termius Premium currently seems to be about $8.33: https://termius.com/pricing
As of 2017, there was this tidbit about Premium becoming $9.99 per year: https://blog.termius.com/were-going-to-update-the-price-tag-3f09b2fc258f
MetalVPS
Termius is ok for iOS/iPadOS. Need subscription if you want to sync config/hosts between devices, otherwise works fine. For macOS/Windows I prefer ssh in a terminal.
I have a Github student pack and it offers Termius completely free. I have nothing to complain about it.
MetalVPS