TurboVNC / turbovnc

Main TurboVNC repository
https://TurboVNC.org
GNU General Public License v2.0
746 stars 136 forks source link

how do i start turbovnc server automatically on ubuntu 22.04? #395

Closed Kevinoup closed 6 months ago

Kevinoup commented 6 months ago

I would like to automatically start the TurboVNC server before login on Ubuntu 22.04. My turbovnc is already the newest version (3.0.3-20231218) in ubuntu 22.04. I have taken the following steps:

1.Created a vncserver.service file in /usr/lib/systemd/system/ with the following contents:

[Unit] Description=Remote desktop service (VNC) After=syslog.target network.target

[Service] Type=forking User=root PAMName=login WorkingDirectory=/root/ PIDFile=/root/.vnc/%H:1.pid ExecStartPre=/bin/bash -c '/opt/TurboVNC/bin/vncserver -kill :1 > /dev/null 2>&1 || :' ExecStart=/opt/TurboVNC/bin/vncserver :1 -depth 24 -geometry 1920x1080 -fg ExecStop=/bin/bash -c '/opt/TurboVNC/bin/vncserver -kill :1 > /dev/null 2>&1 || :' Restart=on-abort

[Install] WantedBy=multi-user.target

2.Executed the command "sudo systemctl daemon-reload".

3.Executed the command "sudo systemctl enable vncserver.service".

4.Executed the command "sudo systemctl start vncserver.service", but the command gets stuck at this point.

Is there anyone who can help me with this issue?

dcommander commented 6 months ago

You don't need to do any of that. You just need to:

  1. Install one of our official .deb packages, either manually (refer to the User's Guide) or from the APT repository.
  2. Edit /etc/sysconfig/tvncservers, setting the value of the VNCSERVERS variable as documented in the comments (and optionally the value of the VNCSERVERARGS[] array members.)
  3. sudo systemctl enable tvncserver
  4. sudo systemctl start tvncserver