dnf install -y tigervnc-server useradd vncuserpasswd vncuser๐ก You can also use any existing non-root user.
su - vncuservncpasswdexitCreate a systemd service file for your VNC user (replace :1 with desired display number).
cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.serviceEdit the copied service file:
nano /etc/systemd/system/vncserver@:1.serviceFind this line:
ExecStart=/usr/libexec/vncsession-start %i
Replace it with:
ExecStart=/usr/libexec/vncsession-start vncuser
๐ก Replace
vncuserwith the actual username you created or are using.
systemctl daemon-reloadsystemctl enable vncserver@:1.servicesystemctl start vncserver@:1.servicefirewall-cmd --permanent --add-port=5901/tcp
firewall-cmd --reloadsemanage port -a -t vnc_port_t -p tcp 5901๐ก Skip this if
setenforce 0gives "SELinux is disabled".
Use a VNC Viewer from Windows and connect to:
192.168.x.x:5901
or
192.168.x.x:1
๐ก If
vncviewernot installed on Linux client, install it via:
dnf install -y tigervncEdit the startup file to load desired desktop environment (XFCE, GNOME, etc.):
nano /home/vncuser/.vnc/xstartupExample XFCE session:
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4Make it executable:
chmod +x /home/vncuser/.vnc/xstartupRestart the VNC service:
systemctl restart vncserver@:1.serviceTo install VNC Server on your Windows computer, you can download it from RealVNC's official download page.
Two main versions of VNC Server are available for Windows:
- EXE x86/x64 Standalone Installer
- MSI Installer
- 192.168.x.x:5901
Download the appropriate version based on your system requirements and follow the installation instructions.