Skip to content

把VNC設置成開機服務(Jessie)

此文章用於把VNC設置成開機服務。

1. Install Tight VNC server:

sudo apt-get install tightvncserver

2. Start it manually and enter new VNC password.

vncserver :1

3. Create a new file /etc/systemd/system/vncserver@.service

4. (Optional) Replace the parameters in the unit file, if you want to.

5. Run

sudo systemctl daemon-reload && sudo systemctl enable vncserver@1.service

6. Reboot.

以下是/etc/systemd/system/vncserver@.service的內容:


/etc/systemd/system/vncserver@.service

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

[Service]
Type=forking
User=pi
PAMName=login
PIDFile=/home/pi/.vnc/%H:%i.pid
ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target
Published inRaspberry Pi

Be First to Comment

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *