树莓派4B折腾笔记

查看设备温度

$ 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

DexterLien

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值