How can I run VNC on each boot?
Note: I use TightVNC server and Raspberry Pi 4 and Raspbian Buster
How can I run VNC on each boot?
Note: I use TightVNC server and Raspberry Pi 4 and Raspbian Buster
There are 2 ways you could do this.
Cron:
You can edit the crontab by typing this in the terminal: crontab -e
. Then you should add this line to it @reboot vncserver :1
.
Read the Cron docs here: https://www.raspberrypi.org/documentation/linux/usage/cron.md
Systemd (I'm not a 100% sure about the exact instructions but I think this is how you would do it.):
Type sudo nano /lib/systemd/system/vncstart.service
. Add this to the file:
[Unit]
Description=Start VNC
After=multi-user.target
[Service]
ExecStart=/usr/bin/vncserver :1
[Install]
WantedBy=multi-user.target
Then enter:
sudo systemctl daemon-reload
sudo systemctl enable vncstart.service
Read the systemd docs here: https://www.raspberrypi.org/documentation/linux/usage/systemd.md
After you're done with one of these reboot to check if it's working.
If you REALLY want to use TightVNC server see:- https://raspberrypi.stackexchange.com/a/39374/8697
I wouldn't bother; The RealVNC included with Raspberry Pi OS is simpler and has many advantages.
sudo
required? Have you considered acron
job to start at boot - or asystemd
service def? – Seamus Aug 11 '20 at 13:28