280篇 Default中的文章

Ubuntu 用chrony同步时间

开始

这个软件包含两个命令集: chronyc 客户端 和 chronyd 守护进程. 安装chrony方法:

sudo apt install chrony

验证 chrony是否安装成功,并查看有多少个服务端及结点已连接:

$ chronyc activity
200 OK
8 sources online
0 sources offline
0 sources doing burst (return to online)
0 sources doing burst (return to offline)
0 sources with unknown address

配置 /etc/chrony/chrony.conf, 参考 https://chrony.tuxfamily.org/doc/3.5/chrony.conf.html

More ~

vscode默认打开新tab

偏好设置里添加
"workbench.editor.enablePreview": false
或者 去掉勾选 WorkBench> Editor> Enable Preview
或者 Ctrl+Shift+P 搜索Settting, setting中搜索 preview, 按上面的去掉勾选即可

More ~

开始玩树莓派 - 装CentOS

镜像地址 https://mirrors.huaweicloud.com/centos-altarch/7.7.1908/isos/armhfp/CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-4-1908-sda.raw.xz

CentOS8貌似还没有树莓派的编译版本。

准备另一个32G的tf卡, 用SDCardFormater格式化,再用dd命令烧写。
diskutil umount /dev/disk3s1 别忘了这句

sudo dd bs=64m if=~/Downloads/CentOS-Userland-7-armv7hl-RaspberryPI-Minimal-4-1908-sda.raw of=/dev/disk3

连接网线开机。

在mac上用nmap扫出IP. nmap可以用brew 装
nmap -sn 192.168.1.0/24

More ~

开始玩树莓派 - 将树莓派连接的USB打印机搞成打印服务器

当初为了省钱,买了个不支持无线的有线打印机,联想的LJ2205,黑白激光。
其实mac连接后,共享也没啥问题,不过用的时候mac要开机。

树莓派上先装cups相关的服务。

sudo apt-get install cups

装完执行sudo cupsctl --remote-any 允许远程访问

USB连接打印机。这个LJ2205有linux驱动,但是解压出的pdd文件没法用。找了些资料,说是联想的打印机都是Brother代工的,驱动大同小异。索性就用Brother的驱动试。

sudo apt-cache search printer-driver*可以查找下有哪些驱动,期中有个printer-driver-brlaser

于是装了这个sudo apt-get install printer-driver-brlaser

在Add printers时使用这个**Brother HL-L2300D, using brlaser v4 **,试了下测试页可以正常打出了。

前面试过其它打出的是空白的,一些坑就不细说了。
另外在访问https://*:631时,https在chrome下报错,可以在Safari下正常访问。

以下我也试了,iPhone手机和安卓手机,mac添加没问题,除了win10没试
To enable LPR support for Windows, we need to install the inet daemon:

apt-get install openbsd-inetd
Once installed, add the following line to the end of /etc/inetd.conf:

printer stream tcp nowait lp /usr/lib/cups/daemon/cups-lpd cups-lpd -o document-format=application/octet-stream

Restart inetd with:

systemctl restart openbsd-inetd

For AirPrint support, you must install avahi-daemon:

apt-get install --no-install-recommends avahi-daemon libnss-mdns

参考:
https://jtanx.github.io/2016/12/27/making-a-fast-rpi-print-server/

More ~

开始玩树莓派 - TF卡刷系统

树莓派官网提供了个imager工具,用来烧录系统。可是我在win10和mac下装上刷完系统,开机没任何反应。

最后在哪看到要用SDCardFormater格式化,这个试了也是一样,格式化应该用mac系统带的Disk Utility就可以。

主要原因应该还是烧录系统的问题。后来用dd命令试了刷了系统可以启动。

diskutil list 先查sd卡,如disk3

diskutil umount /dev/disk3s1 再卸载挂载的

sudo dd bs=4m if=/Users/xxx/Downloads/2020-02-13-raspbian-buster.img of=/dev/disk3

status=progress mac不支持这个选项。
再往盘里写系统

More ~

开始玩树莓派-修改源

vi /etc/apt/sources.list

原有的先注释,改为阿里的。

deb http://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib rpi
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib rpi

More ~