Difference between revisions of "Template:OfficialUbuntuCore/zh"
From FriendlyELEC WiKi
(updated by API) |
(updated by API) |
||
(37 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | == | + | ==FriendlyCore的使用== |
===FriendlyCore默认帐户=== | ===FriendlyCore默认帐户=== | ||
− | 普通用户: | + | *普通用户: |
用户名: pi | 用户名: pi | ||
密码: pi | 密码: pi | ||
− | Root用户: | + | *Root用户: |
用户名: Root用户: | 用户名: Root用户: | ||
密码: fa | 密码: fa | ||
Line 12: | Line 12: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===配置网络=== | ===配置网络=== | ||
+ | ====设置静态IP地址==== | ||
默认已将 eth0 配置成 dhcp 自动获取IP地址,要更改配置,可以修改这个文件: | 默认已将 eth0 配置成 dhcp 自动获取IP地址,要更改配置,可以修改这个文件: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
Line 24: | Line 25: | ||
gateway 192.168.1.1 | gateway 192.168.1.1 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | 要配置另一个网口 | + | {{#switch: {{{1}}} |
+ | | NanoPi-R5S | ||
+ | | NanoPi-R6S = | ||
+ | 另外两个网口设置了静态IP地址, 设置如下:<br/> | ||
+ | eth1: 192.168.2.1<br/> | ||
+ | eth2: 192.168.3.1 (注:如果有第三个网口的话)<br/> | ||
+ | | NanoPi-R6C | ||
+ | | NanoPC-T6 | ||
+ | | NanoPi-R5C = | ||
+ | 另1个网口设置了静态IP地址, 设置如下:<br/> | ||
+ | eth1: 192.168.2.1<br/> | ||
+ | | #default = | ||
+ | }} | ||
+ | ====设置DNS==== | ||
+ | 还需要修改如下文件加入DNS的配置: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | vi /etc/systemd/resolved.conf | ||
+ | </syntaxhighlight> | ||
+ | 例如设置为192.168.1.1: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | [Resolve] | ||
+ | DNS=192.168.1.1 | ||
+ | </syntaxhighlight> | ||
+ | 再用以下命令重新启动systemd-resolved服务: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo systemctl restart systemd-resolved.service | ||
+ | sudo systemctl enable systemd-resolved.service | ||
+ | </syntaxhighlight> | ||
+ | ====设置使用另一个网络接口==== | ||
+ | 要配置另一个网口, 例如eth1,可以在 /etc/network/interfaces.d/ 下复制 eth0 成 eth1,然后编辑eth1, 把其中的eth0改为eth1, 根据需要指定网络配置:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | cp /etc/network/interfaces.d/eth0 /etc/network/interfaces.d/eth1 | ||
+ | vi /etc/network/interfaces.d/eth1 | ||
+ | </syntaxhighlight> | ||
+ | ===连接WiFi=== | ||
+ | 先用以下命令检查一下系统是否有安装Network-Manager: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | which nmcli | ||
+ | </syntaxhighlight> | ||
+ | 如果有安装Network-Manager, 则参考此链接的方法连接WiFi: [[Use NetworkManager to configure network settings/zh]], 如果没有安装, 则参考如下方法配置WiFi, <br /> | ||
+ | 输入以下命令查询一下WiFi的网络接口,wlan开头的就是WiFi: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | ifconfig -a | ||
+ | </syntaxhighlight> | ||
+ | 默认情况下是wlan0,在/etc/network/interfaces.d/目录下新建一个与网络接口同名的配置文件 ,以wlan0为例,用vi命令新建以下文件: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo vi /etc/network/interfaces.d/wlan0 | ||
+ | </syntaxhighlight> | ||
+ | wlan0文件的内容如下: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | auto lo | ||
+ | iface lo inet loopback | ||
+ | auto wlan0 | ||
+ | iface wlan0 inet dhcp | ||
+ | wpa-driver wext | ||
+ | wpa-ssid YourWiFiESSID | ||
+ | wpa-ap-scan 1 | ||
+ | wpa-proto RSN | ||
+ | wpa-pairwise CCMP | ||
+ | wpa-group CCMP | ||
+ | wpa-key-mgmt WPA-PSK | ||
+ | wpa-psk YourWiFiPassword | ||
+ | </syntaxhighlight> | ||
+ | 其中,YourWiFiESSID和YourWiFiPassword请替换成你要连接的无线AP名称和密码, 保存文件后输入以下命令, 或者重启以应用配置:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo systemctl daemon-reload | ||
+ | sudo systemctl restart networking | ||
+ | </syntaxhighlight> | ||
+ | 需要注意的是,如果你的SD卡在多个硬件上运行,WiFi的网络接口可能会被重命名为wlan1, wlan2等,你可以通过清空这个文件的内容并重启让它恢复为默认值:/etc/udev/rules.d/70-persistent-net.rules。 | ||
+ | {{#switch: {{{1}}} | ||
+ | | NanoPi-R4S | ||
+ | | NanoPi-R4SE | ||
+ | | NanoPi-R2S | ||
+ | | NanoPi-R2C | ||
+ | | NanoPi-R2C-Plus | ||
+ | | NanoPi-R2S-Plus | ||
+ | | NanoPi-R5C | ||
+ | | NanoPi-R5S | ||
+ | | NanoPi-R6C | ||
+ | | NanoPC-T6 | ||
+ | | NanoPi-R6S = | ||
+ | ====重点支持的WIFI型号==== | ||
+ | =====M.2 WiFi Module===== | ||
+ | * RTL8822CE | ||
+ | =====Usb Dongle===== | ||
+ | * RTL8821CU (Vid: 0BDA, Pid: C811) (测试样品:TP-Link TL-WDN5200H) | ||
+ | * RTL8812AU (Vid: 0BDA, Pid: 8812) | ||
+ | * MediaTek MT7662 (Vid: 0E8D, Pid: 7612) (测试样品:COMFAST CF-WU782AC V2) | ||
+ | | #default = | ||
+ | }} | ||
+ | ===安装内核头文件=== | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo dpkg -i /opt/linux-headers-*.deb | ||
+ | </syntaxhighlight> | ||
+ | <!-- Build kernel header --> | ||
+ | {{#switch: {{{1}}} | ||
+ | | NanoPi-R4S | ||
+ | | NanoPi-R4SE = | ||
+ | ===编译内核头文件安装包=== | ||
+ | 请参考 https://github.com/friendlyarm/sd-fuse_rk3399/blob/kernel-5.15.y/test/test-build-kernel-header-deb.sh <br /> | ||
+ | | NanoPi-R2S | ||
+ | | NanoPi-R2C-Plus | ||
+ | | NanoPi-R2S-Plus | ||
+ | | NanoPi-R2C = | ||
+ | ===编译内核头文件安装包=== | ||
+ | 请参考 https://github.com/friendlyarm/sd-fuse_rk3328/blob/master/test/test-build-kernel-header-deb.sh <br /> | ||
+ | | #default = | ||
+ | }} | ||
+ | <!-- LEDs --> | ||
+ | {{#switch: {{{1}}} | ||
+ | | NanoPi-R4S | ||
+ | | NanoPi-R4SE | ||
+ | | NanoPi-R2S | ||
+ | | NanoPi-R2C-Plus | ||
+ | | NanoPi-R2S-Plus | ||
+ | | NanoPi-R5C | ||
+ | | NanoPi-R2C = | ||
+ | ===配置状态灯=== | ||
+ | 先确定一下系统是否已经存在leds初始化的服务: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo systemctl status leds | ||
+ | </syntaxhighlight> | ||
+ | 如果已经存在leds服务, 则通过编辑如下文件改变状态灯的默认行为: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | /etc/init.d/leds.sh | ||
+ | </syntaxhighlight> | ||
+ | 早期的固件由于没有leds服务, 需要参考以下指南手动配置状态灯, 首先, 设置开机自动加载以下内核模块:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | modprobe ledtrig-netdev | ||
+ | echo ledtrig-netdev > /etc/modules-load.d/ledtrig-netdev.conf | ||
+ | </syntaxhighlight> | ||
+ | 下面的脚本代码将状态灯与网卡相关联, 需要加入到开机自动运行的脚本中:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | echo netdev > /sys/class/leds/wan_led/trigger | ||
+ | echo eth0 > /sys/class/leds/wan_led/device_name | ||
+ | echo 1 > /sys/class/leds/wan_led/link | ||
+ | |||
+ | echo netdev > /sys/class/leds/lan_led/trigger | ||
+ | echo eth1 > /sys/class/leds/lan_led/device_name | ||
+ | echo 1 > /sys/class/leds/lan_led/link | ||
+ | </syntaxhighlight> | ||
+ | | NanoPi-R5S | ||
+ | | NanoPi-R6S = | ||
+ | ===配置状态灯=== | ||
+ | 先确定一下系统是否已经存在leds初始化的服务: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo systemctl status leds | ||
+ | </syntaxhighlight> | ||
+ | 如果已经存在leds服务, 则通过编辑如下文件改变状态灯的默认行为: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | /etc/init.d/leds.sh | ||
+ | </syntaxhighlight> | ||
+ | 早期的固件由于没有leds服务, 需要参考以下指南手动配置状态灯, 首先, 设置开机自动加载以下内核模块:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | modprobe ledtrig-netdev | ||
+ | echo ledtrig-netdev > /etc/modules-load.d/ledtrig-netdev.conf | ||
+ | </syntaxhighlight> | ||
+ | 下面的脚本代码将状态灯与网卡相关联, 需要加入到开机自动运行的脚本中:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | echo netdev > /sys/class/leds/wan_led/trigger | ||
+ | echo eth0 > /sys/class/leds/wan_led/device_name | ||
+ | echo 1 > /sys/class/leds/wan_led/link | ||
+ | |||
+ | echo netdev > /sys/class/leds/lan1_led/trigger | ||
+ | echo eth1 > /sys/class/leds/lan1_led/device_name | ||
+ | echo 1 > /sys/class/leds/lan1_led/link | ||
+ | |||
+ | echo netdev > /sys/class/leds/lan2_led/trigger | ||
+ | echo eth2 > /sys/class/leds/lan2_led/device_name | ||
+ | echo 1 > /sys/class/leds/lan2_led/link | ||
+ | </syntaxhighlight> | ||
+ | | NanoPi-R6C = | ||
+ | ===配置状态灯=== | ||
+ | 先确定一下系统是否已经存在leds初始化的服务: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo systemctl status leds | ||
+ | </syntaxhighlight> | ||
+ | 如果已经存在leds服务, 则通过编辑如下文件改变状态灯的默认行为: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | /etc/init.d/leds.sh | ||
+ | </syntaxhighlight> | ||
+ | 早期的固件由于没有leds服务, 需要参考以下指南手动配置状态灯, 首先, 设置开机自动加载以下内核模块:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | modprobe ledtrig-netdev | ||
+ | echo ledtrig-netdev > /etc/modules-load.d/ledtrig-netdev.conf | ||
+ | </syntaxhighlight> | ||
+ | 下面的脚本代码将状态灯与网卡相关联, 需要加入到开机自动运行的脚本中:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | echo netdev > /sys/class/leds/wan_led/trigger | ||
+ | echo eth0 > /sys/class/leds/wan_led/device_name | ||
+ | echo 1 > /sys/class/leds/wan_led/link | ||
+ | |||
+ | echo netdev > /sys/class/leds/lan1_led/trigger | ||
+ | echo eth1 > /sys/class/leds/lan1_led/device_name | ||
+ | echo 1 > /sys/class/leds/lan1_led/link | ||
+ | </syntaxhighlight> | ||
+ | 板载的LED1可以根据需要进行配置,节点是 /sys/class/leds/usr_led。 | ||
+ | | NanoPC-T6 = | ||
+ | ===配置状态灯=== | ||
+ | 先确定一下系统是否已经存在leds初始化的服务: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | sudo systemctl status leds | ||
+ | </syntaxhighlight> | ||
+ | 如果已经存在leds服务, 则通过编辑如下文件改变状态灯的默认行为: | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | /etc/init.d/leds.sh | ||
+ | </syntaxhighlight> | ||
+ | 早期的固件由于没有leds服务, 需要参考以下指南手动配置状态灯, 首先, 设置开机自动加载以下内核模块:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | modprobe ledtrig-netdev | ||
+ | echo ledtrig-netdev > /etc/modules-load.d/ledtrig-netdev.conf | ||
+ | </syntaxhighlight> | ||
+ | 下面的脚本代码将板载LED1与第一个网卡相关联, 需要加入到开机自动运行的脚本中:<br /> | ||
+ | <syntaxhighlight lang="bash"> | ||
+ | echo netdev > /sys/class/leds/usr_led/trigger | ||
+ | echo eth0 > /sys/class/leds/usr_led/device_name | ||
+ | echo 1 > /sys/class/leds/usr_led/link | ||
+ | </syntaxhighlight> | ||
+ | | #default = | ||
+ | }} |
Latest revision as of 10:53, 4 December 2023
Contents
1 FriendlyCore的使用
1.1 FriendlyCore默认帐户
- 普通用户:
用户名: pi 密码: pi
- Root用户:
用户名: Root用户: 密码: fa
1.2 更新软件包
$ sudo apt-get update
1.3 配置网络
1.3.1 设置静态IP地址
默认已将 eth0 配置成 dhcp 自动获取IP地址,要更改配置,可以修改这个文件:
vi /etc/network/interfaces.d/eth0
比如修改成静态IP地址,如下所示:
auto eth0 iface eth0 inet static address 192.168.1.231 netmask 255.255.255.0 gateway 192.168.1.1
1.3.2 设置DNS
还需要修改如下文件加入DNS的配置:
vi /etc/systemd/resolved.conf
例如设置为192.168.1.1:
[Resolve] DNS=192.168.1.1
再用以下命令重新启动systemd-resolved服务:
sudo systemctl restart systemd-resolved.service sudo systemctl enable systemd-resolved.service
1.3.3 设置使用另一个网络接口
要配置另一个网口, 例如eth1,可以在 /etc/network/interfaces.d/ 下复制 eth0 成 eth1,然后编辑eth1, 把其中的eth0改为eth1, 根据需要指定网络配置:
cp /etc/network/interfaces.d/eth0 /etc/network/interfaces.d/eth1 vi /etc/network/interfaces.d/eth1
1.4 连接WiFi
先用以下命令检查一下系统是否有安装Network-Manager:
which nmcli
如果有安装Network-Manager, 则参考此链接的方法连接WiFi: Use NetworkManager to configure network settings/zh, 如果没有安装, 则参考如下方法配置WiFi,
输入以下命令查询一下WiFi的网络接口,wlan开头的就是WiFi:
ifconfig -a
默认情况下是wlan0,在/etc/network/interfaces.d/目录下新建一个与网络接口同名的配置文件 ,以wlan0为例,用vi命令新建以下文件:
sudo vi /etc/network/interfaces.d/wlan0
wlan0文件的内容如下:
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet dhcp
wpa-driver wext
wpa-ssid YourWiFiESSID
wpa-ap-scan 1
wpa-proto RSN
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk YourWiFiPassword
其中,YourWiFiESSID和YourWiFiPassword请替换成你要连接的无线AP名称和密码, 保存文件后输入以下命令, 或者重启以应用配置:
sudo systemctl daemon-reload sudo systemctl restart networking
需要注意的是,如果你的SD卡在多个硬件上运行,WiFi的网络接口可能会被重命名为wlan1, wlan2等,你可以通过清空这个文件的内容并重启让它恢复为默认值:/etc/udev/rules.d/70-persistent-net.rules。
1.5 安装内核头文件
sudo dpkg -i /opt/linux-headers-*.deb