Introduction
VNC (Virtual Network Computing) is a graphical desktop sharing system that allows you to remotely control another computer. This tutorial will guide you through the process of installing VNC Server on Debian 12, allowing you to access your Debian desktop remotely.
Prerequisites
Before you begin, ensure you have:
- A Debian 12 server or desktop system
- SSH access to the server (optional)
- Root or sudo privileges
Step 1: Install VNC Server
Update the package index and install the VNC server:
sudo apt update
sudo apt install -y tigervnc-standalone-server
Step 2: Configure VNC Server
Generate a VNC password:
vncpasswd
Start the VNC server:
vncserver
When prompted, enter the password you generated earlier.
Step 3: Configure VNC Service
Create a new systemd service unit file:
sudo nano /etc/systemd/system/[email protected]
Add the following content:
[Unit]
Description=VNC Server for %i
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 1280x800 -localhost no -alwaysshared -fg
ExecStop=/usr/bin/vncserver -kill %i
[Install]
WantedBy=multi-user.target
Save and close the file.
Step 4: Enable and Start VNC Service
Enable the VNC service for the desired user (replace username
with your username):
sudo systemctl enable --now vncserver@:1.service
Step 5: Access VNC Server
Download a VNC client such as RealVNC or TigerVNC Viewer on your local machine.
Connect to your Debian server's IP address or hostname followed by the port number (default is 5901) using the VNC client.
Enter the password you set in Step 2 when prompted.
Conclusion
Congratulations! You have successfully installed and configured VNC Server on Debian 12. You can now remotely access your Debian desktop using a VNC client.