Tag Archives: systemd

Raspberry Pi Guide – VNC

 

update your apt package info

 

sudo apt-get update

 

  • Install TightVNCServer
sudo apt-get install tightvncserver
  • start the server:

type the following command in your favorite terminal

vncserver :1

and you will be required to input the password.

the console output should be like this:


You will require a password to access your desktops.

Password:
Verify:
Would you like to enter a view-only password (y/n)? n

New 'X' desktop is raspberrypi:1

Creating default startup script /home/pi/.vnc/xstartup
Starting applications specified in /home/pi/.vnc/xstartup
Log file is /home/pi/.vnc/raspberrypi:1.log

  • start at boot:

if you are running raspbian jessie, you can use the systemd to auto start vnc server

 

 

Create a new file /etc/systemd/system/vncserver@.service with the following contents:

[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

you can modify the params in the file according to your device(Display Monitor)

-depth and -geometry

then run:

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

more detail, see

https://www.raspberrypi.org/forums/viewtopic.php?t=123457&p=830506