Difference between revisions of "How to setup x11vnc server"
From FriendlyELEC WiKi
(updated by API) |
(updated by API) |
||
Line 1: | Line 1: | ||
− | [[How to setup | + | [[How to setup x11vnc server/zh|查看中文]] |
− | == | + | == Scope of this document == |
+ | * Ubuntu Focal Desktop system on RK3399/RK3568/RK3588 platforms | ||
+ | * Debian Bullseye Desktop system on RK3588 platform | ||
+ | * For FriendlyDesktop on RK3399 platform, refer to [[How to setup VNC server on NanoPC-T4|How to setup VNC server on NanoPC-T4]] | ||
+ | |||
+ | == Step 1: Install x11vnc == | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | sudo apt-get install | + | sudo apt update |
+ | sudo apt-get install x11vnc net-tools | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | == Step 2: Set password == |
− | + | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | su pi | |
+ | x11vnc -storepasswd | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
+ | == Step 3: Create .Xauthority == | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | touch /home/pi/.Xauthority | |
+ | xauth add :0 . `mcookie` | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | == Step 4: Configure automatic desktop login == |
− | + | === For Ubuntu Focal Desktop === | |
+ | Create directory and file | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | sudo mkdir /etc/sddm.conf.d | |
− | / | + | sudo vim /etc/sddm.conf.d/autologin |
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Content of autologin file: | |
− | <syntaxhighlight lang=" | + | <syntaxhighlight lang="ini"> |
− | + | [Autologin] | |
+ | User=pi | ||
+ | Session=lxqt.desktop | ||
+ | Relogin=false | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Restart. | |
− | + | ||
− | + | === For Debian Bullseye Desktop === | |
− | == | + | By default, automatic login is enabled. Check configuration with the following file: |
− | + | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
+ | $ grep autologin-user /etc/lightdm/lightdm.conf | ||
+ | # autologin-user = User to log in with by default (overrides autologin-guest) | ||
+ | # autologin-user-timeout = Number of seconds to wait before loading default user | ||
+ | autologin-user=pi | ||
+ | autologin-user-timeout=0 | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == Step 5: Run x11vnc at startup == | ||
+ | Create file /etc/systemd/system/x11vnc.service | ||
+ | <syntaxhighlight lang="ini"> | ||
+ | sudo vim /etc/systemd/system/x11vnc.service | ||
+ | </syntaxhighlight> | ||
+ | Content of x11vnc.service: | ||
+ | <syntaxhighlight lang="ini"> | ||
[Unit] | [Unit] | ||
− | Description=Start | + | Description=Start x11vnc at startup. |
− | After= | + | After=network-online.target |
[Service] | [Service] | ||
− | Type= | + | Type=simple |
+ | ExecStart=/usr/bin/x11vnc -display :0 -auth /home/pi/.Xauthority -rfbauth /home/pi/.vnc/passwd -rfbport 5900 -forever -loop -noxdamage -repeat -shared -capslock -nomodtweak | ||
User=pi | User=pi | ||
− | + | Group=pi | |
− | + | WorkingDirectory=/home/pi | |
− | + | ExecStop=/bin/kill -TERM $MAINPID | |
− | + | ExecReload=/bin/kill -HUP $MAINPID | |
− | + | KillMode=control-group | |
+ | Restart=on-failure | ||
+ | Environment=DISPLAY=:0 | ||
+ | Environment=XAUTHORITY=/home/pi/.Xauthority | ||
[Install] | [Install] | ||
− | WantedBy= | + | WantedBy=graphical.target |
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Enable systemd service | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | sudo | + | sudo systemctl daemon-reload |
+ | sudo systemctl restart x11vnc.service | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
− | + | == Step 6: Access from a computer == | |
− | + | Use VNC client to access the following address:<br /> | |
− | + | Board IP:5900 | |
− | == | + | |
− | + | ||
− | + |
Revision as of 09:22, 21 June 2024
Contents
1 Scope of this document
- Ubuntu Focal Desktop system on RK3399/RK3568/RK3588 platforms
- Debian Bullseye Desktop system on RK3588 platform
- For FriendlyDesktop on RK3399 platform, refer to How to setup VNC server on NanoPC-T4
2 Step 1: Install x11vnc
sudo apt update sudo apt-get install x11vnc net-tools
3 Step 2: Set password
su pi x11vnc -storepasswd
4 Step 3: Create .Xauthority
touch /home/pi/.Xauthority xauth add :0 . `mcookie`
5 Step 4: Configure automatic desktop login
5.1 For Ubuntu Focal Desktop
Create directory and file
sudo mkdir /etc/sddm.conf.d sudo vim /etc/sddm.conf.d/autologin
Content of autologin file:
[Autologin] User=pi Session=lxqt.desktop Relogin=false
Restart.
5.2 For Debian Bullseye Desktop
By default, automatic login is enabled. Check configuration with the following file:
$ grep autologin-user /etc/lightdm/lightdm.conf # autologin-user = User to log in with by default (overrides autologin-guest) # autologin-user-timeout = Number of seconds to wait before loading default user autologin-user=pi autologin-user-timeout=0
6 Step 5: Run x11vnc at startup
Create file /etc/systemd/system/x11vnc.service
sudo vim /etc/systemd/system/x11vnc.service
Content of x11vnc.service:
[Unit] Description=Start x11vnc at startup. After=network-online.target [Service] Type=simple ExecStart=/usr/bin/x11vnc -display :0 -auth /home/pi/.Xauthority -rfbauth /home/pi/.vnc/passwd -rfbport 5900 -forever -loop -noxdamage -repeat -shared -capslock -nomodtweak User=pi Group=pi WorkingDirectory=/home/pi ExecStop=/bin/kill -TERM $MAINPID ExecReload=/bin/kill -HUP $MAINPID KillMode=control-group Restart=on-failure Environment=DISPLAY=:0 Environment=XAUTHORITY=/home/pi/.Xauthority [Install] WantedBy=graphical.target
Enable systemd service
sudo systemctl daemon-reload sudo systemctl restart x11vnc.service
7 Step 6: Access from a computer
Use VNC client to access the following address:
Board IP:5900