查看设备温度
$ vcgencmd measure_temp
创建自定义开机启动服务
创建一个frp开机自启动的服务
$ sudo vim /etc/systemd/system/frp.service
配置内容如下:
[Unit]
Description=FRP内网穿透服务
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/home/pi/lian/frp_0.33.0_linux_arm/frpc -c /home/pi/lian/frp_0.33.0_linux_arm/frpc.ini
RestartSec=10
Restart=always
[Install]
WantedBy=multi-user.target
配置开机自动启动
$ sudo systemctl daemon-reload
$ sudo systemctl enable frp
$ sudo systemctl start frp
如需以root
身份运行命令,可以这样写配置:
[Unit]
Description=USB设备共享服务
After=network.target
[Service]
Type=simple
ExecStart=/home/pi/lian/vhusbarm -b
User=root
Group=root
[Install]
WantedBy=multi-user.target
配置静态IP
$ sudo rm -f /etc/netplan/*.yaml
$ sudo vim /etc/netplan/static.yaml
新建的配置文件内容格式如下
network:
ethernets:
eth0:
dhcp4: no
addresses: [192.168.31.169/24]
optional: true
gateway4: 192.168.31.1
nameservers:
addresses: [114.114.114.114]
version: 2
禁用无线网卡
# vim /boot/config
添加下面内容后重启生效
dtoverlay=pi3-disable-wifi
移除外接显示器的黑边
接了个7寸的外置显示器后发现屏幕没有充满显示,外面有一圈黑边(是有LED背光,不是物理边框)
解决办法:
$ sudo vim /boot/config.txt
# 取消下面的注释行
disable_overscan=1
随后重启一下,显示正常:
关联ll
命令
用习惯了ll
来替换ls
命令,raspbian中居然不能直接用,只好手动关联一下:
# vim ~/.bashrc
末尾行后面增加一行
alias ll="ls -la --color=auto"
即时生效需要执行下面命令:
# source ~/.bashrc
使用cockpit
远程管理
# apt install -y cockpit
// 设置允许http访问(默认只允许https)
# vim /etc/cockpit/cockpit.conf
// 这个文件默认是不存在的,直接创建后修改内容如下:
[WebService]
#允许http协议访问
AllowUnencrypted=true
#设置默认网页Title
LoginTitle=我的树莓派
配置开机自动启动:
# systemctl enable cockpit.socket
# systemctl start cockpit.socket
然后就可以使用浏览器访问http://树莓派IP:9090
打开cockpit了
安装docker-ce
切换raspbian
阿里镜像源
# vim /etc/apt/source.list
修改内容如下:
deb https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib
deb-src https://mirrors.aliyun.com/raspbian/raspbian/ buster main non-free contrib
添加docker-ce
阿里镜像源
先删除掉/etc/apt/source.list.d/
里面默认的.list
文件,然后创建新的
# vim /etc/apt/source.list.d/docker-ce.list
deb https://mirrors.aliyun.com/docker-ce/linux/raspbian buster stable
安装docker-ce
# apt update -y
// 安装必要包
# apt-get -y install apt-transport-https ca-certificates curl software-properties-common
// 安装GPG证书
# curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
// 再更新一下
# apt update -y
// 安装docker-ce
# apt install -y docker-ce
// 设置开机自动启动
# systemctl enable docker
// 启动docker
# systemctl start docker
配置cockpit
支持docker管理
# apt install cockpit-docker