Difference between revisions of "How to setup x11vnc server/zh"
From FriendlyELEC WiKi
(updated by API) |
(updated by API) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
− | [[How to setup | + | [[How to setup x11vnc server|English]] |
− | ==Step1: | + | ==本文适用范围== |
+ | * RK3399/RK3568/RK3588平台的ubuntu-focal-desktop系统 | ||
+ | * RK3588平台的debian-bullseye-desktop系统 | ||
+ | * RK3399平台的FriendlyDesktop请参考此文:[[How to setup VNC server on NanoPC-T4/zh|How to setup VNC server on NanoPC-T4]] | ||
+ | |||
+ | ==Step1: 安装x11vnc== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | sudo apt-get install | + | sudo apt update |
+ | sudo apt-get install x11vnc net-tools | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Step2: 设置密码== | ==Step2: 设置密码== | ||
− | |||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | su pi | |
+ | x11vnc -storepasswd | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
+ | ==Step3: 创建.Xauthority== | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | touch /home/pi/.Xauthority | |
+ | xauth add :0 . `mcookie` | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == | + | ==Step4: 配置自动登录桌面== |
− | + | ===For ubuntu-focal-desktop=== | |
+ | 创建目录与文件 | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | sudo mkdir /etc/sddm.conf.d | |
− | / | + | sudo vim /etc/sddm.conf.d/autologin |
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | autologin文件内容如下: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | [Autologin] | |
+ | User=pi | ||
+ | Session=lxqt.desktop | ||
+ | Relogin=false | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 重启。 | |
− | + | ===For debian-bullseye-desktop=== | |
− | + | 默认情况下已经是自动登录,可通过如下文件检查配置 | |
− | == | + | <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> | ||
+ | ==Step5: 开机运行x11vnc== | ||
+ | 新增文件 /etc/systemd/system/x11vnc.service | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo vim /etc/systemd/system/x11vnc.service | ||
+ | </syntaxhighlight> | ||
+ | 内容如下 | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
[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> | ||
− | + | 启用systemd服务 | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | sudo | + | sudo systemctl daemon-reload |
+ | sudo systemctl restart x11vnc.service | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ==Step6: 电脑访问== | |
− | + | 使用VNC客户端访问地址:<br /> | |
− | + | 开发板IP:5900 | |
− | + | ||
− | == | + | ==已知问题== |
− | + | 性能不佳,仅供测试使用 | |
− | + |
Latest revision as of 09:24, 21 June 2024
Contents
1 本文适用范围
- RK3399/RK3568/RK3588平台的ubuntu-focal-desktop系统
- RK3588平台的debian-bullseye-desktop系统
- RK3399平台的FriendlyDesktop请参考此文:How to setup VNC server on NanoPC-T4
2 Step1: 安装x11vnc
sudo apt update sudo apt-get install x11vnc net-tools
3 Step2: 设置密码
su pi x11vnc -storepasswd
4 Step3: 创建.Xauthority
touch /home/pi/.Xauthority xauth add :0 . `mcookie`
5 Step4: 配置自动登录桌面
5.1 For ubuntu-focal-desktop
创建目录与文件
sudo mkdir /etc/sddm.conf.d sudo vim /etc/sddm.conf.d/autologin
autologin文件内容如下:
[Autologin] User=pi Session=lxqt.desktop Relogin=false
重启。
5.2 For debian-bullseye-desktop
默认情况下已经是自动登录,可通过如下文件检查配置
$ 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 Step5: 开机运行x11vnc
新增文件 /etc/systemd/system/x11vnc.service
sudo vim /etc/systemd/system/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
启用systemd服务
sudo systemctl daemon-reload sudo systemctl restart x11vnc.service
7 Step6: 电脑访问
使用VNC客户端访问地址:
开发板IP:5900
8 已知问题
性能不佳,仅供测试使用