VNC desktop on Xubuntu 18.04 / CentOS 7.5 with nvidia proprietary driver (x11vnc)

Nvidia driver install on CentOS 7.5

Download the nvidia drivers for unix systems

Install prerequisites

sudo yum -y update
sudo yum -y install epel-release
sudo yum -y groupinstall "GNOME Desktop" "Development Tools"
sudo yum -y install kernel-devel dkms
reboot

Edit /etc/default/grub. Append the following to “GRUB_CMDLINE_LINUX”

rd.driver.blacklist=nouveau nouveau.modeset=0

Generate a new grub configuration to include the above changes.

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Edit/create /etc/modprobe.d/blacklist.conf and append:

blacklist nouveau

Backup your old initramfs and then build a new one

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
sudo dracut /boot/initramfs-$(uname -r).img $(uname -r)
reboot

The NVIDIA installer will not run while X is running so switch to text mode and run the installer:

sudo systemctl isolate multi-user.target
sh NVIDIA-Linux-x86_64-*.run
reboot

Nvidia driver install on Xubuntu 18.04

sudo apt update
sudo apt dist-upgrade -y
sudo apt autoremove -y
sudo apt install linux-headers-$(uname -r) build-essential
sudo add-apt-repository ppa:graphics-drivers
sudo apt install nvidia-driver-*latest*

x11nvc install and set up for autostart

sudo apt install x11vnc

Make the password file and set up with the right permissions

x11vnc -storepasswd /home/*USER*/.x11vnc.password
sudo chmod 744 .x11vnc.password

Test the connection with the current settings (might need some changes on the firewall)

x11vnc -noxrecord -noxfixes -noxdamage -display :0 -auth guess -forever -rfbauth /home/*USER*/.x11vnc.password -rfbport 5900

If it works, let’s make the autostart daemon
Create the /lib/systemd/system/x11vnc.service with the following content:

[Unit]
Description=Start x11vnc at startup.
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/x11vnc -noxrecord -noxfixes -noxdamage -display :0 -auth guess -forever -rfbauth /home/USER/.x11vnc.password -rfbport 5900

[Install]
WantedBy=multi-user.target
sudo systemctl enable x11vnc.service
sudo systemctl daemon-reload
sudo systemctl start x11vnc.service
reboot

If there is no monitor attached to the PC, just create the /etc/X11/xorg.conf.d/10-monitor.conf file, with the following content:

Section        "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync "28.0 - 33.0" #Virtual monitor needs this
VertRefresh "43.0 - 72.0" #this, too
Option "DPMS"
EndSection
Section "Device"
Identifier "Device"
Driver "nvidia"
VendorName "NVIDIA Corporation"
Option "NoLogo" "1"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
DefaultDepth "24"
SubSection "Display"
Depth "24"
Virtual "1920 1080"
Option "AllowEmptyInitialConfiguration" "True"
EndSubSection
EndSection

Leave a Reply

Your email address will not be published. Required fields are marked *