第 18.3 节 树莓派 FreeBSD 配置
SSH 设置
使用 XShell 即可登录树莓派。用户名密码均为 freebsd
。root 需要登录后输入 su
,密码为 root
。
调整时区
# tzsetup
要选择 No
--> 5 Asia
--> 9 China
--> 1 Beijing Time
--> Does the abbreviation CST' look reasonable?
--> 选择 Yes
。
时间设置
然后就是时间设置问题,树莓派 5 以前的款式没有板载 RTC 时钟来确保时间准确。所以完全依靠 NTP 服务来校正时间,如果时间不准确,将影响很多服务的运行,比如无法执行 portsnap auto 命令。
方法很简单:
在 /etc/rc.conf
中加入
ntpd_enable="YES"
ntpdate_enable="YES"
ntpdate_program="ntpdate"
ntpdate_flags="0.cn.pool.ntp.org"
然后开启时间服务器:
# service ntpdate start
查看时间:
# date
Tue Aug 1 16:45:55 CST 2023
主机名
在 /etc/rc.conf
这个文件中,还可修改主机名 hostname="generic"
。即将 generic
换成自己想要的名字。
CPU 频率
CPU 频率调整(600MHZ 到 1500MHZ):
# sysrc powerd_enable="YES"
# service powerd restart
显示温度
root@ykla # sysctl -a | grep temperature
hw.cpufreq.temperature: 50598
dev.cpu.0.temperature: 51.0C
或
root@ykla # sysctl dev.cpu | grep temperature
dev.cpu.0.temperature: 50.1C
查看 CPU 频率
root@ykla # sysctl dev.cpu.0.freq_levels
dev.cpu.0.freq_levels: 2000/-1 600/-1
htop
使用 pkg 安装:
# pkg install htop
或者使用 Ports 安装:
# cd /usr/ports/sysutils/htop/
# make install clean
持久化设置(默认的 F10 保存后不能 ctrl
+ c
,必须点 quit 才能保存设置; 亦可于文件中指定):
ee ~/.config/htop/htoprc
写入以下内容可打开 CPU 频率、温度:
show_cpu_frequency=1
show_cpu_temperature=1
参考文献:
参考文献
最后更新于