Skip to content

Latest commit

ย 

History

History
157 lines (105 loc) ยท 2.6 KB

File metadata and controls

157 lines (105 loc) ยท 2.6 KB

๐Ÿ–ฅ๏ธ VNC Server Setup Guide for CentOS 9 Stream

๐Ÿ”ง Step 1: Install Required Packages

dnf install -y tigervnc-server 

๐Ÿง‘ Step 2: Create VNC User (if not already created)

useradd vncuser
passwd vncuser

๐Ÿ’ก You can also use any existing non-root user.

๐Ÿ”‘ Step 3: Set VNC Password for the User

su - vncuser
vncpasswd
exit

๐Ÿ“ Step 4: Create VNC Configuration File

Create 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.service

Edit the copied service file:

nano /etc/systemd/system/vncserver@:1.service

Find this line:

ExecStart=/usr/libexec/vncsession-start %i

Replace it with:

ExecStart=/usr/libexec/vncsession-start vncuser

๐Ÿ’ก Replace vncuser with the actual username you created or are using.

๐Ÿš€ Step 5: Reload Systemd & Enable Service

systemctl daemon-reload
systemctl enable vncserver@:1.service
systemctl start vncserver@:1.service

๐Ÿ”ฅ Step 6: Allow Firewall Port (5901 for :1 display)

firewall-cmd --permanent --add-port=5901/tcp
firewall-cmd --reload

๐Ÿ” Step 7: SELinux Configuration (if enabled)

semanage port -a -t vnc_port_t -p tcp 5901

๐Ÿ’ก Skip this if setenforce 0 gives "SELinux is disabled".


๐Ÿงช Testing VNC Connection

Use a VNC Viewer from Windows and connect to:

192.168.x.x:5901

or

192.168.x.x:1

๐Ÿ’ก If vncviewer not installed on Linux client, install it via:

dnf install -y tigervnc

๐Ÿงน Optional: Customize Desktop Environment

Edit the startup file to load desired desktop environment (XFCE, GNOME, etc.):

nano /home/vncuser/.vnc/xstartup

Example XFCE session:

#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4

Make it executable:

chmod +x /home/vncuser/.vnc/xstartup

Restart the VNC service:

systemctl restart vncserver@:1.service

๐Ÿ–ฅ๏ธ VNC Server Installation Guide for Windows (RealVNC)

To 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.


โšก