2

I am creating a system and I want to make it as quick and painless to deploy as possible. I also need people who are unfamiliar with RPi to deploy it. So I am creating an installer that can handle all of the first time setup for each pi. One of the things that I need is for VNC to be enabled. I realize it is super simple to do, but its one more thing id like to automate if possible.

How can I enable VNC using python?

I'm also open to using a .sh script or doing something to the config files before raspian is installed, as long as I can copy and paste onto multiple SD cards for deployment. I don't want the deployers to have to go into settings to enable VNC server.

1

Assuming you're using Raspbian and want to enable the built-in RealVNC service mode server, you can do this using the systemctl command:

systemctl enable vncserver-x11-serviced

which will enable the service so it will start on the next boot. If you want the VNC Server to start immediately you should also run:

systemctl start vncserver-x11-serviced

You can call these from Python using subprocess.call()

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.