Installing VNC on a Linux Server (ubuntu server)

These steps allowed to resolve the errors

  • Missing X server or $DISPLAY
  • “Client is not authorized to connect to server / Cannot open display 1.0”

sudo apt install tightvncserver -y

sudo apt-get install xfce4 lightdm-gtk-greeter dbus-x11 autocutsel -y

sudo apt install xfce4 xfce4-goodies -y

sudo apt install slim -y

sudo apt reinstall lightdm -y

sudo dpkg-reconfigure lightdm

# Select: lightdm

sudo service lightdm start

$ sudo cat /home/serv4/.vnc/xstartup

adding the below line to the file;

startxfce4 &

sudo apt install xvfb

sudo apt install xdg-utils

solution 1:

$ rm -rfv ~/.Xauthority*

$ brave &

Solution 2:

$ xhost +local:

$ brave &

Posted Dec 6, 2025, 6:24 PM UTC

10
Loading comments…