Difference between revisions of "APITestPage"
From FriendlyELEC WiKi
(updated by API) |
(updated by API) |
||
Line 1: | Line 1: | ||
− | === | + | [[How to setup VNC server on NanoPC-T4|English]] |
− | + | ||
− | + | ==Step1: 安装VNC Server== | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | sudo apt-get install tightvncserver | |
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | ||
+ | ==Step2: 设置密码== | ||
+ | 运行vnc server一次,会生成配置文件,并提示你为VNC Server设置一个密码: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | tightvncserver :1 | |
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | 设置密码后,为了方便接下来的操作,先退出Vnc server: | |
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
− | + | tightvncserver -kill :1 | |
− | + | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | ==Step3: 配置VNC server== | ||
+ | 编辑~/.vnc/xstartup文件,在尾部添加: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | lxterminal & | ||
+ | /usr/bin/lxsession -s LXDE & | ||
+ | </syntaxhighlight> | ||
+ | 手动启动VNC Server,测试一下是否可以工作: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | vncserver -geometry 1280x800 | ||
+ | </syntaxhighlight> | ||
+ | 在电脑上打开VNC客户端,输入开发板IP地址与5901的端口号,比如开发板的IP是192.168.1.131,则输入 192.168.1.131:5901,如下图所示: <br /> | ||
+ | [[File:vncserver-inputaddress.png|frameless|600px]] <br /> | ||
+ | 连接成功的话,进入下一步。 | ||
+ | ==Step4: 设置开机自动启动VNC server== | ||
+ | 新建一个文件 /etc/systemd/system/vncserver@.service,内容如下: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | [Unit] | ||
+ | Description=Start TightVNC server at startup | ||
+ | After=syslog.target network.target | ||
+ | |||
+ | [Service] | ||
+ | Type=forking | ||
+ | User=pi | ||
+ | PAMName=pi | ||
+ | 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 | ||
+ | </syntaxhighlight> | ||
+ | 创建符号链接以实现开机自启动: <br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo ln -s /etc/systemd/system/vncserver@.service /etc/systemd/system/multi-user.target.wants/vncserver@1.service | ||
+ | </syntaxhighlight> | ||
+ | 重启开发板: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo reboot | ||
+ | </syntaxhighlight> | ||
+ | ==Step5: 连接到VNC server== | ||
+ | 在电脑上打开VNC Viewer,输入开发板IP地址与5901的端口号登录开发板,显示桌面如下图所示: <br /> | ||
+ | [[File:vncserver-friendlydesktop.png|frameless|600px]] |
Revision as of 08:37, 16 May 2019
Contents
1 Step1: 安装VNC Server
sudo apt-get install tightvncserver
2 Step2: 设置密码
运行vnc server一次,会生成配置文件,并提示你为VNC Server设置一个密码:
tightvncserver :1
设置密码后,为了方便接下来的操作,先退出Vnc server:
tightvncserver -kill :1
3 Step3: 配置VNC server
编辑~/.vnc/xstartup文件,在尾部添加:
lxterminal & /usr/bin/lxsession -s LXDE &
手动启动VNC Server,测试一下是否可以工作:
vncserver -geometry 1280x800
在电脑上打开VNC客户端,输入开发板IP地址与5901的端口号,比如开发板的IP是192.168.1.131,则输入 192.168.1.131:5901,如下图所示:
连接成功的话,进入下一步。
4 Step4: 设置开机自动启动VNC server
新建一个文件 /etc/systemd/system/vncserver@.service,内容如下:
[Unit] Description=Start TightVNC server at startup After=syslog.target network.target [Service] Type=forking User=pi PAMName=pi 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
创建符号链接以实现开机自启动:
sudo ln -s /etc/systemd/system/vncserver@.service /etc/systemd/system/multi-user.target.wants/vncserver@1.service
重启开发板:
sudo reboot