NoMachine Setup for Headless Server - norlab-ulaval/Norlab_wiki GitHub Wiki
This is a quick tutorial to setup a NoMachine VNC instance on Ubuntu 22.04. Note that doing these steps will make the X Server run in headless mode, meaning that connecting an external display will not work anymore. It is still possible to connect a screen if you connect it before Linux boots.
Installing NoMachine
To install NoMachine, download and follow the instructions here. It should enable a service to launch it automatically on startup, so all good on that side.
Configure X Server as headless
Since we want to display the computer's screen, but there is none, we need to configure Linux to run as "headless", meaning that it will create a dummy monitor for itself. To do that run the following:
sudo apt update
sudo apt install xserver-xorg-video-dummy x11-xserver-utils
Then, write the following to the file /etc/X11/xorg.conf
:
Section "Monitor"
Identifier "Monitor0"
HorizSync 28.0-80.0
VertRefresh 48.0-75.0
EndSection
Section "Device"
Identifier "Device0"
Driver "dummy"
VideoRam 256000
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1920x1080"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0"
EndSection
Finally, to make the headless X server start automatically, create a systemd service.
sudo nano /etc/systemd/system/headless-x.service
And add the following content:
[Unit]
Description=Headless X Server
After=multi-user.target
[Service]
ExecStart=/usr/bin/X :0
User=<your_username>
Restart=always
[Install]
WantedBy=multi-user.target
Then enable and start it:
sudo systemctl enable headless-x
sudo systemctl start headless-x
Test connection
Install NoMachine on your own computer and try to connect to your headless server. Press ADD in the top left corner, give a name to the remote computer, enter its IP address and confirm with ADD. Make sure you are on the same network and double-click on the device icon to connect to it. Enter the user's credentials and check the box to memorize it for later.
USB Forwarding
If USB forwarding is not working (no devices are displayed), follow this guide to install the kernel module: https://kb.nomachine.com/AR12J00658