Pada kesempatan kali ini saya akan membahas cara Install VNC Server pada Rocky Linux.
1. Install VNC
dnf update
dnf install tigervnc-server
2. Config VNC
- buat user
useradd yuby
passwd yuby
- Disable Wayland dan enable Xorg
sed -i 's/#WaylandEnable/WaylandEnable/' /etc/gdm/custom.conf
- reboot server
reboot
- membuat user vnc service
su - yuby
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/vncserver@.service << 'EOL'
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=forking
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver %i -geometry 1912x988
ExecStop=/usr/bin/vncserver -kill %i
Restart=on-success
RestartSec=15
[Install]
WantedBy=default.target
EOL
- copy
cp /usr/lib/systemd/user/vncserver@.service ~/.config/systemd/user
systemctl --user daemon-reload
echo 'export XDG_RUNTIME_DIR=/run/user/$(id -u)' >> ~/.bashrc
source ~/.bashrc
systemctl --user show-environment
3. Membuat VNC Connection Password
vncpasswd
4. Running VNC Server
echo $DISPLAY
systemctl --user enable vncserver@:2 --now
loginctl enable-linger
systemctl status --user vncserver@:2
systemctl --user stop vncserver@:2
5. Allow VNC Server Access on FirewallD
ss -alt | grep 590
sudo firewall-cmd --add-port=5902/tcp --permanent
sudo firewall-cmd --reload
6. Test VNC Server Connection
- install di server
dnf install tigervnc
- install di client server ( misal menggunakan Ubuntu )
apt install xtightvncviewer -y
- test connection
vncviewer host_IP_or_hostname:5902