This blog will guide you to setup your Linux headless remote desktop with VNC sessions of different screen resolutions.
VNC stands for Virtual Network Computing. Connecting to remote headless Linux server implies running a remote Linux desktop session, namely, GNOME desktop.
I had great success with TightVNC client (available for Windows, MacOS, and Linux) over a number of years.
Install Software Packages
$ sudo yum install xinetd
$ sudo yum groupinstall "GNOME Desktop Environment"
$ sudo yum install tigervnc-server
The last package installs following executables:
/usr/bin/Xvnc
/usr/bin/vncconfig
/usr/bin/vncpasswd
/usr/bin/vncserver
/usr/bin/x0vncserver
vncserver is the daemon. Each connection to a remote desktop client is served by Xvnc instance.
Configure GDM
GDM is the GNOME Display Manager -- a graphical login greeter. This configuration runs GDM in the background on a headless (no X-Server) Linux host. This kind of configuration would be useful for a data server hidden away in your basement.
In order to setup remote GDM invocation, we need to enable XDMCP protocol. XDMCP protocol stands for X Display Manager Protocol. It is used by the X servers to communicate among each other in the UNIX world.
- Edit /etc/gdm/custom.conf
- Within the file find [xdmcp] section and set Enable to 'true'
- Enable=true
- Fix the RemoteGreeter bug. Somehow, GDM cannot pick up the path to greeter. In [greeter] section add simple-greeter location:
- [greeter]
- RemoteGreeter=/usr/lib64/gdm/simple-greeter
- To turn off the X Windows session, find [servers] section and comment out the following line
- #0=Standard
Linux xinetd service is a secure internet service daemon -- a sort of a service gateway to your Linux server. You bind a specific service to a specific port number (address) and when connection request comes in, xinetd starts that service on your behalf.
In our case, a VNC client (TightVNC) knows how to communicate with VNC server over XDMCP protocol. All we need for TightVNC to work is to add port number binding to the VNC server instantiation via xinted. Each binding offers a remote desktop service with different screen resolution.
- Under /etc/xinted.d/ directory, create vnc1920 file:
service vnc1920
{
disable = no
socket_type = stream
protocol = tcp
group = tty
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -broadcast -query localhost -geometry 1920x1200 -depth 16 -once -fp unix/:7100 -securitytypes=none
}
- Note here that the color depth can be set to 8, 16, 24, and 32 bits. You might want to create different service entries with different color depths to learn which one is best for you.
- Create similar service files for other screen resolutions
vnc1280 for 1280x1024
vnc1680 for 1680x1050
- Edit /etc/services file and bind service files you have created above with the port numbers
vnc1024 5900/tcp
vnc1280 5901/tcp
vnc1680 5902/tcp
vnc1920 5903/tcp
vnc1680 5902/tcp
vnc1920 5903/tcp
The port number resolution is HOST-IP:0 for 5900, HOST-IP:1 for 5901 and so on.
Restart xinetd service
- sudo /sbin/service xinetd restart
From your desktop, start TightVNC client and try to connect to HOST-IP:0 or HOST-IP:1.
Sometimes, you would need to restart your server in order for all services to bounce nicely.
End Remote Desktop Session
One thing to remember is to never end your GNOME remote desktop session with Actions->Log out. Instead, close the session down by clicking on [x] windows adornment button in the left top corner.
References
Other VNC tutorials you might find useful:
No comments:
Post a Comment